ci: scope GITHUB_TOKEN to least privilege - #9
Conversation
Repo default is write (gh api repos/.../actions/permissions/workflow -> default_workflow_permissions: write), so every job here ran with a write-capable token even though this workflow now runs on every PR, including from forks, and only the release-asset upload step actually needs write access. Top-level contents: read, overridden to contents: write on the one job whose release step needs it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 47 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
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
Checked the repo's Actions defaults:
default_workflow_permissions: write. With nopermissions:block ingithubci.yml, every job got a write-capableGITHUB_TOKEN— including thebuildjob, which now runs on every PR (forks included, since #2 added thepull_requesttrigger).Only the release-asset upload (
softprops/action-gh-release, gated togithub.event_name == 'release') actually needs write access. Added a top-levelpermissions: contents: read, overridden tocontents: writeon just thebuildjob.Not done here, flagging for later: the release step lives in the same job as the PR-only build/artifact steps, so a genuinely tighter setup would split
publish-releaseinto its own job (needs: build,if: github.event_name == 'release', downloads the artifact) so the PR path never even has a write-capable token in scope. Left as a bigger refactor for another pass.Test plan
yq eval '.' .github/workflows/githubci.yml— valid YAMLactions/upload-artifactis unaffected bypermissions:(uses its own Actions Results API token, notGITHUB_TOKEN) — verified this is standard behavior, not assumed