Bind invoice hashes to encoded bytes#4752
Conversation
Previously, deserialized invoices recomputed their signature hash by re-encoding the parsed invoice. Non-canonical amount digits could then be dropped, letting distinct encodings share a hash. Hash deserialized invoices from the HRP and unsigned data bytes accepted by the parser so the cached hash remains bound to the encoded invoice. Reported by Project Loupe. Co-Authored-By: HAL 9000
|
I've assigned @wpaulino as a reviewer! |
|
No issues found. The change is a correct and well-targeted security fix for invoice hash malleability:
No bugs, security regressions, or logic errors found in the diff. |
|
I'd rather we just update the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4752 +/- ##
==========================================
+ Coverage 84.55% 86.95% +2.40%
==========================================
Files 137 161 +24
Lines 77617 111658 +34041
Branches 77617 111658 +34041
==========================================
+ Hits 65627 97097 +31470
- Misses 9948 12054 +2106
- Partials 2042 2507 +465
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Previously, deserialized invoices recomputed their signature hash by re-encoding the parsed invoice. Non-canonical amount digits could then be dropped, letting distinct encodings share a hash.
Hash deserialized invoices from the HRP and unsigned data bytes accepted by the parser so the cached hash remains bound to the encoded invoice.
Reported by Project Loupe.
Co-Authored-By: HAL 9000