Author and run cargo-fuzz - Rust fuzzing via libFuzzer with cargo integration. Covers `cargo install cargo-fuzz`, `cargo fuzz init` + `cargo fuzz add {target}` for harness scaffolding, the `fuzz_target!` macro for entry-point declaration, the `Arbitrary` trait for structured input mutation, and `cargo fuzz run` invocation. Requires Rust nightly. Use for fuzz testing Rust libraries - cargo-fuzz wraps libFuzzer with native Rust ergonomics.
75
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Deep reference for cargo-fuzz-rust. The core install / init / add /
run / reproduce workflow lives in the skill spine; this file holds the
advanced sanitiser variants, the ASan report anatomy, and the CI job.
# UBSan via none sanitiser + custom RUSTFLAGS
RUSTFLAGS="-Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Zsanitizer=undefined" \
cargo +nightly fuzz run --sanitizer=none parse_query
# MSan
cargo +nightly fuzz run --sanitizer=memory parse_queryReport format is identical to libFuzzer / ASan (per clang.llvm.org/docs/AddressSanitizer.html):
==1234==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f...
READ of size 4 at 0x7f... thread T0
#0 0x4015a3 in process_input src/parser.rs:42:5
#1 0x4012f0 in rust_fuzzer_test_input parse_query.rs:8:5
0x7f... is located 0 bytes to the right of 16-byte region [0x7f..., 0x7f...)
allocated by thread T0 here:
#0 0x40e7c0 in __interceptor_mallocheap-buffer-overflow, stack-use-after-return,
use-after-free, double-free, memory-leak.jobs:
fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-fuzz
- uses: actions/cache@v4
with:
path: |
fuzz/corpus
~/.cargo/registry
target
key: fuzz-${{ github.sha }}
restore-keys: fuzz-
- name: Smoke fuzz (5 min per target)
run: |
for target in $(cargo fuzz list); do
timeout 300 cargo +nightly fuzz run $target -- -max_total_time=300 || true
done
- uses: actions/upload-artifact@v4
if: always()
with:
name: fuzz-artifacts
path: fuzz/artifacts/