Repository navigation
Feat(fuzz): Add the organisation fuzz publisher - #374
ModeSevenIndustrialSolutions merged 3 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Invalid reusable-workflow references block execution, while cache-loss, reproducer-retention, and replay-error handling can close unresolved fuzzing alerts without a passing replay.
6 open issues
Retain reproducers before publishing new defects · New Do not close defects when replay cannot verify them · New Fix the invalid reusable-workflow prefix · New Preserve unresolved cache loss until reconciliation · New Avoid exposing the harness marker in tracked test files · New Make the scheduled workflow token available to the caller · New
What changed in this PR
Adds an organisation-wide Python fuzz publisher alongside the existing zizmor and aislop publishers, addressing #373. It separates fuzz execution from credential-bearing publication jobs.
Changes:
- Adds daily discovery, per-repository fuzzing and SARIF publication, dry runs, summaries, and failure notifications.
- Implements saved-input replay, bounded state, log classification, and validated SARIF generation.
- Adds pinned Atheris dependencies, automated tests, and setup and harness-contract documentation.
Review state: Needs another round.
| File | Description |
|---|---|
README.md |
Documents the publisher, setup, harness contract, and state limits. |
pyproject.toml |
Configures fuzz-module imports for tests and type checking. |
.ruff.toml |
Allows intentional harness subprocess execution. |
.github/workflows/fuzz-sarif-repository.yaml |
Separates per-repository fuzzing and trusted publication. |
.github/workflows/fuzz-sarif-publish.yaml |
Adds scheduled discovery, matrix calls, summaries, and notifications. |
.github/workflows/agent-scripts.yaml |
Runs fuzz tests with real Atheris in CI. |
.github/scripts/tests/test_fuzz_workflow.py |
Checks workflow structure and trust boundaries. |
.github/scripts/tests/test_fuzz_sarif.py |
Tests SARIF generation and hostile-handover validation. |
.github/scripts/tests/test_fuzz_runner.py |
Tests replay, budgets, failure retention, and state limits. |
.github/scripts/tests/test_fuzz_end_to_end.py |
Exercises discovery of a defect, replay, and subsequent repair. |
.github/scripts/fuzz_state.py |
Implements state pruning, budgets, and size limits. |
.github/scripts/fuzz_sarif.py |
Validates handovers and builds SARIF results. |
.github/scripts/fuzz_runner.py |
Runs harnesses, replays failures, and prepares handovers. |
.github/scripts/fuzz_publish.py |
Provides the fuzz and SARIF command-line entry points. |
.github/scripts/fuzz_common.py |
Shares limits, path validation, and log classification. |
.github/fuzz/requirements.txt |
Pins Atheris with package hashes. |
.github/dependabot.yml |
Adds automated updates for the Atheris pin. |
Review effort: Balanced
8080c2f to
e94d847
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical gaps in state lineage, alert reconciliation, fingerprint continuity, and reproducer validation can close alerts without replaying their inputs, block uploads after successful replays, or publish defects without reproducers.
5 open issues
Defect results can be published without a validated reproducer · New Removing a harness can discard evidence and allow unreplayed alerts to close · New Changed fingerprints can bypass replay protection · New Recovered alerts remain open after a passing replay · New Fix the invalid reusable-workflow prefix
Review effort: Balanced
e94d847 to
caf58bf
Compare
caf58bf to
2455ffa
Compare
2455ffa to
fa7bb1d
Compare
fa7bb1d to
d9f04b4
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Shared-cache evidence can be forged by another repository’s compromised fuzz job, allowing an honest replay to close a victim alert without verifying its actual reproducer because the evidence-to-alert binding is unauthenticated.
1 open issue
Review effort: Balanced
d9f04b4 to
8ffec9c
Compare
49be69e to
ae81e2c
Compare
ae81e2c to
607b12c
Compare
607b12c to
0713325
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The security-sensitive cross-run evidence and publication protocol requires maintainer validation against GitHub’s live APIs for analysis ordering, SARIF-ID matching, replay-to-closure, and recovery from partial publication failures.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🤖 Antagonistic review by agent: 1 finding(s) for the human reviewer.
The restored-artifact download layout does not match its consumers, preventing repeat runs from recovering saved inputs and signed evidence.
Antagonistic round 1 of 3. Revision requested from Code Monkey.
Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.
0713325 to
5a55db3
Compare
Add fuzz_publish.py and its sibling modules. The fuzz side runs a repository's Atheris harnesses under a time budget in a job that holds no secret; the sarif side turns the handover into SARIF in the trusted job: one result per defect at the defect's frame, replay of saved crashing inputs, and alert evidence through the restored flag. Pin Atheris by hash in .github/fuzz/requirements.txt, which Dependabot bumps, and make the scripts importable by the tests and type checkers. Review round 1: - fuzz_runner.py: a new failure with no room to save (the harness holds 20 inputs, or the input is over 1 MiB) is now marked unretained, and the fuzz side refuses the run before it writes the record or the state marker, so no published result can lack the input that replays it. - fuzz_sarif.py: a replay that cannot start the harness or overruns its limit gives no verdict; the builder now refuses it rather than report only a harness error and close the saved input's alert. - fuzz_state.py, fuzz_common.py: the record and the state marker carry a since timestamp, kept across restores and begun afresh when nothing restores, so the workflow can tell alerts older than the saved state from ones the state has replayed. - test_fuzz_end_to_end.py: build the harness's import line from a placeholder so the file holds no literal Atheris import marker. Review round 2: - fuzz_sarif.py: a result could carry no inputSha1 when no input was handed over. The builder now refuses an uncaught, timeout or out-of-memory defect that no handed-over input reproduces; a duplicate process may rely on another's input for the same defect. - fuzz_state.py, fuzz_runner.py: discarding a harness's saved inputs (a harness no longer found, or inputs over the caps) kept the lineage's since. prepare_state now reports it, and the fuzz side begins a new lineage. - fuzz_sarif.py, fuzz_common.py: each result now carries its own lfrelengContentHash/v1 fingerprint, a hash of its rule, file and message, so an edit to the failing line keeps the alert rather than close it and open another. - fuzz_state.py, fuzz_runner.py, fuzz_sarif.py: the state keeps evidence.json, how each saved input last failed. A replay that now passes names that failure, and the summary lists it under fixed so the publish job can let its alert close. - fuzz_record.py: the run record loader moves out of fuzz_sarif.py to keep that file within the aislop size limit. Review round 3: - fuzz_runner.py, fuzz_common.py, fuzz_state.py: a saved input whose replay failed another way overwrote its evidence, so the old alert could close with no passing replay. The evidence now keeps each way an input has failed, up to 4; a failing replay holds the ways it no longer reproduces, and one past the limit is unretained so the fuzz side refuses. A passing replay names every way as fixed. - fuzz_sarif.py, fuzz_record.py: the builder reports each held way as a result with the replay's input, and validates fixed and held. - fuzz_state.py, fuzz_runner.py, fuzz_sarif.py: the since lineage goes; the publish job's strict evidence check replaces it. Review round 4: - fuzz_runner.py, fuzz_state.py, fuzz_common.py: a passing replay deleted its input and evidence before the publish job ran, so a failed or withheld upload left the alert open with nothing to prove it fixed. The input now moves, with its evidence, to the harness's fixed directory and counts against the 20; each run replays it and names its alerts fixed again until the run restores a state whose publication was recorded (--published=true), which drops it. Review round 5: - fuzz_runner.py, fuzz_publish.py: the fuzz side located a failure by whether the file existed in the installed checkout, so a generated or oversized module could become an input's saved evidence while the builder fell back to the harness, and a later passing replay named the wrong alert fixed. The fuzz side now validates locations with the builder's Checkout, against a pristine checkout given as --source-root. - fuzz_sarif.py: a file name holding '%' or a space went into the SARIF URI unescaped, and the fingerprinter decoded it to another path. The builder now URI-encodes the path, and the summary lists each result's rule, decoded path and message under reported. Review round 6: - fuzz_evidence.py (new), fuzz_publish.py: any fuzz job of the run can write another repository's cached state, so a forged evidence.json could pair a harmless input with that repository's alert and a passing replay would close it. The evidence check moves from jq into 'fuzz_publish.py evidence': a fixed claim counts only when its input SHA-1 matches the one a binding ties to that alert. 'bind' signs the binding with HMAC-SHA256 under FUZZ_EVIDENCE_KEY, over the repository, the upload's SARIF ID and each reported result with its input; the check accepts it only for the latest fuzz analysis. - fuzz_sarif.py: reported and fixed entries carry their input's SHA-1; a passing replay naming fixed failures without a handed-over input is refused. - fuzz_runner.py: a passing replay with prior evidence hands its input over, and --binding copies the restored binding into the handover unread. Review round 7: - fuzz_sarif.py, fuzz_evidence.py, fuzz_publish.py: a held way comes from the restored state, so a poisoned cache could mark alert A as held by an input that fails only as B; the builder gave A that input's SHA-1 and 'bind' signed it, letting a later fix for B close A. The summary now keeps observed input associations under reported and held ones under a new held list, and a result prefers an observed input. 'bind' takes --handover and --previous-sarif-id and signs a held association only when the previous binding, verified for that analysis, already holds it. Review round 8: - fuzz_state.py, fuzz_sarif.py, fuzz_evidence.py: a binding tied each alert to its input's SHA-1, which is open to chosen-prefix collisions, so a pair of inputs could share a signed identity. The builder now adds inputSha256 next to inputSha1 and the reported, held and fixed entries carry SHA-256; the binding tag moves to lfrelengFuzzBinding/v2 and accepts only 64-hex digests, so earlier SHA-1 bindings no longer verify. Review round 9: - fuzz_runner.py: hand_over named each handover input by its SHA-1, so with a collision pair in a poisoned cache a passing replay could overwrite a failing replay's input, and the builder would hash the passing bytes as that failure's reproducer. Each input now takes its process's log name, which is unique per process. Review round 10: - fuzz_runner.py: a new failure was saved as failures/<SHA-1>, so an input colliding with a saved one replaced that input's bytes and evidence, and later runs lost its reproducer. A name already held by a saved input or its evidence is no longer written; the failure counts as unretained and the fuzz side hands nothing over, as at the cap. Review round 12: - fuzz_runner.py: the finding that a harness could swap its replay input and exit 0 is disputed, not changed. The harness is the repository's own code and decides its verdict: it can exit 0 without touching the input, so isolating the input adds nothing. The bytes are read before the run, so a swap cannot change what is handed over. Co-authored-by: Copilot <[email protected]> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
fuzz-sarif-publish.yaml discovers repositories, finds tracked Atheris harnesses with the token in its select job, and calls fuzz-sarif-repository.yaml per repository. That workflow fuzzes in a job with contents: read and no secret, then publishes SARIF under the tool name fuzz from a separate job in the production environment. Run the fuzz tests, including the Atheris end-to-end test, in the agent scripts workflow. Review round 1: - fuzz-sarif-repository.yaml: a restored state that lost its inputs to cache eviction or a corpus reset could close alerts it never replayed. The evidence step now always runs, lists open fuzz alerts, and skips the upload when any alert predates the state's since and the new SARIF does not report it. - The $/ self-repository prefix stays: the repository adopted it for zizmor's self-repository audit and its actionlint accepts it. Review round 2: - fuzz-sarif-repository.yaml: the evidence check now also counts as proven each alert identity the summary lists as fixed, so a recovered alert can close; check out fuzz_record.py in both jobs. - The $/ self-repository prefix stays, for the reason above. Review round 3: - fuzz-sarif-repository.yaml: a failed cache save only warned, so a later run could restore older state and close alerts it never replayed. The fuzz job now looks the saved key up and fails on a miss, and the evidence check blocks the upload while any open alert is neither reported nor listed as fixed; a harness-error alert is exempt only when state was restored. The since lineage goes. Review round 4: - fuzz-sarif-publish.yaml: the workflow_dispatch token input stayed in the event payload every job of the run can read, the fuzz jobs included. The input goes; the jobs read FUZZ_SARIF_PAT alone. - fuzz-sarif-repository.yaml: once code scanning processes an upload, the publish job saves a fuzz-published/ record under the state key its fuzz job reported; the next fuzz job looks it up for the state it restores and passes --published, so passing inputs wait for it. Review round 5: - fuzz-sarif-repository.yaml: the fuzz job checks the commit out a second time, data only, and passes it as --source-root, so saved evidence locates failures as the publish job does. - fuzz-sarif-repository.yaml: the evidence check compared the SARIF URI, now URI-encoded, with the decoded paths of the alerts API. It now compares the summary's decoded reported identities instead. Review round 6: - fuzz-sarif-repository.yaml, fuzz-sarif-publish.yaml: a compromised fuzz job could forge another repository's state to close its alerts. The publish job, given the new evidence_key secret (FUZZ_EVIDENCE_KEY), reads the latest fuzz analysis's SARIF ID and runs the evidence check against the handed-over binding; after a processed upload it signs a new binding and saves it under a key holding that SARIF ID, then looks it up to confirm the save. The fuzz job restores the newest binding and hands it over; the publish job still restores no cache. - test_fuzz_workflow.py: pins that wiring; the jq helper tests move to test_fuzz_evidence.py. Review round 7: - fuzz-sarif-repository.yaml: the evidence step validates the latest analysis's SARIF ID and outputs it; the bind step passes it and the handover to 'bind', which carries a held failure into the new binding only when the previous binding holds it. Review round 8: - fuzz-sarif-repository.yaml: actions/cache extracts an archive with the paths it names, so a forged cache entry could overwrite the runner or the harness in the fuzz job and fake a passing replay. A new restore job, running no commands and holding no secrets, restores the state and the binding and uploads them as an artifact; the fuzz job downloads that artifact by ID, takes the state only as a real directory, and elsewhere uses cache lookups alone. - test_fuzz_workflow.py: pins that no other job extracts a cache. Review round 11 (antagonistic review): - fuzz-sarif-repository.yaml: the restored-state download now sets merge-multiple, as the handover download does. Download-artifact v8.0.2 already extracts a lone artifact matched by ID straight into its path, so the layout held; the flag keeps it from depending on that count rule. - test_fuzz_workflow.py: pins the restored artifact's layout: the two upload paths, the download path and flag, and the paths the fuzz job reads. Review round 12: - fuzz-sarif-repository.yaml: an upload the evidence check withheld left the publish job green, so a lost state could withhold every later upload with no Slack alert. A last step now fails the job when the upload is withheld, after the summary is written; a dry run still only warns. test_fuzz_workflow.py pins it. Co-authored-by: Copilot <[email protected]> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Describe the jobs, the replay and rule scheme, the token and variables, the saved-state limits, and harness contract version 1. Review round 1: - Describe the refusal of a replay with no verdict and of a new failure the state cannot save. - State that FUZZ_SARIF_PAT is a repository secret, not a production environment secret, as the select job reads it. - Describe the since check that keeps lost state from closing alerts. Review round 2: - Describe the reproducer requirement, the builder's fingerprint, the lineage reset when saved inputs are discarded, and the evidence that lets a fixed alert close. Review round 3: - Describe held failure ways, the save check and the strict evidence check; drop the since lineage. Review round 4: - Describe the missing token override and why, and how a passing input waits for a recorded publication. Review round 5: - Describe the fuzz job validating saved locations against a pristine checkout. Review round 6: - Document FUZZ_EVIDENCE_KEY and the signed binding that ties each alert to the input that reproduced it. Review round 7: - Describe how the binding treats a failure only the state records. Review round 8: - Describe the restore job and the SHA-256 input identities. Review round 10: - List a SHA-1 already naming a saved input among the reasons a new failure cannot be saved. Review round 12: - Describe the publish job failing, after its summary, when the evidence check withholds the upload. Co-authored-by: Copilot <[email protected]> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
5a55db3 to
a155b76
Compare
805caa2
into
lfreleng-actions:main


