Repository navigation
Description
This was generated by AI during triage.
Summary
Add fuzz harnesses, written for Atheris, for the code in this repository that reads input it does not control. The publish job decides what an untrusted author session may publish. Its checks on that session's manifest and commits are the trust boundary docs/DESIGN.md describes, and it also classifies the review text Copilot writes.
Why
- These functions stand between an agent session that an issue may have steered and a signed commit on a pull request.
- The first harnesses in
grype-scan-actionled to two fixes in the code they exercised (Test: Fuzz the SBOM and bypass parsers in CI grype-scan-action#70). - OpenSSF Scorecard scores
Fuzzing0 here, and a harness is worth about 0.5 on the aggregate. Scorecard finds Python fuzzing by the textimport atherisin a.pyfile. That is its detection rule, not the goal: a harness that cannot fail does not satisfy this issue.
How the harnesses will run
A daily job in lfreleng-actions/.github will run every harness in the organisation and publish failures to each repository's code scanning (lfreleng-actions/.github#373, tracked in lfreleng-actions/.github#372). Until it is live, the seeds replay in this repository's own test suite. So this change adds no workflow: it is being worked with workflow edits off, and nothing under .github/workflows/ may change.
Harness contract, version 1 (Python)
-
Discovery. A harness is a tracked
.pyfile with a line containingimport atheris. OpenSSF Scorecard and the central job both find harnesses by that text, so it appears in harness files and in no other.pyfile, comments and strings included. -
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.pathitself. -
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.
-
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.
-
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.
-
Imports. The standard library, the repository's own code, the packages
uv sync --frozeninstalls from the repository'suv.lock, andatheris. A repository withoutuv.lockgets the first two andatheris. -
Without Atheris.
import atherissits 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. -
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.
Targets
Write one to three harnesses, one per area below, in the order given. The names come from the modules' own docstrings and signatures; read the code before settling the contract each harness checks, and say in the pull request which candidates you left out and why.
-
Proposal rules.
proposal_policy:safe_path,protected,check_change_mode,split_message,check_headline,check_body,comment_safe,defuse_mentions,log_safe,bounded_reasons; andproposal_check.read_manifest.Properties to consider, each to be confirmed against
docs/DESIGN.md: a refusal is aRejectionor aPublishErrorand never another exception; no spelling of a protected path gets pastprotected; a pathsafe_pathaccepts stays inside the checkout; text that has been throughcomment_safeordefuse_mentionsholds no live@mention;log_safeoutput cannot start a workflow command. -
Review classification.
review_verdict.classify,review_text(read_line,mask_spans) andreview_sections(suppressed_count,previously_missed_count,unknown_sections). A review body is external text. Property to consider:classifyreturns a verdict for any body and never raises.review_text,review_sectionsandreview_verdictalso exist ingithub-code-review-bot. If they are copies, say so in the pull request; plan no change to the other repository. -
Operator and issue input.
explicit_issues.parse_issuesandissue_authors.parse_listed.
Rules for the oracles
- Check what the code documents, in its own words: quote the docstring, README or design text in the harness.
- No broad
exceptaround the code under test. An exception the code documents is part of the contract and may be expected by name. - Drive each target at the level where its contract holds. Where a caller catches an exception by design, fuzz the caller.
- The oracle must not share the code it checks. Derive the expected answer from the raw input independently, or check a property such as a round trip, idempotence or containment. In
grype-scan-action, review found oracles that trusted the answer they were checking, and so passed wrong ones. - Capture output as production emits it. There, a buffer that accepts any text hid an encoding error that a strict UTF-8 stream raises.
- Show each oracle can fail. The replay test swaps in a deliberately wrong result and checks the oracle rejects it.
- When a harness shows the code breaking its documented contract, fix it in this pull request, in its own commit, with a regression test and the failing input added to the seeds. If the fixes would not fit, leave that target out and give the reproducing input in the pull request body.
Constraints
- No dependency changes. Atheris is not a dependency of this repository: no pin, no lock entry, no Dependabot entry. Install it for your own runs only;
pip install atherisworks on Linux x86_64 with CPython 3.12 to 3.14. - Hooks as configured. The new files pass the repository's hooks unchanged, in an environment where Atheris is not installed. mypy and basedpyright run in strict mode, and the aislop gate holds at 100.
- The normal suite runs the replay test.
python -B -m unittest discover -s testscollectstest*.py, in CI and in a hook. - REUSE. Every new file carries an SPDX header or a
.licensesidecar. Seeds can live as literals in a Python module. - Fuzz before you finish. Run each harness under Atheris for at least a minute and report what it did.
- Bot-specific modules alone. The five modules shared with
lfreleng-actions/bots-template(bot_github.py,bot_evidence.py,artifact_fetch.py,preflight.py,ledger.py) are covered by Test: Fuzz the shared bot modules bots-template#63. This repository'sAGENTS.mdforbids patching a copy alone. - Leave the workflow contract tests alone. They pin the trust boundary.
Acceptance criteria
- One to three harness files, each meeting the contract above.
python <harness> -runs=0exits 0, and so doespython <harness> <file>for a seed written to a file. - The text
import atherisappears in the harness files and in no other.pyfile. - Each harness names the contract it checks, and none has a broad
exceptaround the code under test. - A test in the normal suite replays every seed through each check without Atheris installed, and shows each oracle rejecting a deliberately wrong result.
- The repository's tests and hooks pass. Nothing under
.github/workflows/changes, and no dependency, lock file, coverage threshold or hook configuration changes. - The README, or the developer documentation the repository keeps, says in a few lines what is fuzzed and how to run a harness by hand.
- The pull request body gives, for each harness, how long it fuzzed, how many inputs it ran and what it found. Each defect found is fixed with a regression test, or listed with its reproducing input.
Out of scope
- A fuzz workflow or CI job, an Atheris pin and a Dependabot entry: the central job supplies all three.
- Property-based testing libraries.
- Behaviour changes beyond fixing a breach of a documented contract.
- The five shared modules.
Activity
lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 An AI agent has proposed a change for this issue: pull request #206 (head 6777a96). The Copilot review of it has findings (1 unresolved review thread; assessment: changes recommended). 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. Checks failed on its head: Audit changes.
lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 1: an AI agent revised pull request #206 (head 0fb2a27). Round 1 on #206. - Fixed Copilot's thread:
review_verdict.boundedraisedUnicodeEncodeErroron a lone surrogate. New commitFix: Classify review bodies with lone surrogatescounts the body withsurrogatepass, adds a regression test and the reproducer seed. - Fixed the failingAudit changescheck (aislop file-too-large onscripts/proposal_policy.py): amended the log_safe fix commit to change lines in place, file stays at 440 lines; aislop scan of the change is clean. - No rebase: the branch stays onaf18f71, which is the default branch head and the PR is mergeable. - Ran the full unit suite and prek on changed files (both pass) and fuzzed all three harnesses 60–90 s each with no findings. - Nothing disputed; nothing remains open from this round. It set out to fix the failing checks: Audit changes. The Copilot review of it has findings (2 unresolved review threads; assessment: changes recommended). 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.lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 2: an AI agent revised pull request #206 (head 19ada16). Round 2 on #206. - Fixed both Copilot threads, amending
Test: Add fuzz harnesses for untrusted input: -oracle_manifestcompared only keys; it now compares the full returned object with the file's JSON. - Added negative controls fororacle_message,oracle_manifest(corruptedrepository/issue/schema) andoracle_twin; the new manifest cases fail against the old oracle. - No rebase: the branch stays onaf18f71, the default branch head; the PR is mergeable and nobody asked for one. - No failing checks on the head. Ran the full unit suite, prek on the changed files and gitlint (all pass), and fuzzed each harness 66–76 s with no findings. - Nothing disputed; nothing open from this round.. The Copilot review of it has findings (1 unresolved review thread; assessment: changes recommended). 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.lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 3: an AI agent revised pull request #206 (head bf09638). Round 3 on #206. - Fixed Copilot's thread on
fuzz/fuzz_review_classifier.py:oracle_verdictnow accepts a clean verdict only when an h3 states one of the three assessment phrasesreview_verdictdocuments and the recorded label matches it. It checks this independently of the module's regexes. Four new negative controls, the fabricated### 🟢 This is not a recognized assessmentamong them, fail against the old oracle. Amended intoTest: Add fuzz harnesses for untrusted input. - No rebase: the branch stays onaf18f71, the default branch head. The PR is mergeable and nobody asked for one. - No failing checks on the head. The full unit suite, prek on the changed files and gitlint all pass. The classifier harness ran 71 s (19,237 inputs) under Atheris and found nothing. - Note: the Atheris scratch venv and corpus are in the artefacts directory. Writes to/tmpwere refused, apart from one scratch file and a venv I created there before the refusal. - Nothing disputed; nothing open from this round.. The Copilot review of it is clean. An antagonistic review was requested from the review bot.lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 4: an AI agent revised pull request #206 (head bea5eae). Round 4 on #206, answering the antagonistic review. - Fixed the thread on
fuzz/fuzz_review_classifier.py:oracle_maskpassed a mask that changed nothing and one that blanked prose between spans. It now pairs backtick runs itself ("two runs of equal length bound a span") and requires the exact masked line, keeping path-and-line entry spans, plus the rightleft_open. Five new negative controls fail against the old oracle. Amended intoTest: Add fuzz harnesses for untrusted input. - No rebase: the branch stays onaf18f71, the default branch head; the PR is mergeable and nobody asked for one. - No failing checks. Unit suite, prek on changed files and gitlint pass; 300,000 random lines agree withmask_spans. Atheris was not run this round (no venv available). ## Antagonistic review The body holds no finding beyond its one inline thread (theoracle_maskweakness), fixed below. Its summary judged the surrogate fixes sound; nothing to change there. It answers antagonistic review round 1 (#206 (review)). The Copilot review of it has findings (1 unresolved review thread; assessment: changes recommended). 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.lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 5: an AI agent revised pull request #206 (head d81161f). Round 5 on #206. - Fixed Copilot's thread on
fuzz/fuzz_review_classifier.py.oracle_masknow derives theunkeptflag from the raw spans.oracle_linenow requires the expected masked line, plus the code span reason exactly when a span is left open or unkept or a backtick is escaped. Six new negative controls (**`src/x.py:12 `**among them) all pass the old oracle and fail the new one, and a new seed covers these lines. Amended intoTest: Add fuzz harnesses for untrusted input. - No rebase: the branch stays onaf18f71, which is the default branch head. The PR is mergeable and nobody asked for a rebase. - No failing checks. The full unit suite, prek on the changed files and gitlint pass. A 300,000-line random differential check agrees withmask_spans/read_line. - Atheris installed, but the session refused to run it. This round's change was not fuzzed under Atheris. - Nothing disputed; nothing open from this round.. The Copilot review of it has findings (2 unresolved review threads; assessment: changes recommended). 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.lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 6: an AI agent revised pull request #206 (head 6186f15). Round 6 on #206. - Fixed both Copilot threads on
fuzz/fuzz_review_classifier.py.oracle_verdictread clean headings as a set and never required a count, so a clean verdict passed for an approval h3 after a changes h3, or for a body with### Suppressed comments (1).check_classifynow prefixes each body with a section the harness writes itself: a🟡 Changes recommendedh3, which must read aschanges, and a suppressed heading and a previously missed summary that state 1 to 9 findings, which must count at least that many. Each prefixed body must give findings. Four negative controls and two seeds are added. Amended intoTest: Add fuzz harnesses for untrusted input. - No rebase: the branch stays onaf18f71, which is the default branch head. The PR is mergeable and nobody asked for a rebase. - No failing checks. The full unit suite, prek on the changed files and gitlint all pass. - Atheris installed, but the session refused to run it. This round's change was not fuzzed under Atheris. - Nothing disputed; nothing from this round remains open.. The Copilot review of it has findings (1 unresolved review thread; assessment: changes recommended). 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.lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 7: an AI agent revised pull request #206 (head 0312bc5). Round 7 on #206. - Fixed Copilot's thread on
fuzz/fuzz_review_classifier.py.oracle_verdictfinds clean headings without reading fences, so a classifier that stopped dropping fenced code and approved a body holding only a fenced approval h3 passed.check_classifynow also classifies each body inside a backtick fence longer than any run in it, which no line can close. That must give no assessment, no counts and findings. Added a fenced-approval seed and three negative controls fororacle_fenced. WithFENCE_OPENdisabled, 16 seeds now fail. Amended intoTest: Add fuzz harnesses for untrusted input. - No rebase: the branch stays onaf18f71, which is the default branch head. The PR is mergeable and nobody asked for a rebase. - No failing checks. The full unit suite, prek on the changed files and gitlint all pass. - Atheris was not run this round. The seeds and the mutation check ran without it. - Nothing disputed; nothing from this round remains open.. The Copilot review of it is clean. An antagonistic review was requested from the review bot.lf-releng-code-monkey-bot commentedon Nov 19, 2026
🐒 Round 8: an AI agent revised pull request #206 (head 517052f). Round 8 on #206, answering antagonistic review round 2. - Fixed the thread on
fuzz/fuzz_review_classifier.py:fenced()measured backtick runs on the raw body, butreview_verdict.boundeddrops lone surrogates when it cuts an oversized body, which can join two runs and close the wrapper's fence early.fenced()now measures runs with surrogates removed, so the fence outlasts every run the classifier can see. Reproduced the falseBreachfirst. The reviewer's input is now a seed: it fails against the oldfenced()and passes now. Amended into the tip commitFix: Classify review bodies with lone surrogates, which introduced the surrogate path. - No rebase: the branch stays onaf18f71, the default branch head. The PR is mergeable and nobody asked for a rebase. - No failing checks. The full unit suite (1598 tests), prek on the changed file (aislop included) and gitlint pass. - Atheris was not available this round, so the harness was not fuzzed under it. The seeds ran without it. ## Antagonistic review The body holds no finding beyond its one inline thread (the false failure in the fenced oracle), fixed above. It answers antagonistic review round 2 (#206 (review)). The Copilot review of it is clean. An antagonistic review was requested from the review bot.