-
Notifications
You must be signed in to change notification settings - Fork 134
Update Claude Code Review workflow to include checkout #1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,20 +15,21 @@ jobs: | |||||||||||||
| id-token: write | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| # IMPORTANT: no checkout for pull_request_target (fork-safe) | ||||||||||||||
| - name: Checkout PR head (fork) | ||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||
| with: | ||||||||||||||
| ref: ${{ github.event.pull_request.head.sha }} | ||||||||||||||
| fetch-depth: 1 | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+18
to
+23
|
||||||||||||||
| - name: Checkout PR head (fork) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: 1 | |
| # IMPORTANT: no checkout for pull_request_target (fork-safe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P0: Security: Checking out untrusted fork code in a
pull_request_targetworkflow exposes secrets to prompt injection attacks.The
pull_request_targettrigger runs with the base repo's secrets and write permissions. By checking out the fork's HEAD, untrusted code (including potentialCLAUDE.mdprompt injection files) becomes available toclaude-code-action, which is an AI agent capable of executing shell commands and reading files. A malicious PR could craft prompt injections that exfiltrateCLAUDE_CODE_OAUTH_TOKENor abuse thegithub.token's write access.The previous workflow deliberately avoided checkout with the comment "IMPORTANT: no checkout for pull_request_target (fork-safe)". This security measure should not be removed. If checkout is needed for the action to function, consider restricting to non-fork PRs:
Prompt for AI agents