fix(ci): read review instructions from the base ref - #69
Conversation
| - **ai-claude-review.yml**: Read `REVIEW.md`, `AGENTS.md` and `CLAUDE.md` from | ||
| the base ref instead of the PR's own checkout. A PR that changed these files | ||
| rewrote the instructions of the agent reviewing it, while that agent holds | ||
| `gh pr review --approve`. A second sparse `actions/checkout` provides them | ||
| under `.review-base/`, and the prompt now reads only from there. |
There was a problem hiding this comment.
This changelog entry documents a fix that is not present in the PR. The net diff of this PR against main is only this CHANGELOG entry — the workflow file .github/workflows/ai-claude-review.yml at the head SHA is byte-for-byte identical to main.
The PR's own commit history explains why: the fix was made in 6ef5c2a ("fix(ci): read review instructions from the base ref") and then reverted in 2b957b1 ("ci: temporarily restore main workflow to isolate regression"), with a debug commit (0b4eade) in between. So merging as-is would:
- Add a CHANGELOG entry claiming the security fix (second sparse
actions/checkoutinto.review-base/) is shipped, while the actualai-claude-review.ymlstill readsREVIEW.md/AGENTS.md/CLAUDE.mdfrom the PR checkout — the vulnerability described here would remain unfixed while the changelog asserts it is fixed. - Leave temporary/WIP commits ("add temporary workspace debug step", "temporarily restore main workflow") in the merged history.
Please re-apply the actual workflow change (or drop the CHANGELOG entry) so the code matches what this entry describes, and remove the temporary debug/restore commits before merging.
There was a problem hiding this comment.
The CHANGELOG entry documents a security fix to ai-claude-review.yml (reading review instructions from the base ref via a second sparse checkout into .review-base/), but that fix is not actually in this PR. The net diff against main is only the CHANGELOG entry — the workflow file at the head SHA is identical to main because the fix commit was reverted by 2b957b1 ("temporarily restore main workflow to isolate regression").
Merging as-is would claim the vulnerability is fixed while leaving it unfixed, and would carry temporary debug/restore commits into history. Please re-apply the actual workflow change (or drop the CHANGELOG entry) so code and changelog agree, and clean up the temporary commits.
0677d23 to
6ef5c2a
Compare
A PR that changed REVIEW.md, AGENTS.md or CLAUDE.md rewrote the instructions of the agent reviewing it, while that agent holds `gh pr review --approve`. A second sparse checkout provides them under `.review-base/`. Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
6ef5c2a to
b75b82f
Compare
Summary
REVIEW.md,AGENTS.mdandCLAUDE.mdfrom the PR's own checkout, so a PR touching those files rewrote the instructions of the agent reviewing it — while that agent holdsgh pr review --approve. Not exploitable externally (fork PRs are skipped on line 62), but it bypassed the review gate for any collaborator.actions/checkoutnow fetches these files fromgithub.base_refinto.review-base/, and the prompt reads only from there. The existing PR checkout is untouched: the agent still reviews the PR's code, just not its rules.Bash(gh pr review:*)is deliberately left in--allowedTools. With the rules coming from the base ref the vector is closed; conditional diff analysis in a security-critical file would be redundancy without added protection.Rollout
The merge alone does not reach consumers: all seven pin
ai-claude-review.yml@2026-06-18, not@main. A new date tag onmainplus a Renovate bump is required. (templates/workflows/pull-request.yml:61references@mainbut is obsolete and not the active integration.)Test plan
yamllint -c templates/.yamllint.yml— only the pre-existing 515-char--allowedToolsline is flagged, identical to the state onmain; no new findings.workflow_callsignature unchanged — verified against the diff.git diff --name-only origin/mainshows exactly the two intended files.REVIEW.mddoes not exist in this repo and is skipped without error..review-base/.