Skip to content

Feat: Roll out central fuzzing #372

Open

Description

This was generated by AI during triage.

Summary

Fuzz every repository that holds enough code to fuzz, from one daily job in this repository, and publish what it finds to each repository's code scanning. This issue records the decisions and tracks the work. It carries no-agent: the linked issues are the ones to work.

Decisions (agreed 2026-11-19)

  • Central daily job, harnesses in the repositories. The job lives here beside the zizmor and aislop publishers. Each repository carries only its harness files, their seeds and a replay test.
  • Its own upload token, FUZZ_SARIF_PAT, as the other two publishers have.
  • A new failure also opens an issue in the repository, which the code monkey can work. The alert records the failure; the issue gets it fixed.
  • grype-scan-action keeps its own fuzz job until a pull-request gate exists, since it is the only fuzzing that runs on pull requests.
  • Not ClusterFuzzLite. It has one mutable v1 tag and no releases, five commits since November 2023, and its actions pull gcr.io images that the egress allow-list does not carry.

Why this shape

OpenSSF Scorecard's Fuzzing check reads source files and never workflows. Scorecard v5.6.0, run locally against four synthetic repositories:

Repository contains Fuzzing
Code plus a stub workflow that calls a central fuzz job 0
A harness file with import atheris, and no workflow 10
Only .clusterfuzzlite/Dockerfile 10
Neither 0

So only the harness has to live in a repository, and a stub workflow there earns nothing. The central job finds harnesses by Scorecard's own pattern, so what Scorecard credits and what actually runs cannot drift apart.

Of 150 public repositories, 69 hold no language Scorecard has a fuzzer pattern for, and about 40 hold 500 or more lines of non-test source. Each of those gains about 0.5 to 0.6 on its aggregate score. Two already score 10: grype-scan-action, and supported-versions-action, for three Go fuzz functions that I found nothing in the organisation running with -fuzz.

Harness contract, version 1 (Python)

  1. Discovery. A harness is a tracked .py file with a line containing import atheris. OpenSSF Scorecard and the central job both find harnesses by that text, so it appears in harness files and in no other .py file, comments and strings included.

  2. Invocation. The central job runs a harness from the repository root, on Linux x86_64 with CPython 3.13:

    • python <harness> [libFuzzer options] [directory ...] fuzzes. libFuzzer writes the inputs it keeps to the first directory.
    • python <harness> [libFuzzer options] <file> [<file> ...] runs each named input once and exits.

    The harness puts whatever it imports on sys.path itself.

  3. Seeds. Unless an argument names an existing file, the harness appends a directory holding its seed inputs after any directories it was given. Run with no arguments, it fuzzes from its seeds.

  4. Verdict. An input that breaks the contract under test raises out of the fuzzed function, and the process exits non-zero. A run in which every input held exits 0. The verdict depends on the input alone: no clock, randomness, network, credential or environment variable, and no file outside a temporary directory.

  5. Limits. Each input finishes within 10 seconds and 2 GiB of memory. libFuzzer sizes the inputs it generates from the largest seed, so a target that needs long inputs carries a seed that long.

  6. Imports. The standard library, the repository's own code, the packages uv sync --frozen installs from the repository's uv.lock, and atheris. A repository without uv.lock gets the first two and atheris.

  7. Without Atheris. import atheris sits inside the function that starts fuzzing, so the module imports on any platform. The check being fuzzed is a plain function, and the repository's unit suite runs every seed through it.

  8. Nothing else. The repository carries no fuzz workflow, no Atheris pin and no Dependabot entry for one. The central job brings its own pinned Atheris.

Go repositories use the language's own form, func FuzzXxx(f *testing.F) in a _test.go file. The central job does not run those yet; see the follow-ups.

