Skip to content

Commit 671e00b

Browse files
Harden CI workflow: switch to pull_request trigger and remove unnecessary id-token:write (#214)
Addressing two issues in the CI workflow: 1. **`pull_request_target` > `pull_request`**: Fork PRs currently run in the base repo's execution context. Switching to pull_request runs fork PRs in the fork's context, which matches the workflow's declared read-only permissions and is the recommended trigger for CI jobs that don't need write access to the base repo. (Some references: - https://docs.github.com/en/enterprise-cloud@latest/actions/reference/security/secure-use#mitigating-the-risks-of-untrusted-code-checkout - https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ ) 2. **Remove `id-token: write`**: No active job uses OIDC. This permission is a leftover from the commented-out `online-test` job and grants unnecessary token-minting capability. No CI behavior change. All active jobs (`check`, `format`, `offline-test`) only need `contents: read` and `pull-requests: read`, which work identically with `pull_request`.
1 parent 29f68bb commit 671e00b

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: CI
44
on:
55
push:
66
branches: [ "main" ]
7-
pull_request_target:
7+
pull_request:
88
branches: [ "main" ]
99
workflow_dispatch: # manual run
1010

@@ -15,7 +15,6 @@ concurrency:
1515
permissions:
1616
pull-requests: read
1717
contents: read
18-
id-token: write
1918
actions: read
2019

2120
jobs:

0 commit comments

Comments
 (0)