Skip to content

Add explicit GITHUB_TOKEN permissions to workflows - #37

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

Add explicit GITHUB_TOKEN permissions to workflows#37
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 six open actions/missing-workflow-permissions CodeQL alerts
(#1, #2, #4, #5, #6, #7) by giving every job an explicit, least-privilege
permissions block.

  • ci.yml: one workflow-level contents: read. All three jobs (rspec,
    static_type_check, notify_on_failure) only check out the repo and run
    rspec / srb tc; the Slack notifier posts to an incoming webhook and needs
    no GitHub API scope at all, so read is the floor that covers the file.
  • cd.yml: contents: write on the caller job. shared-config's cd.yml runs
    discourse/publish-rubygems-action, which does a raw git push of the
    release tag, and then gh release create — both need write. Caller
    permissions are the ceiling for a reusable workflow, so anything less
    would break releases.
  • 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 (its own job already declares
    issues: write; the caller must grant at least that).

codeql.yml already declares its permissions and is untouched.

Alerts resolved

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

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 six open `actions/missing-workflow-permissions` CodeQL alerts
(#1, #2, #4, #5, #6, #7) by giving every job an explicit, least-privilege
permissions block.

- ci.yml: one workflow-level `contents: read`. All three jobs (rspec,
  static_type_check, notify_on_failure) only check out the repo and run
  rspec / srb tc; the Slack notifier posts to an incoming webhook and needs
  no GitHub API scope at all, so read is the floor that covers the file.
- cd.yml: `contents: write` on the caller job. shared-config's cd.yml runs
  discourse/publish-rubygems-action, which does a raw `git push` of the
  release tag, and then `gh release create` — both need write. Caller
  permissions are the ceiling for a reusable workflow, so anything less
  would break releases.
- 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` (its own job already declares
  `issues: write`; the caller must grant at least that).

codeql.yml already declares its permissions and is untouched.
@dduugg
dduugg requested a review from a team as a code owner August 17, 2026 19:34
@dduugg
dduugg merged commit 80d8f34 into main Aug 17, 2026
8 checks passed
@dduugg
dduugg deleted the fix-code-scanning-alerts branch August 17, 2026 19:40
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