-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Authenticator Fuzzer #14869
Authenticator Fuzzer #14869
Conversation
⏱️ 3h 27m total CI duration on this PR
🚨 2 jobs on the last run were significantly faster/slower than expected
|
Co-authored-by: Gerardo Di Giacomo <gerardo@aptoslabs.com>
@@ -38,6 +38,15 @@ impl Clone for Ed25519PrivateKey { | |||
#[derive(DeserializeKey, Clone, SerializeKey)] | |||
pub struct Ed25519PublicKey(pub(crate) ed25519_dalek::PublicKey); | |||
|
|||
#[cfg(any(test, feature = "fuzzing"))] |
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.
So this just picks uniform random bytes, right?
If so, this will not be a valid PK.
The Q is: do you want it to be?
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 think I should either move to a custom implementation of arbitrary or get rid of it. It comes in handy for starting a really dumb fuzzer without having to recreate too many types.
@@ -18,6 +18,15 @@ use std::{cmp::Ordering, fmt}; | |||
#[derive(DeserializeKey, Clone, SerializeKey)] | |||
pub struct Ed25519Signature(pub(crate) ed25519_dalek::Signature); | |||
|
|||
#[cfg(any(test, feature = "fuzzing"))] | |||
impl<'a> arbitrary::Arbitrary<'a> for Ed25519Signature { | |||
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> { |
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.
Same point here as for the PK.
It's even trickier here because a "valid" signature is defined w.r.t. to a PK and a message, so you cannot even sample it randomly without having those.
FuzzerTransactionAuthenticator::Keyless { | ||
sender: _, | ||
style, | ||
any_keyless_public_key, |
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.
How is this sampled? Via the Arbitrary
trait?
How do you plan on sampling keyless public keys and signatures that are at least partially-valid (e.g., the EphemeralCertificate
in the KeylessSignature
verifies under the KeylessPublicKey
?)
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 guess you will modify them appropriately inside your match style
cases, as needed for that fuzzing strategy?
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.
Yes, I can override within the match what I want done in a specific way.
echo " add adds a new fuzz target" | ||
echo " build builds fuzz targets" | ||
echo " build-oss-fuzz builds fuzz targets for oss-fuzz" | ||
echo " coverage generates coverage for a fuzz target" |
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.
clean-coverage
missing?
) | ||
.set_not_parallel(); | ||
|
||
let sender_acc = if true { |
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.
is the if statement needed?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
An early stage fuzzer for Authenticators. This PR exists only to push it on OSS-Fuzz, while working on the other strategies and refactoring the code.
Brought back coverage report generation in fuzz.sh.
New:
How Has This Been Tested?
Local build and runs.
Key Areas to Review
N/A
Type of Change
Which Components or Systems Does This Change Impact?
Checklist