Repository navigation
Fail bolt11 invoices with a wrong-length p, h, s or n field - #9670
Open
vincenzopalazzo wants to merge 1 commit into
Open
vincenzopalazzo wants to merge 1 commit into
vincenzopalazzo wants to merge 1 commit into
Conversation
vincenzopalazzo
force-pushed
the
fix/bolt11-wrong-fixed-length
branch
2 times, most recently
from
October 27, 2026 16:11
485ce33 to
6540882
Compare
BOLT ElementsProject#11 requires a reader to fail the payment if a fixed-length `p`, `h`, `s` or `n` field is not 52, 52, 52 or 53 digits. A second copy of those tags was treated as an unknown field and skipped, so decode accepted the invoice. Check the length before the unknown-field skip, including duplicates. The published "fields which must be ignored" vector is now rejected; unknown tags and unknown fallback versions are still skipped. Fixes ElementsProject#9668 Changelog-Fixed: bolt11: reject an invoice whose `p`, `h`, `s` or `n` field has the wrong length.
vincenzopalazzo
force-pushed
the
fix/bolt11-wrong-fixed-length
branch
from
October 27, 2026 17:26
6540882 to
a19705e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bolt11_decodeaccepted an invoice whosep,h,sornfield had the wrongdata_length. A duplicate of those tags never reached the length check: it was stored as an unknown field and skipped.4b539711, also current master of lightning/bolts) says a reader MUST fail the payment if any field with fixeddata_length(p,h,s,n) is not 52, 52, 52 or 53. The older "MUST skip" wording is gone.fversions are still skipped.Fixes #9668
Test plan
make unittest/common/test/run-bolt11— rejectsp/h/sof length 51 and 53, andnof length 52 and 54, and rejects the published ignored-fields vector withp: invalid length 51 (expected 52)make bolt-check/common/bolt11.cagainst the pinned BOLT quote