Skip to content

Add explicit GITHUB_TOKEN permissions to workflows - #47

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

Add explicit GITHUB_TOKEN permissions to workflows#47
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 four open actions/missing-workflow-permissions CodeQL
alerts. Each scope is the least privilege the job actually needs:

  • build.yml (chore(deps): bump terser from 5.13.1 to 5.14.2 #5): workflow-level contents: read. The single build
    job only checks out, restores an actions/cache entry, and runs
    npm ci / npm run build:prod / npm test. Neither setup-node nor
    actions/cache needs a token scope beyond reading the repo.
  • publish.yml (Add team Slack CTA #1): workflow-level contents: read. Despite the name,
    this tag-triggered job does not publish anything — it runs
    vsce package and hands the .vsix to actions/upload-artifact.
    Uploading an artifact needs no extra scope, there is no
    vsce publish, no gh release create, and no npm publish, so no
    write scope is warranted. The Marketplace release is done off the
    artifact, not by this token.
  • stale.yml (Prepare for publishing #2): job-level issues: write + pull-requests: write.
    The shared-config stale workflow runs actions/stale, which comments
    on and closes both stale issues and stale PRs. A caller's permissions
    are the ceiling for the reusable workflow, so both scopes must be
    granted here or the nightly cron silently stops closing things.
  • triage.yml (Fix last reference to bigrails #4): job-level issues: write. The shared-config triage
    workflow only runs gh issue edit --add-label triage.

Callers use job-level blocks immediately above uses:, matching the
accepted precedent in rubyatscale/query_packwerk. codeql.yml already
declares its permissions and is left untouched.

Alerts resolved

  • #5 actions/missing-workflow-permissions (medium) — .github/workflows/build.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/publish.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 four open `actions/missing-workflow-permissions` CodeQL
alerts. Each scope is the least privilege the job actually needs:

- build.yml (#5): workflow-level `contents: read`. The single `build`
  job only checks out, restores an `actions/cache` entry, and runs
  `npm ci` / `npm run build:prod` / `npm test`. Neither setup-node nor
  actions/cache needs a token scope beyond reading the repo.
- publish.yml (#1): workflow-level `contents: read`. Despite the name,
  this tag-triggered job does not publish anything — it runs
  `vsce package` and hands the .vsix to `actions/upload-artifact`.
  Uploading an artifact needs no extra scope, there is no
  `vsce publish`, no `gh release create`, and no `npm publish`, so no
  write scope is warranted. The Marketplace release is done off the
  artifact, not by this token.
- stale.yml (#2): job-level `issues: write` + `pull-requests: write`.
  The shared-config stale workflow runs `actions/stale`, which comments
  on and closes both stale issues and stale PRs. A caller's permissions
  are the ceiling for the reusable workflow, so both scopes must be
  granted here or the nightly cron silently stops closing things.
- triage.yml (#4): job-level `issues: write`. The shared-config triage
  workflow only runs `gh issue edit --add-label triage`.

Callers use job-level blocks immediately above `uses:`, matching the
accepted precedent in rubyatscale/query_packwerk. codeql.yml already
declares its permissions and is left untouched.
@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 f487811 into main Aug 17, 2026
5 checks passed
@dduugg
dduugg deleted the fix-code-scanning-alerts branch August 17, 2026 19:40
@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