* test(security): add fuzzing, rejection mutants, and obs fault tests Add sigv4_request and notify_xml libFuzzer targets with seed corpora and unit tests, wire fuzz.yml as a workflow_call security-input-gate in CI with trusted changed-path selection, and add fixed rejection-branch mutation verification in isolated workspaces. Verify #[path] coverage attribution with canonical path merging in coverage_per_crate.py, sanitize OTLP startup endpoint logging, and add connect_logs lease/fault regressions, local fake-OTLP 401/500/refused/ timeout/redaction tests, and E2E observability export failure isolation tests. Refs: rustfs/backlog#2677, rustfs/backlog#2679 * fix(ci): stop sending deprecated policy field in s3-tests add-user rustfs/rustfs#9677 hardened /rustfs/admin/v3/add-user to fail closed when a non-empty deprecated policy field is provided. scripts/s3-tests/run.sh was still passing policy=readwrite in the add-user body even though it immediately calls set-user-or-group-policy right after, and awscurl returned exit 0 on XML <Error> responses so provisioning silently failed and broke all alt-user s3-tests. Remove the deprecated policy field from the add-user payload, check awscurl responses for XML <Error> elements in provisioning, and add a regression unit test in scripts/s3-tests/test_runner_tools.py. Refs: rustfs/backlog#1246 * fix(ci): run called validation gates and count wrapped coverage lines * fix(ci): fail S3 user provisioning on HTTP errors without logging responses * fix(iceberg): reject repeated warehouses before validating bucket names * test(ecstore): wait for relaxed writes on the foreground lane * test(quota): isolate concurrent real-disk probes in CI * ci: budget for cold instrumentation builds and validation rebuilds * test(ecstore): scope upload lock identity helper to its Linux test * test(ecstore): isolate namespace lock checks from runner disk latency * test(ecstore): wait for inline source publication before reading a disk * test(connect): isolate the durable receipt integration test
5.1 KiB
RustFS Fuzz Harness
This directory contains the standalone cargo-fuzz harness for RustFS.
It is intentionally isolated from the main workspace so that:
- root
cargo fmt --all - root
cargo nextest - root
make pre-commit
continue to behave exactly as they do today.
Prerequisites
Install cargo-fuzz and a nightly toolchain locally:
cargo install cargo-fuzz
rustup toolchain install nightly
Layout
fuzz/
Cargo.toml
fuzz_targets/
corpus/
artifacts/
Crash reproducers are written under fuzz/artifacts/<target>/.
Targets
bucket_validation- Exercises RustFS bucket-name and bucket/object argument validation.
archive_extract- Exercises archive entry path normalization, prefix application, and bucket-namespace containment checks.
path_containment- Exercises object-path acceptance and containment invariants using public path helpers.
local_metadata- Exercises
rustfs-filemetametadata decoding andrustfs-utilsblock decompression.
- Exercises
policy_ingress- Exercises RustFS-owned bucket policy and policy-doc JSON ingress behavior, including strict-vs-tolerant unknown-field expectations.
sigv4_request- Exercises public SigV4 request canonicalization and signing APIs (
try_sign_v4,try_pre_sign_v4) using boundedArbitraryrequests and raw corpus fixtures with fixed test credentials and timestamp. No-panic client signing is paired with separate server-side presigned header rejection tests and rejection-branch mutation verification.
- Exercises public SigV4 request canonicalization and signing APIs (
notify_xml- Exercises
NotificationConfiguration::from_readerandNotificationConfiguration::validateon raw XML bytes and boundedArbitraryXML variants, asserting deterministic rejection of duplicate queues, invalid filters, and unsupported topic/lambda configurations.
- Exercises
Usage
Run a single target:
cd fuzz
cargo +nightly fuzz run path_containment
Use the unified runner script from the repository root:
# Build + run all smoke targets (60s each)
./scripts/fuzz/run.sh
# Build only (no fuzz run)
BUILD_ONLY=1 ./scripts/fuzz/run.sh
# Build + run a single target
FUZZ_TARGET=path_containment ./scripts/fuzz/run.sh
# Nightly-style: 300s per target
MAX_TOTAL_TIME=300 ./scripts/fuzz/run.sh
# Replay a recorded libFuzzer seed
FUZZ_TARGET=path_containment FUZZ_SEED=123456789 ./scripts/fuzz/run.sh
# Skip build (use pre-built harness)
SKIP_BUILD=1 FUZZ_TARGET=local_metadata ./scripts/fuzz/run.sh
Each run writes fuzz/artifacts/<target>/run-manifest.txt and fuzz/artifacts/<target>/run-summary.json with the target, toolchain, libFuzzer seed, corpus digest, time budget, elapsed runtime (excluding build time), exit code, crash reproducer digest (if any), Git revision and dirty state, and runner mode. CI uploads those artifacts with the corpus and any crash input so the exact run can be replayed.
Critical Rejection-Branch Mutation Verification
Fixed critical rejection-branch mutations are registered in .config/security-rejection-mutants.toml and verified in isolated temporary workspaces via:
python3 scripts/security/check_rejection_mutants.py --self-test
python3 scripts/security/check_rejection_mutants.py --cases .config/security-rejection-mutants.toml
Each mutation runs baseline green first and requires an explicit JUnit assertion failure on the mutated code; compile errors, zero matching tests, timeouts, and harness errors are rejected as invalid verification.
CI Workflow
The GitHub Actions workflow (.github/workflows/fuzz.yml) exposes workflow_call (invoked by ci.yml job security-input-gate) alongside schedule and workflow_dispatch, using a build/run separation pattern:
select-targetsusesscripts/fuzz/select_targets.pyto select checks from changed paths. Documentation-only and unrelated PRs recordN/A. Unknown diffs and merge groups select every target. A PR that changes the selector or target manifest runs the full matrix and rejection checks without executing the changed selector.fuzz-build— compiles the selected fuzz targets once under a cache key isolated by toolchain, target, lockfile, and harness digest, then uploads prebuilt binaries.pr-fuzz-smoke— matrix job running each selected target in parallel (60s execution budget per target) plusrejection-mutantsverifying the fixed rejection-branch mutations.nightly-fuzz-corpus— matrix job running all 7 targets in parallel (300s each) on the daily schedule with failure alerting.security-input-gate-verdict— fail-closed summary gate over all selectedworkflow_callsub-jobs.
Note: PR smoke and fixed rejection-branch mutations do not substitute for full-application sanitizers, long-running stress tests, or RSS/fd exhaustion gates.
Seed Corpus
Initial seed directories live under fuzz/corpus/.
- Keep small, representative, and target-specific inputs here.
- Prefer checked-in fixtures for stable formats like
xl.meta. - Use
cargo fuzz cmin/cargo fuzz tminto shrink corpora and crashes before committing them.
The helper scripts also invoke cargo +nightly fuzz ... explicitly so local execution does not depend on the default toolchain.