-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
lnwire: signature parsing/conversion fuzz tests #7649
lnwire: signature parsing/conversion fuzz tests #7649
Conversation
@Crypt-iQ: review reminder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🔥
@@ -822,3 +822,24 @@ func FuzzCustomMessage(f *testing.F) { | |||
harness(t, data) | |||
}) | |||
} | |||
|
|||
// FuzzParseRawSignature tests that our DER-encoded signature parsing does not | |||
// panic for arbitrary inputs and that serializing and reparsing the signatures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/reparsing/re-parsing
if err != nil { | ||
t.Fatalf("failed to reparse signature: %v", err) | ||
} | ||
|
||
if !reflect.DeepEqual(sig, sig2) { | ||
t.Fatalf("signature mismatch: %v != %v", sig, sig2) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to use the require
package for these? I see that all the other fuzz tests also dont use it... not sure if there was a specific reason for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a good reason. I'll send a follow-up PR making the change for all fuzz tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👑
3d2677a
to
7b17a4a
Compare
Rebased and added release note. |
Looks like something else snuck in before and added another conflict in the release notes. |
7b17a4a
to
650f4f3
Compare
Fixed. |
Again, sorry... I promise, this PR is next in the merge queue! |
Test parsing and serialization of raw DER-encoded signatures.
Test conversion of fixed 64-byte signatures to DER-encoded signatures.
650f4f3
to
55aa7a7
Compare
Rebase. Third time's the charm. |
Adds seeds for the FuzzParseRawSignature target recently added to LND [1]. Generated from 100+ CPU-hours of fuzzing and minimized using the script from lightninglabs#4. [1] lightningnetwork/lnd#7649
Adds seeds for the FuzzConvertFixedSignature target recently added to LND [1]. Generated from 100+ CPU-hours of fuzzing and minimized using the script from lightninglabs#4. [1] lightningnetwork/lnd#7649
We call lnwire's signature parsing and conversion functions from many places in LND, often with untrusted inputs, and existing fuzz tests had incomplete coverage of these functions.
No crashes found after 100+ CPU-hours of fuzzing for each fuzz target.