Skip to content

Commit 7259a84

Browse files
fix: Remove pull_request_target code checkout vulnerability
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>
1 parent 8c49fb2 commit 7259a84

File tree

1 file changed

+21
-46
lines changed

1 file changed

+21
-46
lines changed

.github/workflows/eval-skill-fork.yml

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,51 +24,29 @@ jobs:
2424
gh api "repos/$REPO/issues/$PR/labels/eval-skill" -X DELETE 2>/dev/null || true
2525
gh api "repos/$REPO/issues/$PR/labels/eval-skill-passed" -X DELETE 2>/dev/null || true
2626
27-
eval:
28-
name: Run skill eval
27+
notify-manual-review:
28+
name: Require manual review for fork PRs
2929
if: >-
3030
github.event.action == 'labeled'
3131
&& github.event.label.name == 'eval-skill'
3232
&& github.event.pull_request.head.repo.fork == true
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: actions/checkout@v6
36-
with:
37-
ref: ${{ github.event.pull_request.head.sha }}
38-
39-
- uses: oven-sh/setup-bun@v2
40-
41-
- uses: actions/cache@v5
42-
id: cache
43-
with:
44-
path: node_modules
45-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
46-
- if: steps.cache.outputs.cache-hit != 'true'
47-
run: bun install --frozen-lockfile
48-
49-
- name: Eval SKILL.md
50-
id: eval
51-
run: bun run eval:skill
52-
env:
53-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
54-
continue-on-error: true
35+
# SECURITY: Do not checkout PR code in pull_request_target context.
36+
# pull_request_target runs with write permissions and access to secrets,
37+
# but checking out PR code would allow malicious PRs to exfiltrate secrets
38+
# via modified dependencies or build scripts.
39+
# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
5540

5641
- name: Post commit status
5742
env:
5843
GH_TOKEN: ${{ github.token }}
5944
run: |
6045
SHA="${{ github.event.pull_request.head.sha }}"
61-
if [[ "${{ steps.eval.outcome }}" == "success" ]]; then
62-
STATE="success"
63-
DESC="Skill eval passed"
64-
else
65-
STATE="failure"
66-
DESC="Skill eval failed"
67-
fi
6846
gh api "repos/${{ github.repository }}/statuses/$SHA" \
69-
-f state="$STATE" \
47+
-f state="pending" \
7048
-f context="eval-skill/fork" \
71-
-f description="$DESC"
49+
-f description="Manual review required for fork PRs (security restriction)"
7250
7351
- name: Remove eval-skill label
7452
if: always()
@@ -78,20 +56,17 @@ jobs:
7856
gh api "repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/eval-skill" \
7957
-X DELETE 2>/dev/null || true
8058
81-
# Use the SENTRY_RELEASE_BOT app token to add the label — app tokens
82-
# can trigger workflow runs, unlike GITHUB_TOKEN (recursion protection).
83-
- name: Get app token
84-
id: token
85-
if: steps.eval.outcome == 'success'
86-
uses: actions/create-github-app-token@v3
87-
with:
88-
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
89-
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
90-
91-
- name: Add eval-skill-passed label (triggers main CI re-run)
92-
if: steps.eval.outcome == 'success'
59+
- name: Add comment with instructions
9360
env:
94-
GH_TOKEN: ${{ steps.token.outputs.token }}
61+
GH_TOKEN: ${{ github.token }}
9562
run: |
96-
gh api "repos/${{ github.repository }}/issues/${{ github.event.number }}/labels" \
97-
--input - <<< '{"labels":["eval-skill-passed"]}'
63+
gh api "repos/${{ github.repository }}/issues/${{ github.event.number }}/comments" \
64+
-f body="⚠️ **Security Notice**: Automated skill evaluation is disabled for fork PRs to prevent potential secret exfiltration.
65+
66+
For security reasons, this workflow was updated to not execute untrusted code from fork PRs with access to repository secrets. A maintainer with write access can manually trigger the evaluation by:
67+
68+
1. Checking out the PR branch locally
69+
2. Running \`bun run eval:skill\` with appropriate API credentials
70+
3. Reviewing the results and adding the \`eval-skill-passed\` label if successful
71+
72+
See [GitHub Security Lab: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) for more information about this security issue."

0 commit comments

Comments
 (0)