Add explicit GITHUB_TOKEN permissions to workflows - #34
Merged
Conversation
Resolves the CodeQL actions/missing-workflow-permissions alerts (#1, #2, #4, #5, #6) by giving every job an effective permissions block. - ci.yml: workflow-level `contents: read`. Both jobs are covered by it. test_and_lint only checks out the repo, installs Ruby and runs `bundle exec rake`; notify_on_failure only posts to a Slack incoming webhook and needs no token scope at all, so the inherited read grant is already more than it uses. - cd.yml: `contents: write` on the caller job. shared-config's cd.yml runs discourse/publish-rubygems-action (`rake release`, which does a raw `git push` of the version tag) and then `gh release create`. Anything less breaks the gem release. - stale.yml: `issues: write` + `pull-requests: write`. shared-config's stale.yml runs actions/stale, which comments on and closes both stale issues and stale PRs. - triage.yml: `issues: write`. shared-config's triage.yml runs `gh issue edit --add-label triage`, and its own job already declares the same scope. Caller permissions are the ceiling for a reusable workflow, so each caller grants exactly what the called workflow declares/needs and nothing more. codeql.yml already had a correct block and is untouched.
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 CodeQL actions/missing-workflow-permissions alerts (#1, #2,
#4, #5, #6) by giving every job an effective permissions block.
contents: read. Both jobs are covered by it.test_and_lint only checks out the repo, installs Ruby and runs
bundle exec rake; notify_on_failure only posts to a Slack incomingwebhook and needs no token scope at all, so the inherited read grant
is already more than it uses.
contents: writeon the caller job. shared-config's cd.ymlruns discourse/publish-rubygems-action (
rake release, which does araw
git pushof the version tag) and thengh release create.Anything less breaks the gem release.
issues: write+pull-requests: write. shared-config'sstale.yml runs actions/stale, which comments on and closes both stale
issues and stale PRs.
issues: write. shared-config's triage.yml runsgh issue edit --add-label triage, and its own job already declaresthe same scope.
Caller permissions are the ceiling for a reusable workflow, so each
caller grants exactly what the called workflow declares/needs and
nothing more. codeql.yml already had a correct block and is untouched.
Alerts resolved
actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:11actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:41actions/missing-workflow-permissions(medium) —.github/workflows/triage.yml:9actions/missing-workflow-permissions(medium) —.github/workflows/cd.yml:11actions/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.