Skip to content

Commit a503585

Browse files
committed
ci:harden workflow checkout for pull_request_target safety
Signed-off-by: Parv Ninama <ninamaparv@gmail.com>
1 parent c9602cc commit a503585

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.github/scripts/shared/core/eligibility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function getNextLevelInfo(currentLevelKey) {
167167
* observed completed count === requiredCount
168168
*
169169
* Uses a capped query (requiredCount + 1) for efficiency.
170-
*
170+
*
171171
* @param {import('@actions/github').GitHub} github
172172
* @param {object} homeRepo
173173
* @param {string} username

.github/workflows/bot-next-issue-recommendation.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ jobs:
2525
with:
2626
egress-policy: audit
2727

28-
- name: Checkout repository
28+
# pull_request_target runs with privileged context.
29+
# Explicitly checkout trusted base repository code only
30+
- name: Checkout trusted base repository
2931
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
32+
with:
33+
persist-credentials: false
34+
ref: ${{ github.event.repository.default_branch }}
3035

3136
- name: Recommend next issue
3237
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 #v9.0.0

0 commit comments

Comments
 (0)