Skip to content

Add explicit GITHUB_TOKEN permissions to workflows - #34

Merged
dduugg merged 1 commit into
mainfrom
fix-code-scanning-alerts
Aug 17, 2026
Merged

Add explicit GITHUB_TOKEN permissions to workflows#34
dduugg merged 1 commit into
mainfrom
fix-code-scanning-alerts

Conversation

@dduugg

@dduugg dduugg commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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.

Alerts resolved

  • #6 actions/missing-workflow-permissions (medium) — .github/workflows/ci.yml:11
  • #5 actions/missing-workflow-permissions (medium) — .github/workflows/ci.yml:41
  • #4 actions/missing-workflow-permissions (medium) — .github/workflows/triage.yml:9
  • #2 actions/missing-workflow-permissions (medium) — .github/workflows/cd.yml:11
  • #1 actions/missing-workflow-permissions (medium) — .github/workflows/stale.yml:8

Verification

  • Every job in every flagged workflow now has an effective permissions: block (cross-checked by parsing the YAML against the alert list).
  • actionlint output is byte-identical to main — no new findings introduced.
  • codeql.yml untouched.

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.
@dduugg
dduugg requested a review from a team as a code owner August 17, 2026 19:34
@dduugg
dduugg merged commit 0dc871d into main Aug 17, 2026
7 checks passed
@dduugg
dduugg deleted the fix-code-scanning-alerts branch August 17, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant