chore: declare contents: read on code_quality workflow#1480
chore: declare contents: read on code_quality workflow#1480arpitjain099 wants to merge 1 commit into
Conversation
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe pull request adds explicit top-level ChangesWorkflow Permissions Hardening
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: |
There was a problem hiding this comment.
I believe this is already the default so why do we need to explicitly set it here?
There was a problem hiding this comment.
@kevalmorabia97 you're right that the effective scope may already be contents: read on this repo today if the default token scope is set to the restrictive value. The reasons to declare it explicitly anyway:
- It documents the actual scope this workflow needs, so a reviewer does not have to check repo-level token settings to know.
- It survives repo-default changes. If the default is ever flipped back to permissive (the legacy default which grants
contents: writeacross the board), every workflow that did not explicitly cap stays permissive too. - It matches the in-repo convention: 12 of the 13 sibling workflows in
.github/workflows/already declarepermissions:explicitly (bandit.yml,build-docs.yml,ci.yml, etc.); this PR brings the lone remaining one in line.
Defense-in-depth precedent: the tj-actions/changed-files supply-chain attack (CVE-2025-30066, March 2025) showed how an over-scoped GITHUB_TOKEN exfiltrates credentials when a third-party action is compromised. Pinning per workflow caps the blast radius regardless of what the repo default is at any given moment.
Happy to close if you'd prefer to rely on the default.
code_quality.ymlruns lint and code-quality checks. Twelve other workflows already declare permissions; this brings the remaining quality-check workflow in line.Summary by CodeRabbit