Skip to content

Fix: Keep allowed URLs and tighten fuzz oracles #123

Closed

Description

This was generated by AI during triage.

Summary

Pull request #112 merged at 20:30 UTC on 19 November. Copilot's review of its last push arrived at 20:37, with six findings no round answered. One is a defect in scripts/review_policy.py; the other five are oracles in the fuzz harnesses that accept a wrong result. Fix all six.

The findings were checked against main at 3c9f13f. Each is quoted in full below, since an agent session cannot open the links.

1. scripts/review_policy.py: an allowed URL is altered

https://github.com/org/repo/search?q=ftp://server is one allowed organisation URL, but the new FTP match inserts a zero-width space into its query and changes the search target. Skip schemes inside an already-kept autolink, and make the same distinction in fuzz/github_markdown.py:169–173.

Confirmed. contain_links("See https://github.com/lfreleng-actions/repo/search?q=ftp://server x", "lfreleng-actions") returns the URL with a zero-width space after ftp:. That breaks a link the policy means to keep live.

Desired behaviour:

  • A scheme inside a URL the function keeps (an allowed organisation link) is left as written.
  • A scheme that starts a URL of its own, ftp:// included, is still broken.
  • The oracle in fuzz/github_markdown.py makes the same distinction, so it fails on the current behaviour.

2. fuzz/sanitised_text.py: three oracles accept wrong results

All three reproduce: verify_text returns without raising on each input below.

  • Space after every colon (near line 87):

    This accepts a space after every colon, but sanitise replaces non-overlapping :: pairs. For ":" * 301 + " critical security issue", the oracle accepts ": " * 299 + "::...", hiding a warning that the real 475-character result retains. Accept spaces only after the first colon of each source pair and add this wrong-result test.

  • An uncut match over the limit (near line 156):

    A complete match is accepted without checking its length. For example, verify_text("a" * 601, "a" * 601, 600, "summary") returns successfully, and one_line accepts it too, although sanitise must truncate at 600 and append .... Require an uncut match to fit the limit and cover this boundary in the wrong-result tests.

  • A missing character when no cut is needed (near line 164):

    The shorter-prefix branch accepts a missing non-whitespace character, even when no cut is needed. For source 'a' * 596 + ' not' (exactly 600 characters), it accepts 'a' * 596 + ' no...' although sanitise returns the source unchanged. Require the escaped source to exceed the limit and permit a shorter prefix only when rstrip() removes whitespace, including inserted marker spaces.

3. fuzz/fuzz_comment.py: two bounds skip the code check

I did not run these two; the code at the cited lines matches the description. Verify each before changing it.

  • & counted as growth (ENTITY and growth, near line 71):

    & is counted as growth even though defuse explicitly leaves it unchanged. For "& " * 250 followed by a fenced important block, the unchanged 1,518-character body fits in 2,000 characters, but the inflated bound skips the check and accepts an output that drops the block. Exclude the already-escaped entity and add this case to the wrong-result tests.

  • Outer whitespace counted against the limit (verify_code_kept, near line 178):

    For ' ' * 2000 + '\n```\nimportant\n```' at limit 2000, comment_text strips the outer whitespace and keeps the complete block, but this early return also accepts a result that drops it. Account for removable outer whitespace when deciding whether preservation can be skipped. Keep the scan linear and determine fence positions before stripping so indented fences are not reinterpreted.

Lessons from earlier rounds

These bounds and oracles took seven Copilot rounds on #112. The organisation-wide list is in lfreleng-actions/.github#372 under "What review caught". The points that apply here:

  • An early return or size bound in an oracle must not skip the check for an input that fits.
  • Model the documented limits, such as truncation at 600 and ..., exactly: an oracle that is looser on either side passes wrong answers.
  • Keep oracles linear in the input.
  • Every changed oracle gets a negative control in the wrong-result tests: the input quoted in its finding, and the nearest inputs either side of the boundary.

Acceptance criteria

  • contain_links leaves a scheme inside a kept organisation URL unchanged and still breaks a standalone ftp://, http:// and https:// URL. A regression test covers both.
  • Each of the six inputs quoted above is a wrong-result test that the corresponding oracle now rejects, and the existing seeds and wrong-result tests still pass.
  • Each harness fuzzes for at least a minute under Atheris with no new failure. The pull request body gives the runs and inputs.
  • The repository's tests and hooks pass, the aislop gate at 100 included. Nothing under .github/workflows/ changes.

Out of scope

