diff --git a/docs/FUZZING.md b/docs/FUZZING.md index febfcfc..0a5e4c0 100644 --- a/docs/FUZZING.md +++ b/docs/FUZZING.md @@ -99,7 +99,9 @@ Install the `honggfuzz` binary (distro package or source). Point it at a binary ## CI smoke -GitHub Actions (`.github/workflows/fuzz-smoke.yml`) builds all targets with sanitizer `none`, then runs **`scripts/fuzz-libfuzzer.sh`** with **`FUZZ_RUNS=2000`** so every target gets a short fixed-iteration smoke (same idea as below). +GitHub Actions (`.github/workflows/fuzz-smoke.yml`) builds all targets with sanitizer `none`, then runs **`scripts/fuzz-libfuzzer.sh`** with **`FUZZ_RUNS=2000`** so every registered fuzz target gets a short fixed-iteration smoke (same idea as below). + +`scripts/fuzz-libfuzzer.sh` discovers targets dynamically from `cargo fuzz list`, so adding a new `[[bin]]` fuzz target in `fuzz/Cargo.toml` automatically includes it in local and CI smoke runs. Locally you can match that with: diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index fdc070a..c55cdfa 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -709,7 +709,7 @@ dependencies = [ [[package]] name = "zkac" -version = "0.5.1" +version = "0.7.0" dependencies = [ "blake2", "chacha20poly1305", diff --git a/scripts/fuzz-libfuzzer.sh b/scripts/fuzz-libfuzzer.sh index c067137..1a1980a 100755 --- a/scripts/fuzz-libfuzzer.sh +++ b/scripts/fuzz-libfuzzer.sh @@ -22,14 +22,19 @@ FUZZ_TIME="${FUZZ_TIME:-60}" FUZZ_RUNS="${FUZZ_RUNS:-}" SANITIZER="${SANITIZER:-none}" -TARGETS=( - handshake_respond - handshake_initiator_complete - session_decrypt - replay_sequence - crypto_deserialize - bbs_verify_presentation -) +discover_targets() { + local list + # `cargo fuzz list` reflects the targets registered in `fuzz/Cargo.toml`. + # Keep target discovery dynamic so CI fuzz-smoke automatically covers new code. + list="$(cargo fuzz list)" + if [[ -z "$list" ]]; then + echo "No fuzz targets found via 'cargo fuzz list'." >&2 + exit 1 + fi + while IFS= read -r line; do + [[ -n "$line" ]] && printf '%s\n' "$line" + done <<<"$list" +} run_one() { local name="$1" @@ -47,7 +52,7 @@ if [[ $# -gt 0 ]]; then run_one "$name" done else - for name in "${TARGETS[@]}"; do + while IFS= read -r name; do run_one "$name" - done + done < <(discover_targets) fi