|
| 1 | +# Fuzzing Policy |
| 2 | + |
| 3 | +`base64-ng` keeps fuzzing isolated from the published crate. The root crate |
| 4 | +remains dependency-free; fuzz-only dependencies live under `fuzz/` and are |
| 5 | +checked separately. |
| 6 | + |
| 7 | +Run fuzz harness checks with: |
| 8 | + |
| 9 | +```sh |
| 10 | +scripts/check_fuzz.sh |
| 11 | +``` |
| 12 | + |
| 13 | +Run corpus policy checks directly with: |
| 14 | + |
| 15 | +```sh |
| 16 | +scripts/check_fuzz_corpus.sh |
| 17 | +``` |
| 18 | + |
| 19 | +## Targets |
| 20 | + |
| 21 | +Current fuzz targets: |
| 22 | + |
| 23 | +- `decode`: arbitrary strict, legacy, and constant-time-oriented decode input |
| 24 | +- `in_place`: in-place encode/decode and legacy compaction behavior |
| 25 | +- `stream_chunks`: fragmented stream reader/writer state machines and adjacent |
| 26 | + framed payload boundaries |
| 27 | +- `differential`: canonical output comparison against the established Base64 |
| 28 | + behavior used by the harness |
| 29 | + |
| 30 | +## Corpus Admission |
| 31 | + |
| 32 | +Committed corpus inputs are allowed only under: |
| 33 | + |
| 34 | +- `fuzz/corpus/decode/` |
| 35 | +- `fuzz/corpus/in_place/` |
| 36 | +- `fuzz/corpus/stream_chunks/` |
| 37 | +- `fuzz/corpus/differential/` |
| 38 | + |
| 39 | +Each committed corpus input must be: |
| 40 | + |
| 41 | +- small enough to review manually, with a hard local limit of 64 KiB |
| 42 | +- relevant to a previously fixed bug, a protocol boundary, or an edge case not |
| 43 | + already represented by deterministic tests |
| 44 | +- non-sensitive and safe to publish |
| 45 | +- named or documented well enough that reviewers can understand why it exists |
| 46 | + |
| 47 | +Generated crashes, hangs, and local artifacts must stay out of commits. The |
| 48 | +release gate rejects files under `fuzz/artifacts/` other than `.gitignore`. |
| 49 | + |
| 50 | +## Running Local Campaigns |
| 51 | + |
| 52 | +Install nightly and cargo-fuzz: |
| 53 | + |
| 54 | +```sh |
| 55 | +rustup toolchain install nightly |
| 56 | +cargo install --locked cargo-fuzz |
| 57 | +``` |
| 58 | + |
| 59 | +Run bounded smoke campaigns before release-sensitive stream or decode changes: |
| 60 | + |
| 61 | +```sh |
| 62 | +cargo +nightly fuzz run decode -- -runs=1000 |
| 63 | +cargo +nightly fuzz run in_place -- -runs=1000 |
| 64 | +cargo +nightly fuzz run stream_chunks -- -runs=1000 |
| 65 | +cargo +nightly fuzz run differential -- -runs=1000 |
| 66 | +``` |
| 67 | + |
| 68 | +Longer campaigns are useful before release candidates, but generated corpus |
| 69 | +changes should be reviewed deliberately. Keep only the inputs that improve |
| 70 | +coverage or preserve a regression. |
0 commit comments