Activity

  1. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent has proposed a change for this issue: pull request #125 (head 95e32ee). 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.

  2. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 1: an AI agent revised pull request #125 (head 78d5920). Round on #125. All three Copilot findings were verified, reproduced and fixed. Each fix is in the commit it belongs to, with new tests and seeds: - contain_run kept later schemes past a backtick or after an ASCII letter; the autolinks oracle hid it. A kept link now reaches only to the next backtick, and only when no letter precedes it. The oracle now checks those schemes. - SCHEME_MARK removed only one ZWSP. It now removes a run of them. - verify_text accepted a whole exact-limit text followed by .... The new mark_left closes that. No rebase: base_sha equals the default branch head, the PR is mergeable, and no maintainer asked. Nothing is disputed. Checks: unit tests (883), 60 s of Atheris per harness, prek and gitlint all exit 0. No failing checks; no antagonistic 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.

  3. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 2: an AI agent revised pull request #125 (head ade1d0c). Round 2 on #125. One Copilot finding, verified and fixed. - Kept link whose own scheme breaks (fuzz/github_markdown.py): reproduced. altered_links read kept links only from the result, so when containment broke the outer https: (alone, or with the inner ftp:), no kept link was left to check. Both harnesses accepted it. The function now also reads kept links from the source. It checks only links that contain_links always keeps: https://github.com/<org>/, no ASCII letter before the scheme, and no dot segment in the run. Links the policy may break on purpose (dot segments, no slash after the org) stay unchecked, so no false alarms. New negative controls cover both harnesses. A 300k-input random cross-check against contain_links found no false positives. Fixes sit in their commits: tests in the expected-fail test commit, oracle in Fix(policy): Keep schemes inside a kept link. No rebase. The PR is mergeable, nobody asked for one, and the branch stays on 3c9f13f. (Round 1 said base_sha equalled main's head. That was wrong: main has since moved to 67eed09.) Checks: unit suite at every commit (exit 0), 60 s Atheris per harness (0 failures), gitlint and prek on the changed files (exit 0). No failing checks; no antagonistic review. Nothing disputed.. 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.

  4. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 3: an AI agent revised pull request #125 (head ee703cf). Round 3 on #125. I reproduced and fixed both Copilot findings: - Source-space cut dropped a ZWSP mark (fuzz/sanitised_text.py): for 'a' * 598 + '@​ b' at 600, the oracle accepted 'a' * 598 + '@​...'. space_cut now rejects that cut while a zero-width space is still due. The fix is in Fix(fuzz): Tighten sanitised text oracles, and the negative controls are in the expected-fail test commit. - Blank suffix rescanned per opener (fuzz/fuzz_comment.py): the scan now stops after the last line that has text. I did not use the suggested text.rstrip(): it trims a U+3000 after a closing run and would cause false breaches. The fix and a timing test are in Fix(fuzz): Bound comment code checks exactly. No rebase: the PR is mergeable, nobody asked for one, and the branch stays on 3c9f13f. Nothing is disputed. There are no failing checks and no antagonistic review. Checks: the unit suite passed at every commit (exit 0), prek on the changed files passed (exit 0), and 60 s of Atheris per harness found no failures.. 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.

  5. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 4: an AI agent revised pull request #125 (head b82f190). Round 4 on #125. I reproduced and fixed all three Copilot findings in the commits they belong to. The negative controls are in the expected-fail test commit. - Mark inside a scheme (fuzz/github_markdown.py): both harnesses accepted r?u=f​tp://server. SCHEME_MARK now keeps marks between any two characters of a scheme, :// included. - Kept links the source check skipped (fuzz/github_markdown.py): any dot segment in a run skipped the whole run, and the check wanted a slash after the org. Containment keeps x/../https://github.com/<org>/… and https://github.com/<org>. The new always_kept looks for a dot only from the scheme on, and accepts a root followed only by trailing punctuation. A 300k random cross-check against contain_links found no false alarms. - Long closing line rescanned (fuzz/fuzz_comment.py): written_code read every line after each opener. It now reads each line once, from the end back, and keeps the nearest closer for each fence character and width. A U+3000 after a run still leaves no closer. It matches the old scan on 300k random inputs. The reported shape took 2.4 s before the fix and 0.1 s after. No rebase: the PR is mergeable, nobody asked for one, and the branch stays on 3c9f13f. Nothing is disputed. No checks failed and there is no antagonistic review. The unit suite passed at every commit (exit 0), prek and gitlint passed (exit 0), and 60 s of Atheris per harness found no failures.. The Copilot review of it is clean. An antagonistic review was requested from the review bot.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions