Skip to content

Commit 595b1ab

Browse files
committed
fix: pin checkout ref to base SHA to prevent fork code execution
For pull_request_review events github.sha resolves to the PR head commit (i.e. the fork's branch), so the default actions/checkout would pull untrusted contributor code and the subsequent require() call would execute the fork's copy of the bot script. Explicitly set ref to github.event.pull_request.base.sha so the checkout always lands on the verified base-branch code. Falls back to github.sha for workflow_dispatch where pull_request is absent. Signed-off-by: Mounil Kanakhara <mounilkankhara@gmail.com>
1 parent 53b72c9 commit 595b1ab

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

.github/workflows/on-review.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
- name: Checkout repository
3939
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4040
with:
41+
ref: ${{ github.event.pull_request.base.sha || github.sha }}
4142
persist-credentials: false
4243

4344
- name: Run Add Reviewers as Assignees

0 commit comments

Comments
 (0)