ADR 0004: Coverage-guided fuzzing beside the crate
- Status: Accepted, 2026-12-02 (decision D23 of the implementation plan)
Context
The input decoder reads bytes the terminal sends, which petitcarnets does not control. An in-house fuzz test (fuzz_ten_million) runs ten million generated inputs through it in CI, but it is blind: it does not know which branches an input reached. OpenSSF Scorecard scored Fuzzing 0, because it recognises only cargo-fuzz, OSS-Fuzz and ClusterFuzzLite, and the portfolio standard (AGENTS.md 6.1) asks for ClusterFuzzLite on every repository that parses input.
Decision
A separate, unpublished crate, fuzz/, holds the cargo-fuzz targets. It is its own workspace with its own lockfile, so petitcarnets' [dependencies] stay empty (ADR 0001) and cargo tree still prints one crate. Its one target, input, runs the same properties as the in-house test (src/input/fuzz.rs: no read past the buffer, nothing left stuck), reached through petitcarnets::fuzz, a module built only with --cfg fuzzing and so never part of the API.
ClusterFuzzLite (.clusterfuzzlite/, .github/workflows/fuzz.yml) builds the targets and fuzzes the code each pull request changes, with the input fixture as the seed corpus. An input that once crashed a target is committed to fuzz/regressions/<target>/ and replayed by make check.
Consequences
- The fuzz crate's lockfile has ten third-party packages:
libfuzzer-sys0.4.13 (rust-fuzz) and what it brings,arbitrary,cc,cfg-if,find-msvc-tools,getrandom,jobserver,libc,r-efiandshlex. They are fuzz-only, approved for every repository by AGENTS.md 6.1, and never reach a user of the crate. - ClusterFuzzLite's actions are pinned by commit and its build image by digest; Dependabot moves both, and the fuzz crate's lockfile.
- The in-house test stays: it needs no nightly toolchain, and it runs in
make checkon every machine.