Skip to content

Add onion failure packet length check to prevent out of bounds error #3686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

joostjager
Copy link
Contributor

@joostjager joostjager commented Mar 26, 2025

Fixes an oversight in the refactor in commit ea0f099 when moving the decoding of the packet.

This created a serious problem where a too short failure message received from downstream could crash the node. Added test coverage also.

Found via fuzzing.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 26, 2025

👋 Thanks for assigning @valentinewallace as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@joostjager joostjager marked this pull request as ready for review March 26, 2025 14:40
@joostjager joostjager requested a review from arik-so March 26, 2025 14:40
Copy link

codecov bot commented Mar 26, 2025

Codecov Report

Attention: Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.24%. Comparing base (030a784) to head (62c1205).

Files with missing lines Patch % Lines
lightning/src/ln/onion_route_tests.rs 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3686      +/-   ##
==========================================
- Coverage   89.25%   89.24%   -0.02%     
==========================================
  Files         155      155              
  Lines      119959   119982      +23     
  Branches   119959   119982      +23     
==========================================
+ Hits       107069   107077       +8     
- Misses      10276    10283       +7     
- Partials     2614     2622       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

Fixes an oversight in the refactor in commit
ea0f099 when moving the decoding of the
packet.
Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, log DoS not a concern here

@joostjager joostjager merged commit b18e0d9 into lightningdevkit:main Mar 26, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants