Skip to content

fix: Remove pull_request_target code checkout vulnerability#694

Closed
fix-it-felix-sentry[bot] wants to merge 1 commit intomainfrom
security/fix-pull-request-target-vuln
Closed

fix: Remove pull_request_target code checkout vulnerability#694
fix-it-felix-sentry[bot] wants to merge 1 commit intomainfrom
security/fix-pull-request-target-vuln

Conversation

@fix-it-felix-sentry
Copy link
Copy Markdown

Summary

This PR fixes a high-severity security vulnerability where the eval-skill-fork.yml workflow was checking out untrusted PR code in a pull_request_target context with access to repository secrets.

Security Issue

The workflow was:

  1. Running in pull_request_target context (has write permissions and access to secrets)
  2. Checking out PR code with ref: ${{ github.event.pull_request.head.sha }}
  3. Running bun install (executing potentially malicious install scripts)
  4. Running bun run eval:skill (executing potentially malicious code)
  5. Exposing ANTHROPIC_API_KEY secret to the untrusted code

This could allow a malicious PR to exfiltrate repository secrets by modifying package.json, bun.lock, or build scripts.

Fix

The workflow now:

  • Does NOT checkout PR code in the pull_request_target context
  • Does NOT run any untrusted code from fork PRs
  • Posts a pending status and comment explaining manual review is required
  • Includes security comments referencing GitHub Security Lab guidelines

Impact

Fork PRs will no longer have automated skill evaluation. Maintainers must:

  1. Check out the PR branch locally
  2. Run bun run eval:skill with appropriate credentials
  3. Add the eval-skill-passed label manually if successful

This is a necessary security trade-off to prevent secret exfiltration.

References

🤖 Generated with Claude Code

This fixes a security vulnerability (VULN-1426 / ENG-7271) where the
workflow was checking out untrusted PR code in a pull_request_target
context, which could allow malicious PRs to exfiltrate repository
secrets via modified dependencies or build scripts.

The workflow now requires manual review for fork PRs instead of
automatically running untrusted code with access to secrets.

References:
- Parent ticket: https://linear.app/getsentry/issue/VULN-1426
- Child ticket: https://linear.app/getsentry/issue/ENG-7271
- https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (commands) Add buildRouteMap wrapper with standard subcommand aliases by BYK in #690

Bug Fixes 🐛

  • (init,feedback) Default to tracing only in feature select and attach user email to feedback by MathurAditya724 in #688
  • Remove pull_request_target code checkout vulnerability by fix-it-felix-sentry[bot] in #694

Internal Changes 🔧

  • (eval) Replace OpenAI with Anthropic SDK in init-eval judge by betegon in #683
  • (init) Use markdown pipeline for spinner messages by betegon in #686
  • Regenerate skill files and command docs by github-actions[bot] in 584ec0e0

🤖 This preview updates automatically when you update the PR.

Comment on lines 43 to +47
GH_TOKEN: ${{ github.token }}
run: |
SHA="${{ github.event.pull_request.head.sha }}"
if [[ "${{ steps.eval.outcome }}" == "success" ]]; then
STATE="success"
DESC="Skill eval passed"
else
STATE="failure"
DESC="Skill eval failed"
fi
gh api "repos/${{ github.repository }}/statuses/$SHA" \
-f state="$STATE" \
-f state="pending" \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The workflow sets the eval-skill/fork commit status to pending, but the main CI requires success, permanently blocking fork PRs that modify skill files from passing checks.
Severity: HIGH

Suggested Fix

Update the workflow to allow a maintainer's action, such as adding the eval-skill-passed label, to trigger an update that sets the eval-skill/fork commit status to success. This will unblock the CI check in ci.yml after a maintainer has manually approved the skill evaluation.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/eval-skill-fork.yml#L43-L47

Potential issue: The `ci.yml` workflow requires the `eval-skill/fork` commit status to
be `success` for fork PRs that modify skill files. However, the new
`eval-skill-fork.yml` workflow hardcodes this status to `pending`. The instructions for
maintainers mention adding a label (`eval-skill-passed`) after manual review, but the CI
check does not look for this label. Because there is no mechanism to update the commit
status to `success`, any fork PR modifying skill files will be permanently blocked from
passing CI checks and cannot be merged.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Fork PR commit status permanently stuck at pending
    • Added a workflow job that listens for the eval-skill-passed label on fork PRs and posts eval-skill/fork status as success on the PR head SHA.

Create PR

Or push these changes by commenting:

@cursor push 49d826d89a
Preview (49d826d89a)
diff --git a/.github/workflows/eval-skill-fork.yml b/.github/workflows/eval-skill-fork.yml
--- a/.github/workflows/eval-skill-fork.yml
+++ b/.github/workflows/eval-skill-fork.yml
@@ -70,3 +70,21 @@
 3. Reviewing the results and adding the \`eval-skill-passed\` label if successful
 
 See [GitHub Security Lab: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) for more information about this security issue."
+
+  mark-manual-review-passed:
+    name: Mark fork eval as passed
+    if: >-
+      github.event.action == 'labeled'
+      && github.event.label.name == 'eval-skill-passed'
+      && github.event.pull_request.head.repo.fork == true
+    runs-on: ubuntu-latest
+    steps:
+      - name: Post success commit status
+        env:
+          GH_TOKEN: ${{ github.token }}
+        run: |
+          SHA="${{ github.event.pull_request.head.sha }}"
+          gh api "repos/${{ github.repository }}/statuses/$SHA" \
+            -f state="success" \
+            -f context="eval-skill/fork" \
+            -f description="Manual fork PR skill evaluation approved by maintainer"

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7259a84. Configure here.

-f state="pending" \
-f context="eval-skill/fork" \
-f description="$DESC"
-f description="Manual review required for fork PRs (security restriction)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fork PR commit status permanently stuck at pending

High Severity

The workflow sets the eval-skill/fork commit status to "pending" but never provides a path to set it to "success". The ci.yml eval-skill job checks this status and fails if it's not "success". The comment instructs maintainers to add the eval-skill-passed label, but no workflow reacts to that label by updating the commit status. This means fork PRs that modify skill files can never pass CI — the status is permanently stuck at "pending".

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7259a84. Configure here.

@BYK
Copy link
Copy Markdown
Member

BYK commented Apr 9, 2026

Intentional

@BYK BYK closed this Apr 9, 2026
@BYK BYK deleted the security/fix-pull-request-target-vuln branch April 9, 2026 10:42
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.

1 participant