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. This bot decides whether an untrusted review agent's verdict may become an approval, and posts that agent's words on pull requests.
Why
- What these functions accept can become an approving review, or a comment under the bot's name.
- 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.
-
Verdict extraction and policy.
review_policy:extract_verdict,final_json_block,text_field,findings_of,injections_of,parse_approve_tiers,sanitise,defuse,disarm_html,contain_links.Properties to consider, each to be confirmed against
docs/DESIGN.md: a refusal isRejectedand never another exception; text that has been through the sanitisers holds no live mention, no raw HTML and no link outside the organisation. -
Comment safety.
comment_markdown:comment_text,disarm_prose,outside_code,fit,close_fence. Its docstring: "Make an antagonistic agent's comment Markdown safe to post, code kept as written".Properties to consider: the result fits its limit; every code fence it opens is closed; text inside code is unchanged.
-
Diff rules.
review_vetoes:changed_lines,uses_of,ref_is_pinned,uses_lines_pinned,dockerfile_lines_pinned,classify_trivial. A patch comes from any contributor.
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 #112 (head b315017). The Copilot review of it has findings (7 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 1: an AI agent revised pull request #112 (head f1f2be3). Round 1 on #112: all 7 Copilot findings fixed, no rebase (branch stays on base_sha; mergeable, no maintainer request). Harness commit amended: - Code kept: in-order, consuming match, also on the posted body. -
FENCE_LINEpossessive (linear). - Findings/injection lists checked against the final block. - Check rendered and encoded as strict UTF-8. - Org link oracle compares the whole first segment after GitHub trimming. - Suggestion oracle matches fences raw, decodes only the info string. Two production fixes, each in its own commit with a regression test and seed: -contain_linkslefthttps://github.com/<org>)x/…and<org>"/…live (the fuzzer found the second right away). -sanitisepassed lone surrogates, which crashedrun_check's UTF-8 job summary. Fuzzed 76 s each: verdict 259,314 runs, comment 12,022 runs, both clean. Unit suite (831), prek and gitlint pass. Remaining:comment_textkeeps lone surrogates in comment bodies (posted as escaped JSON only), noted for a reviewer.review_vetoesis not fuzzed.. The Copilot review of it has findings (6 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 #112 (head a3736f4). Round 2: fixed all six Copilot findings and resolved each thread. No rebase: base_sha is already the default branch head, the PR is mergeable and no maintainer asked for one. - ftp autolinks: the link oracle now scans
ftp://. That exposed a production gap:ftp://links stayed live. New commitFix(policy): Disarm ftp autolinks. - Truncation exemption: removed. A cut through an organisation URL lefthttps://github.com/lfr…live. New commitFix(comment): Contain a link the cut leaves:fittedcontains the text again after each cut. - Quotes in ORG_TAIL:'and"are dropped from the trimmable tail (amended into the ORG_TAIL commit). The oracle counts a link as inside only when it is inside both with and without quote trimming. - Code-kept bound: the check skips only when the kept code plus the worst growth of the rest could pass the limit. - Schema: the oracle checks the source block's schema and the verdict's. - Kept text: summary, notes and injections are compared in order with the source, allowing for a cut. Checks: unit suite OK at each of the 5 commits; prek clean; gitlint clean; fuzz runs clean (verdict 284k runs, comment 14.8k runs, 90 s each); no mode changes. No prompt-injection content seen.. The Copilot review of it has findings (5 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 3: an AI agent revised pull request #112 (head 4803c36). Round 3: fixed all five Copilot findings, each amended into the harness commit (
Test: Add Atheris fuzz harnesses); all threads resolved. No rebase: base_sha is the default branch head, the PR is mergeable and no maintainer asked. - Quadratic code scan (fuzz_comment.py): bodies over the limit return beforewritten_code; 20,000 unclosed openers went from 52.7 s to 0.04 s, replayed in a test. - Whitespace (readable): runs fold to one space, not away; only the spacesanitiseputs in::/##[is dropped.now herevsnowhereis now caught. - Empty cut stem: a cut needs a source that could exceed the limit and must keep real text; the reported case and a ZWSP-only cut are caught. - Coerced PR number: the block'spull_requestmust be anint. - Approval body: checked above its footer for outside links, org from the checked repository; a wrong renderer is caught. I also stress-tested the new text oracle againstsanitisewith 1.2M random cases and found no false breaches. Checks: suite OK at each of 5 commits, prek and gitlint clean, verdict fuzz 412k runs and comment fuzz 23.8k runs (91 s each), both clean, no mode changes. No instructions found in the packet.. The Copilot review of it has findings (4 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 4: an AI agent revised pull request #112 (head c51350b). Round 4: fixed all four Copilot findings, each in the fuzz oracles and amended into
Test: Add Atheris fuzz harnesses. All threads are resolved. No rebase: base_sha is the default branch head, the PR is mergeable and no maintainer asked for one. - Marker spaces (fuzz_verdict.py):verify_textnow aligns kept text with its source. Marks count only wheresanitiseadds them, sox::yforx: :yand&for&amp;are caught. - ZWSP cuts: a cut must keep the firstlimitcharacters, read as the source's start and leave text out. Both reported wrong results are now in the tests. - Kelvin sign (github_markdown.py): org and host compare over ASCII only. -suggestion:-0+2: now recognised as a suggestion fence, with a test case. The six new test cases fail against the old oracles. A 1M-input differential stress test againstsanitisefound no false breach. Checks: suite OK (841) at each of the 5 commits; prek and gitlint clean; verdict fuzz 367k runs and comment fuzz 21.7k runs (91 s each), both clean; no mode changes. No instructions found in the packet.. The Copilot review of it has findings (4 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 5: an AI agent revised pull request #112 (head 760edf3). Round 5: fixed all four Copilot findings in the oracles and the replay test, amended into
Test: Add Atheris fuzz harnesses. All threads are resolved. No rebase:base_shais already the default branch head, the PR is mergeable and no maintainer asked for one. - Code-kept bound (fuzz_comment.py): replaces the fivefold bound with the real growth (&+4,@#<hH/]:.+1, +1 per line). The reported 401-char prose case is now checked. - Block sequence: the rendered blocks must equal the written ones, so insertion and duplication are caught. - Invented ZWSPs (fuzz_verdict.py): a mark needs the whole trigger in the source, so ZWSPs after everyhare caught. - Discovery test: now readsgit ls-files, so an ignored file holding Atheris is skipped. - The text oracle moved to the newfuzz/sanitised_text.py, so aislop's file-size limit holds. New wrong-result tests fail on the old oracles. Checks: 844 tests OK at each of the 5 commits; prek (aislop 100) and gitlint pass; verdict fuzz 211k runs and comment fuzz 13k runs (75 s each), both clean; no mode changes. No instructions found in the packet.. The Copilot review of it has findings (3 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 #112 (head b8c0162). Round 6: fixed all three Copilot findings in the fuzz oracles and amended them into
Test: Add Atheris fuzz harnesses, so the branch still has 5 commits. All threads are resolved. I did not rebase:base_shais already the default branch head, the PR is mergeable and no maintainer asked for one. - Plain&(fuzz_comment.py): the no-cut bound adds +4 only for an&that starts a character reference. The reporteda & bcase is now checked. - ZWSP runs (sanitised_text.py): each trigger allows at most one zero-width space. - Entities (sanitised_text.py):amp;is required after a reference's&(&amp;excepted) and rejected anywhere else. Both directions are tested. Every new wrong-result test fails against the old oracles. Checks: - 846 tests OK at each commit. - prek (including aislop) and gitlint pass. - Atheris runs for 75 s each were clean: 285k verdict inputs and 20k comment inputs. - 500k differential stress cases found no false breach. - No mode changes. The packet held no instructions for me. GitHub did not confirm whether the pull request can merge withmain, so its CI may not have run. The Copilot review of it has findings (6 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.