Add explicit GITHUB_TOKEN permissions to workflows - #109
Merged
Conversation
Resolves the six open `actions/missing-workflow-permissions` CodeQL alerts (#1, #2, #4, #6, #7, #8) by declaring the least privilege each job needs. - ci.yml: one workflow-level `contents: read` covers all three jobs. `rspec` and `static_type_check` only check out the repo and run rspec / `srb tc`; `notify_on_failure` posts to a Slack incoming webhook and uses no GITHUB_TOKEN scope at all. - cd.yml: `contents: write` on the caller job. The shared-config cd workflow checks out with persisted credentials and runs discourse/publish-rubygems-action (`rake release` does a raw `git push` of the version tag), then `gh release create`. A caller-side grant is the ceiling for the reusable workflow, so anything less breaks the release. - stale.yml: `issues: write` + `pull-requests: write`. actions/stale comments on and closes both stale issues and stale PRs. - triage.yml: `issues: write` for `gh issue edit --add-label triage`. codeql.yml already declares its permissions and is left 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 six open
actions/missing-workflow-permissionsCodeQL alerts(#1, #2, #4, #6, #7, #8) by declaring the least privilege each job needs.
contents: readcovers all three jobs.rspecand
static_type_checkonly check out the repo and run rspec /srb tc;notify_on_failureposts to a Slack incoming webhook and uses noGITHUB_TOKEN scope at all.
contents: writeon the caller job. The shared-config cd workflowchecks out with persisted credentials and runs
discourse/publish-rubygems-action (
rake releasedoes a rawgit pushofthe version tag), then
gh release create. A caller-side grant is theceiling for the reusable workflow, so anything less breaks the release.
issues: write+pull-requests: write. actions/stale commentson and closes both stale issues and stale PRs.
issues: writeforgh issue edit --add-label triage.codeql.yml already declares its permissions and is left untouched.
Alerts resolved
actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:36actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:11actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:48actions/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.