Skip to content

Commit bab8fe4

Browse files
igerberclaude
andcommitted
Source review prompt from base_sha (not PR head)
The prompt defines HOW the reviewer reviews. Sourcing it from the PR head allowed a PR to silently change its own review rules. Read it from base_sha via `git show` instead; the prefetch step has already fetched that commit's tree. Scope-limited intentionally: docs/methodology/REGISTRY.md and TODO.md remain sourced from the PR head. The prompt itself instructs the reviewer to recognize PR-added Note/Deviation labels in REGISTRY.md and new entries in TODO.md as mitigations (`.github/codex/prompts/ pr_review.md:4,9,62,97`), so those files must reflect the PR's edits to behave correctly. Only the review-rules file is moved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fb1c468 commit bab8fe4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/ai_pr_review.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,14 @@ jobs:
153153
set -euo pipefail
154154
PROMPT=.github/codex/prompts/pr_review_compiled.md
155155
156-
cat .github/codex/prompts/pr_review.md > "$PROMPT"
156+
# Source the review prompt from base_sha rather than the PR head.
157+
# The prompt defines HOW the reviewer reviews; sourcing it from
158+
# base prevents a PR from modifying its own review rules. (Note:
159+
# docs/methodology/REGISTRY.md and TODO.md remain from the PR
160+
# head intentionally - the prompt instructs the reviewer to
161+
# recognize PR-added Note/Deviation labels and tracked TODOs as
162+
# mitigations, so those must reflect the PR's edits.)
163+
git show "${BASE_SHA}":.github/codex/prompts/pr_review.md > "$PROMPT"
157164
158165
# Sanitize untrusted text so hostile content can't close the
159166
# wrapper tags and inject instructions to the reviewer.

0 commit comments

Comments
 (0)