Skip to content

Commit cf9a6c2

Browse files
jamesrwebclaude
andcommitted
Restrict auto-review to non-fork PRs for security
Adds a guard so pull_request_target only triggers when the PR originates from the same repo, not from forks. This prevents external contributors from triggering the action with write permissions and secrets via prompt injection in PR bodies. Fork PRs can still be reviewed by explicitly assigning claude[bot]. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ea7c283 commit cf9a6c2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.github/workflows/claude.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
2020
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
2121
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) ||
22-
(github.event_name == 'pull_request_target')
22+
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == github.repository)
2323
runs-on: ubuntu-latest
2424
permissions:
2525
contents: write

0 commit comments

Comments
 (0)