What the local tests showed

  • The existing pipeline carries fuzz results unchanged. Real failures from grype-scan-action as it stood before its PR 70, converted to SARIF by a throwaway script, passed the SARIF 2.1.0 schema, sarif_fingerprint.py and both upload guards in the publishers.
  • Fingerprints are stable. Two different inputs that hit one defect got one fingerprint, provided the result's message carries nothing derived from the input.
  • findings-ratchet works on it. It failed a simulated pull request that adds the failures and passed the one that removes them.
  • Known failures must be replayed. On the unfixed code, 60 seconds of fuzzing without the saved inputs ran 1,147,617 and 731,245 inputs and found neither known defect. An upload from such a run would close both alerts with the defects still there.
  • The contract works as written. On a toy repository under Atheris 3.1.0: a saved corpus directory given first accumulates inputs across runs while the seeds still load; a named input file runs alone, exiting 0 when it passes, 77 on an uncaught exception and 70 on a timeout; a harness that cannot start exits 1 with an ordinary traceback.
  • A generic install is enough. Every Python repository of 500 or more lines admits Python 3.13, and 34 of 38 need only uv sync --frozen or nothing. Against github2gerrit-action, a lock-file install plus Atheris instrumented 518 modules and ran 605,944 inputs in a minute with no repository-specific setup.

Work

Dispatched to the code monkey

Not for the bot

Found on 2026-11-19, since raised and fixed

For every future issue in this rollout

The code monkey's author session has no GitHub credential, and its prompt forbids fetching URLs, so it cannot open an earlier pull request to read the review. Whatever it is to learn from earlier rounds has to be in the text of its own issue. Every new harness issue therefore carries both of these in its body:

  1. The list under "What review caught", brought up to date first by reading the review threads of any pull request merged since.
  2. The reference pull requests, for a maintainer, or an agent that can read GitHub, to see the findings and the final state.

Reference pull requests

Pull request Copilot reviews What the rounds were about
lfreleng-actions/grype-scan-action#70 5 The first harnesses: oracles that trusted the classifier they checked; output captured in a buffer that hid an encoding error
lfreleng-actions/grype-scan-action#77 2 Contract alignment; a README example that did not run from a fresh checkout
lfreleng-actions/gha-workflow-linter#485 2 An exception treated as success instead of fuzzing the caller that contains it; an off-by-one in an oracle
lfreleng-actions/source-clone-action#412 4 A replay test that failed on Windows paths; seeds that never exercised percent-decoding; a RecursionError the harness could reach and had not reported
lfreleng-actions/github2gerrit-action#561 4 Harness files without the literal import atheris; an oracle that used the matcher under test as its answer
lfreleng-actions/dependamerge#640 5 Substring and no-op oracles; oracle functions with no negative control; seeds too short for a length limit; two fixes that introduced a new defect
lfreleng-actions/github-issues-triage-bot#54 8 Size caps the expected verdict ignored; boundaries the input layout could not reach; expected values taken from the extractor under test
lfreleng-actions/github-code-monkey-bot#206 9 Review-classifier oracles that accepted fabricated verdicts
lfreleng-actions/github-code-review-bot#112 7 Markdown and link containment oracles. Six findings arrived after the merge; fixed in lfreleng-actions/github-code-review-bot#125
#374 11 The publisher: what a lost or tampered saved state could close
lfreleng-actions/github-security-report-action#303 5 Incomplete reads classified as clean or not applicable

What review caught

Most findings, across every harness pull request, were about an oracle that would pass a wrong answer.

Oracles that pass wrong answers

  1. Never take the expected answer from the code under test, or from a helper it shares. Build the input so the answer is known by construction (plant the values, then require exactly those back), or derive it again from the raw bytes with independent code.
  2. Compare whole values, in order, with multiplicity. Substrings, prefixes, sets and key lists let a dropped, duplicated or reordered item pass.
  3. Do not normalise away the difference under test. Stripping whitespace, case-folding and Unicode lowercasing all let a changed result compare equal, and so does Python's True == 1. Match the production matcher's own semantics: re.IGNORECASE is not casefold().
  4. An early return or a size bound in the oracle must not skip the check for an input that fits. Prefer a check that holds for every input to a bound that exempts some.
  5. Check the refusals too. An input the code must refuse has to be refused, not merely survive; a flag of "yes" is not True.
  6. Hand the code under test its own copy of any mutable input, and make sure the copy cannot fail on an input the parser accepts.

Oracles that fail correct code

  1. Decode the input the way production does before comparing: JSON escapes, percent-encoding, escaped Markdown. Compare decoded values, not their spelling.
  2. The replay test runs wherever the repository's tests run: no POSIX-only path assumptions.
  3. Model the documented limits, such as size caps and truncation, in the expected verdict.

