Skip to content

Add explicit GITHUB_TOKEN permissions to workflow caller jobs - #105

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

Add explicit GITHUB_TOKEN permissions to workflow caller jobs#105
dduugg merged 1 commit into
mainfrom
fix-code-scanning-alerts

Conversation

@dduugg

@dduugg dduugg commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

CodeQL's actions/missing-workflow-permissions flagged the three
reusable-workflow caller jobs that had no effective permissions block
(cd.yml, triage.yml, stale.yml). ci.yml and codeql.yml already declare
theirs. A caller's permissions become the ceiling for the called
workflow, so each grant covers what shared-config actually does:

  • cd.yml: contents: write — shared-config/cd.yml checks out with
    persisted credentials and runs discourse/publish-rubygems-action,
    which does rake release (a raw git push of the version tag), then
    gh release create.
  • triage.yml: issues: write — shared-config/triage.yml runs
    gh issue edit --add-label triage; its own job already declares
    issues: write.
  • stale.yml: issues: write + pull-requests: write — actions/stale
    comments on and closes both stale issues and stale PRs.

Style follows the query_packwerk precedent: job-level permissions
immediately above uses:.

Alerts resolved

  • #5 actions/missing-workflow-permissions (medium) — .github/workflows/cd.yml:11
  • #3 actions/missing-workflow-permissions (medium) — .github/workflows/triage.yml:9
  • #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.

CodeQL's actions/missing-workflow-permissions flagged the three
reusable-workflow caller jobs that had no effective permissions block
(cd.yml, triage.yml, stale.yml). ci.yml and codeql.yml already declare
theirs. A caller's permissions become the ceiling for the called
workflow, so each grant covers what shared-config actually does:

- cd.yml: contents: write — shared-config/cd.yml checks out with
  persisted credentials and runs discourse/publish-rubygems-action,
  which does `rake release` (a raw git push of the version tag), then
  `gh release create`.
- triage.yml: issues: write — shared-config/triage.yml runs
  `gh issue edit --add-label triage`; its own job already declares
  issues: write.
- stale.yml: issues: write + pull-requests: write — actions/stale
  comments on and closes both stale issues and stale PRs.

Style follows the query_packwerk precedent: job-level permissions
immediately above `uses:`.
@dduugg
dduugg requested a review from a team as a code owner August 17, 2026 19:34
@github-project-automation github-project-automation Bot moved this to Triage in Modularity Aug 17, 2026
@dduugg
dduugg merged commit 6ce82bc into main Aug 17, 2026
11 checks passed
@dduugg
dduugg deleted the fix-code-scanning-alerts branch August 17, 2026 19:41
@github-project-automation github-project-automation Bot moved this from Triage to Done in Modularity Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant