Four pure parsers eat untrusted peer input and had no structured fuzzing:
- ratchet_frame -> RatchetState::from_bytes + RatchetState::decrypt
(the 'rat ' frame parser: prefix, version, length,
N/PN bounds, DH step, AEAD open)
- qr_decode -> qr::decode on pasted/scanned invite strings
- dispatch_classify -> dispatch::classify on raw decrypted plaintext,
including the 'rat ' -> Kind::Ratchet routing arm
- file_decode -> file::decode on 'fil ' chunk frames
No src/ change: every target calls the shipped public API. The fuzz crate is
its own workspace (empty [workspace] table), so no root Cargo.toml dependency
is added and cargo build/test at the root never compiles it.
Seeds in fuzz/seeds/ are committed and copied into the gitignored working
corpus by scripts/run-fuzz.sh; each target asserts properties a panic-free
decode must hold (a rejected ratchet frame leaves the state byte-identical,
a decoded invite is 32/32/onion-shaped, a decoded chunk re-encodes).
Verified: cargo +nightly fuzz list -> 4 targets; scripts/run-fuzz.sh with
FUZZ_SECS=60 FUZZ_JOBS=4 -> exit 0, oom/timeout/crash: 0/0/0 for all four,
fuzz/artifacts/* empty.
44 lines
784 B
TOML
44 lines
784 B
TOML
[package]
|
|
name = "onionwire-fuzz"
|
|
version = "0.0.0"
|
|
publish = false
|
|
edition = "2021"
|
|
|
|
[package.metadata]
|
|
cargo-fuzz = true
|
|
|
|
# Detach from the parent package: this crate is nightly-only and must never be
|
|
# part of a normal `cargo build` / `cargo test` of the root crate.
|
|
[workspace]
|
|
|
|
[dependencies]
|
|
libfuzzer-sys = "0.4"
|
|
onionwire = { path = ".." }
|
|
|
|
[[bin]]
|
|
name = "ratchet_frame"
|
|
path = "fuzz_targets/ratchet_frame.rs"
|
|
test = false
|
|
doc = false
|
|
bench = false
|
|
|
|
[[bin]]
|
|
name = "qr_decode"
|
|
path = "fuzz_targets/qr_decode.rs"
|
|
test = false
|
|
doc = false
|
|
bench = false
|
|
|
|
[[bin]]
|
|
name = "dispatch_classify"
|
|
path = "fuzz_targets/dispatch_classify.rs"
|
|
test = false
|
|
doc = false
|
|
bench = false
|
|
|
|
[[bin]]
|
|
name = "file_decode"
|
|
path = "fuzz_targets/file_decode.rs"
|
|
test = false
|
|
doc = false
|
|
bench = false
|