onionwire/fuzz/README.md

26 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

# Fuzzing OnionWire
Structured fuzzing for the four parsers that eat untrusted peer input. A crash
here is a remote-triggerable panic, so a reproducer must be fixed in `src/` and
then folded into `fuzz/seeds/<target>/` as a regression input.
| target | entry points |
|---|---|
| `ratchet_frame` | `ratchet::RatchetState::from_bytes`, `RatchetState::decrypt` (the `rat ` frame parser) |
| `qr_decode` | `qr::decode` (pasted/scanned invite strings) |
| `dispatch_classify` | `dispatch::classify` (routes a `rat ` frame to the ratchet parser) |
| `file_decode` | `file::decode` (`fil ` chunk frames) |
Nothing in `src/` changes for this: every target calls the shipped public API.
```sh
rustup toolchain install nightly --profile minimal
cargo install cargo-fuzz
scripts/run-fuzz.sh # all four, 60s each
FUZZ_SECS=300 scripts/run-fuzz.sh ratchet_frame
```
`fuzz/corpus/` is gitignored (libFuzzer grows it locally); `fuzz/seeds/` is
committed and copied in by the script. Crash reproducers land in
`fuzz/artifacts/<target>/`. Needs rustup's `cargo` on `PATH` — the `+nightly`
directive does not work through a distro `cargo` package.