Skip to content

Commit d7d3002

Browse files
authored
CI: AssignCommitter.yml: Use the on: pull_request_target event (not the on: pull_request event)
1 parent 7e09f87 commit d7d3002

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/AssignCommitter.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
name: Assign Committer
22
on:
3+
# Important security note: Do NOT use `actions/checkout`
4+
# or any other method for checking out the pull request's source code.
5+
# This is because the pull request's source code is untrusted, but the
6+
# GITHUB_TOKEN has write permissions (because of the `on: pull_request_target` event).
7+
#
8+
# Quoting from the GitHub Docs:
9+
# > For workflows that are triggered by the pull_request_target event, the GITHUB_TOKEN is granted
10+
# > read/write repository permission unless the permissions key is specified and the workflow can access secrets,
11+
# > even when it is triggered from a fork.
12+
# >
13+
# > Although the workflow runs in the context of the base of the pull request,
14+
# > you should make sure that you do not check out, build, or run untrusted code from the pull request with this event.
15+
#
16+
# Source: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target
17+
#
18+
# See also: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
319
pull_request:
420
types: [opened, reopened, ready_for_review]
521

@@ -11,6 +27,10 @@ jobs:
1127
runs-on: ubuntu-latest
1228
if: ${{ github.event.pull_request.draft != true }}
1329
steps:
30+
# Important security note: As discussed above, do NOT use `actions/checkout`
31+
# or any other method for checking out the pull request's source code.
32+
# This is because the pull request's source code is untrusted, but the
33+
# GITHUB_TOKEN has write permissions (because of the `on: pull_request_target` event).
1434
- name: Add Assignee
1535
uses: actions/github-script@v7
1636
with:

0 commit comments

Comments
 (0)