Skip to content

Commit f16d7b8

Browse files
committed
Harden Claude review workflow for fork PRs
Switch to pull_request_target so fork PRs can actually get the write token they need, then layer guards: require dakra to be the label sender, check out the PR head with persist-credentials disabled so the token isn't left in .git/config for untrusted PR code to read.
1 parent efe1ccc commit f16d7b8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/claude-code-review.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: Claude Code Review
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [labeled]
66

77
jobs:
88
claude-review:
9-
if: github.event.label.name == 'claude-review'
9+
if: |
10+
github.event.label.name == 'claude-review' &&
11+
github.event.sender.login == 'dakra'
1012
runs-on: ubuntu-latest
1113
permissions:
1214
contents: read
@@ -18,7 +20,9 @@ jobs:
1820
- name: Checkout repository
1921
uses: actions/checkout@v4
2022
with:
23+
ref: ${{ github.event.pull_request.head.sha }}
2124
fetch-depth: 1
25+
persist-credentials: false
2226

2327
- name: Run Claude Code Review
2428
id: claude-review

0 commit comments

Comments
 (0)