Skip to content

ci(claude-review): pin the gh pr allows to the reviewed pull request - #1004

Merged
tobyhede merged 1 commit into
mainfrom
ci/claude-review-scope-gh-allows
Oct 2, 2026
Merged

tobyhede merged 1 commit into
mainfrom
ci/claude-review-scope-gh-allows

Conversation

@tobyhede

@tobyhede tobyhede commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

The Claude pull-request review (added in #974) lets Claude run three shell commands: gh pr diff, gh pr view and gh pr comment. The allow rules accepted any pull request number, so text planted in a reviewed diff could trick Claude into reading another pull request in this repository, or commenting on one, using the job's pull-requests: write token. Only the prompt said not to. This pins each rule to the number of the pull request being reviewed, so the tool permissions enforce that limit instead of the prompt.

Changes

  • .github/workflows/claude-review.yml: Bash(gh pr diff:*) becomes Bash(gh pr diff ${{ github.event.pull_request.number }}:*), and the same for view and comment; the comment explains the scoping.
  • scripts/__tests__/claude-review-workflow.test.mjs: the exact-args assertion expects the pinned rules.

Verification

  • vitest run --config scripts/vitest.config.mjs on claude-review-workflow.test.mjs and workflow-publish-permissions.test.mjs: 26 passed. The full scripts/__tests__ suite (54 files) passed on the same change on top of the Add federated Claude PR review #974 branch.
  • Matching semantics come from the Claude Code permissions docs: the :* suffix is equivalent to a trailing *, which requires a space after the prefix, so gh pr diff 97:* does not match gh pr diff 974; each part of a compound command (&&, ;, |) must match a rule on its own.
  • This pull request's own Claude review run uses the new rules. If it posts its summary comment, the pinned gh pr diff / gh pr comment invocations are allowed in practice.

Related

Refs #974

Review notes

No changeset: CI workflow and repo test only, nothing published.

The Bash(gh pr diff:*), view and comment allows matched any pull request
number, so a prompt injection in a reviewed diff could read another pull
request or comment on it with the job's pull-requests: write token; the
prompt telling Claude not to was the only boundary. Name
github.event.pull_request.number in each rule. The :* suffix matches at a
word boundary, so 97 does not admit 974, and each part of a compound
command is checked separately.
@changeset-bot

changeset-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f652d33

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tobyhede
tobyhede marked this pull request as ready for review October 2, 2026 03:33
@tobyhede
tobyhede requested a review from a team as a code owner October 2, 2026 03:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T03:36:14.778506Z f652d33 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Reviewed commit f652d33; no actionable issues found.

@tobyhede
tobyhede merged commit 2a18604 into main Oct 2, 2026
27 checks passed
@tobyhede
tobyhede deleted the ci/claude-review-scope-gh-allows branch October 2, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants