Skip to content

Run a short fuzz of every target in CI on both OSes - #20

Merged
VirtualMachinist merged 5 commits into
mainfrom
v1/ci-fuzz
Nov 14, 2026
Merged

VirtualMachinist merged 5 commits into
mainfrom
v1/ci-fuzz

Conversation

@VirtualMachinist

Copy link
Copy Markdown
Member

V1 checkpoint G4c: CI fuzzing.

  • A blocking CI step runs every fuzz target briefly on both operating systems, and any crasher fails the job.
    • The runner keeps a floor of required targets, so deleting or renaming one fails.
    • Its self-test proves that a missing name and a prefix match both fail.
  • New fuzz targets:
    • CLI arguments: checks what each handler actually receives, that only usage exits occur, and that failures print one fixed-text error line with nothing on stdout;
    • the bounded client's base address and path handling: a refused path never reaches the dialer.
  • Saved corpus entries pin the inputs earlier rounds found.
  • CONTRIBUTING notes the toolchain version, the fuzz gate and the single-HTTP-client rule.

🤖 Generated with Claude Code

scripts/fuzz.sh finds every Fuzz function in the tree and runs each for a
short fixed time (20s by default), one go test invocation per target, as Go
requires. It is a blocking CI step on Linux and macOS: a crasher fails the
job and the failing input is written under testdata/fuzz/ in its package.

The script keeps a floor of expected targets, so a target that is deleted or
renamed is a failure and not a quiet pass; its --selftest proves a missing
name and a prefix match both fail.

Three targets join the existing FuzzConfig. FuzzCLIArgs feeds arbitrary
arguments to the command tree and checks that it exits 0 or 3, prints one
fixed-text error line with empty stdout, never repeats a URL-shaped argument,
and never exits 0 for a URL, selector or expression. FuzzBase checks that an
accepted base address has a scheme and a host and no credentials, query,
fragment or dot segment. FuzzPath checks that an accepted path survives a
parse unchanged and that a refused path never reaches the dialer. Each rule
has seeds, so a rule that lets one reserved character through fails the seed
run and not only a lucky fuzz; mutants of each rule fail.

CONTRIBUTING lists the new gate and names the pinned toolchain correctly.

Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com>
The first 20s run of FuzzCLIArgs found an input that exits 0 with a
selector-shaped argument: a stray quote followed by -h. That is cobra
answering help before it checks the other arguments, which is correct, and
the help text is static. The invariant now allows it only when help was
asked, and then checks that the help text does not repeat any of those
arguments. The input stays as a regression seed under testdata/fuzz.

The path-character check in FuzzPath moves into a named function, which also
clears the De Morgan finding from the linter and keeps the allowed set
written out apart from the code it tests.

Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com>
The fuzz kept finding inputs that were fine: a flag given twice, where the
last value wins, leaves an earlier bad value that never reaches anything;
-hh is help. Chasing raw argument shapes was the wrong property.

FuzzCLIArgs now records what each handler is given and checks that: a
success hands over only a query name of the right shape, a host slug of the
right shape and file names that are not URLs, and a usage error never runs a
handler. The rest is unchanged: exit 0 or 3 only, one fixed-text error line
with empty stdout, and no repeat of a URL- or selector-shaped argument in
stderr or in static help. The inputs found so far stay as seeds.

Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com>
Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com>
The selftest case meant to show a prefix match fails used FuzzConfigX, which
is longer than a real target and not a prefix of it, so a matcher that lost
its anchors still passed. It now plants the three shapes a loose matcher
accepts: FuzzConf, the start of FuzzConfig; zzConfig, its end; and
FuzzConfigX, a longer name. Each must count as missing.

Checked with three mutants of the matcher: no trailing anchor fails the
prefix case, no leading anchor fails the suffix case, and no anchors at all
fails both. The real script still passes.

Signed-off-by: VirtualMachinist <252028890+VirtualMachinist@users.noreply.github.com>
@VirtualMachinist
VirtualMachinist merged commit 8ee367a into main Nov 14, 2026
4 checks passed
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