Add explicit GITHUB_TOKEN permissions to workflows - #83
Merged
Conversation
Resolves the seven open CodeQL actions/missing-workflow-permissions alerts (#1, #3, #4, #5, #6, #7, #8) by declaring the least privilege each job actually needs. ci.yml: one workflow-level `contents: read` covers run_tests, static_type_check and run_linter -- each only checks out the repo and runs rspec / srb tc / rubocop. notify_on_failure gets a job-level `permissions: {}`: it never checks out and posts to Slack through an incoming webhook secret, so it needs no GitHub token scopes at all. cd.yml: `contents: write` -- shared-config's cd.yml checks out with persisted credentials, runs publish-rubygems-action (rake release does a raw git push of the version tag) and then `gh release create`. stale.yml: `issues: write` + `pull-requests: write` -- actions/stale comments on and closes both stale issues and stale PRs. triage.yml: `issues: write` -- the called workflow runs `gh issue edit --add-label triage`. A caller's permissions block is the ceiling for the reusable workflow it calls, so these grants match what shared-config needs rather than being clamped to read-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves the seven open CodeQL actions/missing-workflow-permissions
alerts (#1, #3, #4, #5, #6, #7, #8) by declaring the least privilege
each job actually needs.
ci.yml: one workflow-level
contents: readcovers run_tests,static_type_check and run_linter -- each only checks out the repo and
runs rspec / srb tc / rubocop. notify_on_failure gets a job-level
permissions: {}: it never checks out and posts to Slack through anincoming webhook secret, so it needs no GitHub token scopes at all.
cd.yml:
contents: write-- shared-config's cd.yml checks out withpersisted credentials, runs publish-rubygems-action (rake release does a
raw git push of the version tag) and then
gh release create.stale.yml:
issues: write+pull-requests: write-- actions/stalecomments on and closes both stale issues and stale PRs.
triage.yml:
issues: write-- the called workflow runsgh issue edit --add-label triage.A caller's permissions block is the ceiling for the reusable workflow it
calls, so these grants match what shared-config needs rather than being
clamped to read-only.
Alerts resolved
actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:11actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:55actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:43actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:31actions/missing-workflow-permissions(medium) —.github/workflows/cd.yml:11actions/missing-workflow-permissions(medium) —.github/workflows/triage.yml:9actions/missing-workflow-permissions(medium) —.github/workflows/stale.yml:8Verification
permissions:block (cross-checked by parsing the YAML against the alert list).actionlintoutput is byte-identical tomain— no new findings introduced.codeql.ymluntouched.