Add explicit GITHUB_TOKEN permissions to workflows - #177
Merged
Conversation
Resolves the 10 open `actions/missing-workflow-permissions` CodeQL alerts (#1, #6-#14) by giving every job an explicit least-privilege scope. ci.yml: one workflow-level `contents: read`. All five jobs (ci-data, rspec, rspec_ruby_version_file, static_type_check, notify_on_failure) only check out the repo and run rake/srb, or post to a Slack incoming webhook — none of them writes anything back to GitHub. cd.yml: one workflow-level `contents: read` covering check-release (sparse checkout + a rubygems.org version probe), ci-data (oxidize-rb/actions/fetch-ci-data), build (checkout, cross-gem, upload-artifact) and notify_on_release (Slack webhook). The `release` job keeps its existing job-level `contents: write` override, which it needs for `gh release create`; job-level permissions replace rather than intersect the workflow-level block for normal jobs, so the release path is unaffected. stale.yml: job-level `issues: write` + `pull-requests: write` on the shared-config caller. A caller's permissions are the ceiling for the called workflow, and shared-config's stale.yml runs actions/stale, which comments on and closes both stale issues and stale PRs.
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 10 open
actions/missing-workflow-permissionsCodeQL alerts(#1, #6-#14) by giving every job an explicit least-privilege scope.
ci.yml: one workflow-level
contents: read. All five jobs (ci-data,rspec, rspec_ruby_version_file, static_type_check, notify_on_failure)
only check out the repo and run rake/srb, or post to a Slack incoming
webhook — none of them writes anything back to GitHub.
cd.yml: one workflow-level
contents: readcovering check-release(sparse checkout + a rubygems.org version probe), ci-data
(oxidize-rb/actions/fetch-ci-data), build (checkout, cross-gem,
upload-artifact) and notify_on_release (Slack webhook). The
releasejob keeps its existing job-level
contents: writeoverride, which itneeds for
gh release create; job-level permissions replace ratherthan intersect the workflow-level block for normal jobs, so the release
path is unaffected.
stale.yml: job-level
issues: write+pull-requests: writeon theshared-config caller. A caller's permissions are the ceiling for the
called workflow, and shared-config's stale.yml runs actions/stale,
which comments on and closes both stale issues and stale PRs.
Alerts resolved
actions/missing-workflow-permissions(medium) —.github/workflows/cd.yml:235actions/missing-workflow-permissions(medium) —.github/workflows/cd.yml:77actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:59actions/missing-workflow-permissions(medium) —.github/workflows/cd.yml:57actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:45actions/missing-workflow-permissions(medium) —.github/workflows/cd.yml:22actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:23actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:11actions/missing-workflow-permissions(medium) —.github/workflows/ci.yml:70actions/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.