Skip to content

ci: declare minimum permissions on stale-issues workflow#4065

Open
arpitjain099 wants to merge 2 commits into
redis:masterfrom
arpitjain099:chore/declare-stale-perms
Open

ci: declare minimum permissions on stale-issues workflow#4065
arpitjain099 wants to merge 2 commits into
redis:masterfrom
arpitjain099:chore/declare-stale-perms

Conversation

@arpitjain099
Copy link
Copy Markdown

@arpitjain099 arpitjain099 commented May 14, 2026

Pins .github/workflows/stale-issues.yml to the minimum scopes actions/stale@v10 actually uses: issues: write and pull-requests: write. The workflow runs two passes of actions/stale, one for the default 365-day timeline and one for needs-information issues on a 30-day accelerated path. Both passes only touch labels, comments, and close-state on issues and PRs - neither needs contents access at all.

CVE-2025-30066 (the March 2025 tj-actions/changed-files supply-chain attack) is the motivation: a tampered third-party action exfiltrated GITHUB_TOKEN from workflow logs and the blast radius equalled whatever scope was issued. Today this workflow inherits the org-default token scope, so if that default is anything broader than issues+pull-requests: write the daily cron is silently handing more authority to actions/stale than the action needs. Pinning at the actual minimum closes that gap, gives drift protection, and registers with OpenSSF Scorecard's Token-Permissions check.

YAML validated locally with yaml.safe_load.


Note

Low Risk
Low risk configuration change, but could affect the scheduled stale automation if the declared token permissions are insufficient or too restrictive.

Overview
Adds an explicit permissions block to .github/workflows/stale-issues.yml to scope the GITHUB_TOKEN for actions/stale@v10 runs (issues/PR write, plus actions write) instead of relying on repository/org defaults.

This reduces the workflow’s token blast radius for the scheduled stale issue/PR labeling and closing automation without changing the stale policy logic itself.

Reviewed by Cursor Bugbot for commit 3703d24. Bugbot is set up for automated code reviews on this repo. Configure here.

@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented May 14, 2026

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

Comment thread .github/workflows/stale-issues.yml
@petyaslavova
Copy link
Copy Markdown
Collaborator

Hey @arpitjain099, thank you for your contribution! Can you please apply the suggested change and it will be ready for merging :)

Per Cursor Bugbot's catch and @petyaslavova's confirmation: actions/stale@v10
saves state to the Actions cache when operations-per-run is hit and may
need to delete conflicting entries, which requires actions: write.
Without it the action 403s on cache lifecycle ('Resource not accessible
by integration') and can permanently skip previously processed issues.

Signed-off-by: Arpit Jain <[email protected]>
@arpitjain099
Copy link
Copy Markdown
Author

Thanks @petyaslavova, applied. Added actions: write to the permissions block per the Bugbot suggestion. The reasoning makes sense: actions/stale@v10 reaches into the Actions cache for state tracking once operations-per-run is hit, and without the scope it would 403 on cache writes and silently skip issues across runs.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 3703d24. Configure here.

permissions:
issues: write
pull-requests: write
actions: write
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overly broad actions: write undermines minimum-permission goal

Medium Severity

The actions: write permission grants the ability to cancel, re-run, and delete workflow runs — not just manage caches. This contradicts the PR's explicit goal of minimizing blast radius against supply-chain attacks (CVE-2025-30066). A compromised actions/stale with this scope could disrupt CI/CD by canceling runs or destroy audit trails by deleting them. This is a known concern tracked in actions/stale#1159. The PR description itself states the minimum scopes are only issues: write and pull-requests: write.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3703d24. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants