Skip to content

Fuzz tool: opt-in Go native fuzzing in review_checks.sh - #2422

Merged
remigiusz-antczak merged 1 commit into
mainfrom
fuzz-go-native-1118
Nov 18, 2026
Merged

remigiusz-antczak merged 1 commit into
mainfrom
fuzz-go-native-1118

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Adds opt-in Go native fuzzing to review_checks.sh, enabled with --fuzz or REVIEW_FUZZ=1. Default --full runs do not fuzz.

What it does

  • Finds func Fuzz* targets in Go packages and runs go test -run '^$' -fuzz '^Name$' -fuzztime <cap> once per target. The time cap and the target count are bounded by REVIEW_FUZZ_TIME and REVIEW_FUZZ_MAX.
  • Reports a crash as one fuzz row with the crasher path. If go prints no "Failing input" line, it reports a named skip and the hub continues.
  • Hardening:
    • A crasher path must match ^testdata/fuzz/<Name>/<hex>$ before it is read or removed.
    • A tracked corpus file is never removed.
    • stdin is /dev/null.
    • -mod=readonly is passed as a go argument, so the user's GOFLAGS cannot override it.
  • Skips with a reason when go is missing or older than 1.18.

Tests

scripts/test-review-checks-fuzz.sh: 19/19 under /bin/bash 3.2. Cases:

  • the default run, which does not fuzz
  • the time and count caps
  • old or missing go
  • crash cleanup with a stub go
  • a traversal crasher path, where nothing is deleted
  • a tracked crasher file, which is kept
  • no "Failing input" line
  • GOFLAGS passthrough
  • a real-go case, which skips when go is missing

The size gate passes. tool-hub.md rises from 63131 to 63930 bytes; the marker is in the changelog fragment.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc

…IEW_FUZZ=1)

The hub had no fuzzing. review_checks.sh now runs each Go native fuzz target (func FuzzXxx(*testing.F)) only on explicit opt-in (--fuzz or REVIEW_FUZZ=1). It is never implied by --full or --full-history, because it executes repo test code (the org driver runs --full-history on third-party clones and never runs repo code).

Each target runs for min(10, remaining-5)s, at most REVIEW_FUZZ_MAX (default 5) targets and --timeout seconds in total, inside its own process group so no fuzz.test worker is orphaned. One go-fuzz-crash row per crasher names its testdata/fuzz corpus path; the crasher file is deleted after the row (its input is quoted in the message), so the audited tree is left as found. A missing go, go older than 1.20, an over-cap target and a spent time budget are named "not run" lines via skip(); GOFLAGS is prepended to, not replaced. atheris, cargo-fuzz and jazzer targets are fuzz-target-inventory rows under --full (detected, not run).

Documented in the script header and usage and in references/tool-hub.md (size-budget-raise marker in the changelog fragment). scripts/test-review-checks-fuzz.sh covers default --full not fuzzing, --full-history not fuzzing, REVIEW_FUZZ_MAX, the time cap, old and missing go, and crash cleanup with a stub go (always runs), plus a real-go case on scripts/fixtures/tool-probes/go-fuzz that skips without go.

Tests: 19/19

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4dfwdDQiF3RQMUqYBqefc
@remigiusz-antczak
remigiusz-antczak merged commit 1e11f18 into main Nov 18, 2026
13 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the fuzz-go-native-1118 branch November 18, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant