Follow-up to #442: closing-keyword regex matches inside words; guard the stubbed helpers #444
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor#444
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #442 (merged). Three items, all decided — build them, no deliberation needed.
1. The closing-keyword regex has no word boundary (real bug)
lib/review.shextracts the linked issue with:No leading boundary, so any word ENDING in one of those matches. Measured:
This is not hypothetical for this fleet — "issue prefixes" is standing vocabulary here (the persona convention uses it). When it fires, the reviewer is handed a completely UNRELATED issue's body as "the requirements this PR claims to satisfy", which is worse than giving it no issue at all and directly undercuts what #442 was for.
Decision: anchor the alternation to a word start —
(^|[^[:alnum:]])before the group, or\bif you keep GNU grep. Add the four false-positive strings above as test cases; the current suite has none of them.2. The test suite stubs the Forgejo helpers without checking they exist
bin/test-review.shoverridesforgejo_get_issueandforgejo_repo_get_filewith its own stubs. Every production call site is wrapped in|| return 0/2>/dev/null || true, so if either helper is renamed or changes arity, the feature degrades to a permanent silent no-op and the suite still passes green.I verified both exist today with the arity
lib/review.shuses (forgejo_get_issue "$repo" "$number",forgejo_repo_get_file "$repo" "$path"), so this is about the future, not a live defect.Decision: source
lib/forgejo.shand assertdeclare -F forgejo_get_issue forgejo_repo_get_fileBEFORE installing the stubs. Same class of silent-pass hole as igor#430/#431.3. Document the trust model in lib/review.sh (prevents a future security regression)
The shadow reviewer's review of #442 asked which ref
forgejo_repo_get_filereads, because the answer decides whether a PR can inject text into the prompt of the reviewer that gates its own auto-merge. Verified empirically:forgejo_repo_get_filecalls/repos/{repo}/contents/{path}with noref-> the DEFAULT BRANCH.bin/test-review.shexists only on the #442 branch. The contents API returns empty without a ref, and the blob only withref=<branch>.So today a PR cannot edit its own
Makefile/bin/*.shto inject into the reviewer's prompt. That is the correct and safe behaviour, and it is currently load-bearing but undocumented.Decision: state it in the module comment — this deliberately reads the default branch, and adding a
ref=to read the PR head would let a PR inject arbitrary text (including fence breaks and fake section headings) into the prompt of the reviewer gating its merge. A future "bug fix" to make the test-runner facts reflect the PR's own changes is exactly how that vector would get opened by someone acting in good faith.Known and accepted, NOT in scope here: the untrusted-issue fence is a delimiter rather than an escape, so an issue body containing the END marker breaks out. That matches the existing
lib/feedback.shconvention; changing it in one place only would make the codebase inconsistent. If it gets fixed, fix both together.Acceptance criteria
Closes #12/Fixes #7still extract theirs.forgejo_get_issueorforgejo_repo_get_filestops existing.lib/review.shdocuments the default-branch read and why changing it is a security decision.