Closes #373
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI9628371b091b80191d31b03101b60d6f92106eabuv sync --lockeduv run pytest -quv run pytest -q .github/scripts/tests/test_fuzz_workflow.py -k withheld (against the previous workflow; expected failure)uv run basedpyright --venvpath .prek run --files .github/workflows/fuzz-sarif-repository.yaml .github/scripts/tests/test_fuzz_workflow.py README.mduvx zizmor --persona auditor --offline .github/workflows/fuzz-sarif-repository.yaml .github/workflows/fuzz-sarif-publish.yamlscripts/agents/aislop-gate.sh 9628371b091b80191d31b03101b60d6f92106eabuvx gitlint --commits 9628371b091b80191d31b03101b60d6f92106eab..HEADgit log --raw --format=%h 9628371b091b80191d31b03101b60d6f92106eab..HEADThe
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.
Round 12 of revision, on its base.
Adds
fuzz-sarif-publish.yaml, the organisation's third SARIF publisher, as the issue specifies (#373, part of #372). Once a day it finds every in-scope repository with an Atheris harness and callsfuzz-sarif-repository.yamlfor each one. That workflow has four jobs:contents: readand no secrets. It replays saved failing inputs, fuzzes, and hands over logs and inputs.FUZZ_EVIDENCE_KEY.Commits:
Feat(fuzz): the fuzz runner, the SARIF builder, the state and evidence helpers, the Atheris pin and the unit and end-to-end tests.CI(fuzz): the two workflows, the workflow boundary tests, and the test wiring inagent-scripts.yaml.Docs(fuzz): the README section, including harness contract version 1 word for word.This round (12)
fuzz-sarif-repository.yaml). When the evidence check withholds an upload, a new last step of the publish job now fails it. The summary is written first. This makes the scheduled run's Slack alert report a lost state, which matches issue rule 4: absence never reads as clean. A dry run still only warns.test_fuzz_workflow.pypins the step, and its new test fails on the previous head. The README now says the job fails.fuzz_runner.py:235). The harness is the repository's own code and decides its own verdict. It can exit 0 without touching its input, so making the input immutable adds no protection. The runner reads the input bytes before the run, so swapping the file cannot change what gets handed over. The binding is there to stop one repository's fuzz job forging another's evidence, and that still holds. Real filesystem isolation would also need containers, which this runner does not have.Checks run
uv run pytest -q(263 passed, 1 skipped: the Atheris end-to-end test, which needsFUZZ_E2E_PYTHON; earlier rounds ran it under Atheris 3.1.0 and it passed),uv run basedpyright --venvpath .,prek run --fileson the changed files,zizmor --persona auditor(no findings), the aislop gate (clean) and gitlint on every commit. All passed.For the reviewer
FUZZ_SARIF_PATandFUZZ_EVIDENCE_KEYsecrets.sarif_idmatch. If either is wrong, the publisher fails closed. It now does so as a failing job.