Repository navigation
GHA: add explicit "permissions: contents: read" to all read-only workflows - #3357
Conversation
…flows GitHub's default `GITHUB_TOKEN` permissions are wide-open (write to most scopes) unless the workflow explicitly narrows them. Adds a workflow-level `permissions: contents: read` block to all 10 OSHI workflows that only need to clone the repo and run tests / external-service uploads. None of them push to GitHub (no PR comments, no labels, no releases, no security events); third-party uploads (Codecov, Sonar, Coverity, Sonatype) all use their own tokens, not GITHUB_TOKEN. Affects: `benchmarks.yaml`, `cfarm.yaml`, `coverity.yaml`, `linux.yaml`, `macos.yaml`, `pr.yaml`, `sonar.yaml`, `sonatype.yaml`, `unix.yaml`, `windows.yaml`. Unchanged: * `codeql-analysis.yml` — already has per-job permissions block (uses `security-events: write` for the CodeQL upload). * `site.yaml` — already has workflow-level `contents: write` for the gh-pages publish. No behavioural change; tightens the blast radius if a third-party action were ever compromised.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2026-05-31T05:53:04.246ZApplied to files:
🔇 Additional comments (10)
📝 WalkthroughWalkthroughThis PR adds explicit GitHub Actions ChangesGitHub Actions Workflow Permissions
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
GitHub's default
GITHUB_TOKENpermissions are wide-open (write to most scopes) unless a workflow explicitly narrows them. This PR adds a workflow-levelpermissions: contents: readblock to all 10 OSHI workflows that only need to clone the repo and run tests / external-service uploads.None of these workflows push to GitHub (no PR comments, no labels, no releases, no security events). Third-party uploads (Codecov, Sonar, Coverity, Sonatype) all use their own dedicated tokens, not
GITHUB_TOKEN. Socontents: readis the tightest minimum that still lets every job clone the repo.Files changed (10):
benchmarks.yaml,cfarm.yaml,coverity.yaml,linux.yaml,macos.yaml,pr.yaml,sonar.yaml,sonatype.yaml,unix.yaml,windows.yaml.Unchanged (intentionally):
codeql-analysis.yml— already has per-job permissions includingsecurity-events: writefor the CodeQL upload.site.yaml— already has workflow-levelcontents: writefor the gh-pages publish.Why
GitHub treats the default
GITHUB_TOKENgenerously to keep onboarding easy, which means any compromised third-party action could write to the repo even when it didn't need to. Tightening per-workflowpermissions:limits the blast radius. CodeRabbit flagged this on PR #3350's benchmark AIX job — this PR closes the broader gap.Test plan
site.yamlpattern).grepforgh pr/issue/release, PR-commenter actions, label-bot actions, artifact uploads, and release-action uses.Summary by CodeRabbit