Skip to content

Commit edd392f

Browse files
ci: least-privilege permissions on spellcheck (read) and stale-issues (job-level write for actions/stale) (#4080)
* ci: declare workflow-level contents: read on spellcheck and stale-issues Workflow runs checks only; no GitHub API writes. Post-CVE-2025-30066 hardening pattern. Signed-off-by: Arpit Jain <arpitjain099@gmail.com> * Grant stale job issues: write + pull-requests: write The previous workflow-level contents: read default broke actions/stale, which needs issues: write and pull-requests: write to mark and close stale issues/PRs (caught by cursor[bot] review). Adding the writes at the job level instead of the workflow level keeps spellcheck and any future job on least-privilege contents: read. Signed-off-by: Arpit Jain <arpitjain099@gmail.com> * ci(stale-issues): add actions: write for actions/stale cache actions/stale@v10 persists its run state in the Actions cache, which needs actions: write at the job level in addition to issues/pull-requests write. This matches the recommended permissions block in the action's README. Signed-off-by: Arpit Jain <arpitjain099@gmail.com> * Set workflow-level permissions to empty in stale-issues workflow The stale job declares its own permissions block, so the workflow-level contents: read had no effect on its token. This workflow does not read repository contents, so an empty permissions block is the clearest least-privilege default at the workflow level. Signed-off-by: Arpit Jain <arpitjain099@gmail.com> --------- Signed-off-by: Arpit Jain <arpitjain099@gmail.com> Co-authored-by: petyaslavova <petya.slavova@redis.com>
1 parent cdc9270 commit edd392f

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

.github/workflows/spellcheck.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: spellcheck
22
on:
33
pull_request:
4+
permissions:
5+
contents: read
6+
47
jobs:
58
check-spelling:
69
runs-on: ubuntu-latest

.github/workflows/stale-issues.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ env:
1414
NEEDS_INFO_DAYS_BEFORE_STALE: 30
1515
NEEDS_INFO_DAYS_BEFORE_CLOSE: 7
1616

17+
permissions: {}
18+
1719
jobs:
1820
stale:
1921
runs-on: ubuntu-latest
22+
permissions:
23+
issues: write # required by actions/stale to label/close issues
24+
pull-requests: write # required by actions/stale to label/close PRs
25+
actions: write # required by actions/stale@v10 for its cache state
2026
steps:
2127
# First step: Handle regular issues (excluding needs-information)
2228
- name: Mark regular issues as stale

0 commit comments

Comments
 (0)