Skip to content

Add fanbase fuzz: fuzz a project's own program, and keep what is found private - #11

Merged
joszamama merged 1 commit into
mainfrom
fuzz-command
Nov 18, 2026
Merged

joszamama merged 1 commit into
mainfrom
fuzz-command

Conversation

@joszamama

Copy link
Copy Markdown
Member

What

A new command, fanbase fuzz, for a project that wants its own program fuzzed with Fanbase specs, in its CI or on its developers' machines. The Fandango GitHub Action calls it.

fanbase fuzz json json-boundary --target-dir .fandango/targets --only-own-targets \
    -n 200 --seed 7 --record record --recipients keys.txt --markdown

For each spec, Fandango makes the inputs, and every target (by default, every target in --target-dir that reads the format) is run on every one. Then:

  • a target that crashes, hangs or is killed goes into the private record, as with evaluate --incidents;
  • an input that the targets disagree on (one accepts it, another doesn't), or that every target rejects although the spec says decodes: always, is a finding. Findings are grouped by what each target said (the gist of each rejection, without positions and quoted text), and the smallest input of each group is reduced by delta debugging (lines, then characters) to one that gets the same answers. While reducing, the fastest target is asked first, and the first one that answers differently ends the try;
  • findings go into the same record, under findings/<id>/ (a report with what each target said and how to make the inputs again, the reduced input, the original one), so fanbase incidents open reads it as it is;
  • what is printed, and written with --json-file, is counts: accepted, rejected and error per target, and how many kinds of finding. A target that broke is counted as an error, as with --hide-crashes. With --recipients the record is encrypted, and the lines about each finding are not printed either.

--only-own-targets keeps it to the project's own program: targets come only from --target-dir, never from the registry; each has to run a harness of its own folder ({dir}/...), not a program of the machine; and a target folder that links out of --target-dir is refused. The action always passes it. --fail exits 1 when anything was found.

Also

  • A target killed for what it used is now hidden too. --hide-crashes hid crashes and hangs, but a target killed by SIGKILL or SIGXCPU was counted as resource-limit, with "killed by SIGKILL" as its reason, in public. It is now counted as an error, as the others are. Published counts of such targets move from resource-limit to error; accepted counts don't change.
  • run_target's asking about one file is now targets.ask(), which fuzz uses as well.
  • load_target can look in a project's own folders, before the registry's or instead of it; its message is unchanged when there are none.
  • The private record (incidents.write_private) can carry more than incidents (Extra), under a name of its own.

How it was tried

  • 22 new tests (21 in tests/test_fuzz.py, and one in tests/test_incidents.py that fails without the fix above). The whole suite passes; mypy is clean; ruff --select F,E9 reports only the two unused imports that are on main already.
  • The three parsers of uvl-parser (Python, Java, JavaScript, at its main), 60 inputs each from uvl and uvl-lexical: 7 kinds of disagreement, each reduced to 21–46 bytes (166 for one), which are bugs reported upstream already; the printed output was counts only.
  • The action's example project (a JSON reader with two bugs in it on purpose) with the json spec, through the action's own script with a real age key: the crash went into the record, the rejected valid input was reduced to 1E0, and the log and summary had counts only. A --target-dir outside the repository, and a registry target, were refused.

Checklist

  • tests for what is new
  • nothing found is printed: only counts
  • a release once this is merged: the action asks for fanbase>=0.7

…d private

For each spec, Fandango makes inputs and every target (by default every one
in --target-dir that reads the format) is run on each. A target that
crashes, hangs or is killed goes into the private record, as with evaluate
--incidents. An input the targets disagree on, or that every target rejects
although the spec says decodes: always, is a finding: findings are grouped
by what each target said, and one input of each group is reduced by delta
debugging, asking the fastest target first. They go into the same record,
under findings/, which `fanbase incidents open` reads. What is printed is
counts.

--only-own-targets keeps it to the project's own program: targets only from
--target-dir, each running a harness of its own folder, no folder linking
out of it, never the registry's. The GitHub Action always passes it.

Also: --hide-crashes now hides a target killed by SIGKILL or SIGXCPU too.
It was counted as resource-limit, with "killed by SIGKILL" as its reason, in
public; it is now an error, as a crash or a hang is.
@joszamama
joszamama merged commit d6ce7e7 into main Nov 18, 2026
13 of 14 checks passed
@joszamama
joszamama deleted the fuzz-command branch November 18, 2026 16:34
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