Proving the oracle works

  1. Every oracle function has a negative control: a deliberately wrong result it must reject. Reviewers checked this function by function.

Reaching the code

  1. Make each documented boundary reachable: a seed as long as the largest limit under test, an input layout that does not cap a field at 255 bytes, and inputs at the integer and nesting limits.
  2. Feed lone surrogates and other text that cannot be encoded, and capture output on a strict UTF-8 stream. Three repositories had an encoding crash found this way.
  3. Keep oracles linear in the input. A quadratic scan in the harness trips the ten-second limit by itself.
  4. Where a caller contains an exception by design, fuzz the caller; do not treat the exception as success.

Contract and housekeeping

  1. The literal text import atheris is in each harness file. An import through a shared runner is not found. A test that checks the rule looks at tracked files alone.
  2. A documentation example runs from a fresh checkout.

Fixes made along the way

  1. A production fix prompted by a harness needs the same adversarial attention as the harness. In two pull requests such a fix introduced a new defect that review then caught. Keep the fix minimal, and test it against the inputs nearest the one that failed.

For workflow and publisher work

  1. Say in the issue where the threat model stops: what a compromised job may achieve at worst, and what is not defended. Seventeen of the publisher's 23 findings were about a lost or tampered saved state, or an alert closing without a passing replay, which its issue left open-ended.
  2. Name each secret, where it is stored and which job reads it. A reusable workflow cannot read an environment secret passed at the caller level, and a dispatch input is visible to every job of the run.
  3. A test or helper in the repository must not match the harness discovery rule by accident.

To raise once the publisher has merged

The publisher merged on 2026-11-20 and has run on schedule since. As of 2026-11-26 none of the items below has an issue.

  • Open an issue for each new failure. One per distinct failure, deduplicated by fingerprint, capped per repository per run. The body is a fixed template filled only with validated fields (harness path, exception type, function, file and line, fingerprint, and the failing input as base64): no free text from the fuzz run, since the code monkey reads these issues. Issues opened with the publisher's token count as their owner's, so the scheduled scan works them unless they carry no-agent. The token then also needs Issues: write.
  • Go engine. Run FuzzXxx functions with go test -fuzz, for build-metadata-action, supported-versions-action and version-extract-action.
  • Pull-request gate. A ruleset-required workflow that fuzzes briefly and uses findings-ratchet, so a pull request fails only for failures it introduces.
  • Remove grype-scan-action's own fuzz job, its Atheris lock file and its Dependabot entry, once the gate exists.
  • Next harnesses, in this order: build-metadata-action (Go), tag-validate-action, project-reporting-tool (its uv.lock landed in Build: Commit uv.lock and let Dependabot keep it project-reporting-tool#413), sigul-sign-action, markdown-table-fixer, pull-request-fixer, semantic-tag-increment, repository-metadata-action, log-publish-action, list-splitter-action, harden-runner-block-action; then lftools-uv and github-security-report-action; last gerrit-docker-k8s and sigul-docker-k8s.
  • python-nss-ng. 32,000 lines of C behind a Python API. It needs a sanitizer build of the extension against NSS, which the generic job cannot do, so it gets its own design.

Maintainer actions

Checked 2026-11-26: both secrets exist on this repository, and the schedule has run green daily since 2026-11-22. A manual dispatch on 2026-11-20 failed and led to #377; one on 2026-11-23 succeeded. Whether that one was the dry_run on grype-scan-action, and whether its SARIF was read, is not visible from the run list, so the third box stays open for a maintainer to tick.

  • Create FUZZ_SARIF_PAT as a repository secret here, not a production environment secret: the publisher passes it to a reusable workflow, which cannot read an environment secret. A fine-grained token for the organisation needs Code scanning alerts: read and write, Contents: read and Metadata: read.
  • Create FUZZ_EVIDENCE_KEY as a repository secret too: at least 32 random characters, for example from openssl rand -hex 32. The publisher as built in Feat(fuzz): Add the organisation fuzz publisher #374 signs with it which input reproduced each published result.
  • After the publisher merges, dispatch it once with dry_run on grype-scan-action, read the SARIF it attaches, then let the schedule run.

Activity

  1. added
    no-agent
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureno-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions