Fuzz or property test deserialization with random bytes #2282
Labels
A-consensus
Area: Consensus rule updates
A-network
Area: Network protocol updates or fixes
A-rust
Area: Updates to Rust code
C-security
Category: Security issues
C-testing
Category: These are tests
I-panic
Zebra panics with an internal error message
Motivation
In Zebra, we do some random struct serialization round-trip property tests (#27).
But we don't take random bytes and try to deserialize them. This means that it's harder to catch security issues like #2263.
API Reference
proptest
hasArbitrary
random data implementations for fixed-size byte arrays and variable-size byte vectors:https://docs.rs/proptest/1.0.0/proptest/arbitrary/trait.Arbitrary.html
Solution
For each deserialized type:
Try to prioritise smaller types over larger types, because a lot of larger types are just aggregates of smaller types.
Issues
Alternatives
If we don't do this, we risk panic security vulnerabilities.
Related Work
Use property testing for message struct serialization round-trips #27 - goes from random types to bytes and back
The text was updated successfully, but these errors were encountered: