Commit 29dfc1f
committed
feat: add validation for leading whitespace in BOLT 12 bech32 strings
Found through differential fuzzing between C-Lightning and rust-lightning:
rust-lightning incorrectly accepted offers starting with whitespace when
continuation characters (+) were present, while C-Lightning correctly
rejected them per BOLT 12 specification.
- Add InvalidLeadingWhitespace error variant to Bolt12ParseError
- Validate that bech32 strings don't start with whitespace characters
- Separate validation logic for first chunk vs continuation chunks
- Add test case for leading whitespace validation1 parent e01663a commit 29dfc1f
1 file changed
+25
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
47 | 60 | | |
48 | 61 | | |
49 | 62 | | |
| |||
123 | 136 | | |
124 | 137 | | |
125 | 138 | | |
| 139 | + | |
| 140 | + | |
126 | 141 | | |
127 | 142 | | |
128 | 143 | | |
| |||
322 | 337 | | |
323 | 338 | | |
324 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
325 | 349 | | |
326 | 350 | | |
327 | 351 | | |
| |||
0 commit comments