Skip to content

fix(ci): restrict GITHUB_TOKEN to contents: read - #36

Merged
iap merged 2 commits into
masterfrom
fix/ci-workflow-permissions
Aug 26, 2026
Merged

fix(ci): restrict GITHUB_TOKEN to contents: read#36
iap merged 2 commits into
masterfrom
fix/ci-workflow-permissions

Conversation

@iap

@iap iap commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes the one open code-scanning alert on master: actions/missing-workflow-permissions (medium, .github/workflows/ci.yml:11-27).

  • The workflow declared no permissions: block, so the job inherited the repository default. CodeQL flags this because the default is a repo-level setting, not a property of the workflow — and repositories created before February 2023, or under organizations with read-write defaults, grant the job far more than it needs.
  • Added a workflow-level permissions: contents: read.

Scope check against the steps present: actions/checkout needs contents: read; actions/setup-node and the npm ci / npm test steps need no token scope. Nothing in this workflow requires write.

This matters more than usual here because the repository is a template — the workflow is copied into every repo generated from it, where the inherited default may differ.

Test plan

  • CI passes (checkout still succeeds under the reduced scope)
  • CodeQL passes
  • Alert Create .mailmap #1 closes once this lands on master

iap added 2 commits August 27, 2026 02:02
The workflow declared no permissions block, so the job inherited the
repository default. That default is a repo-level setting rather than a
property of the workflow, and repos created from this template may carry
read-write defaults.

checkout needs contents: read; setup-node and the npm steps need no
token scope, so nothing requires write.
@iap
iap merged this pull request into master Aug 26, 2026
4 checks passed
@iap
iap deleted the fix/ci-workflow-permissions branch August 26, 2026 19:53
iap added a commit that referenced this pull request Aug 26, 2026
The workflow declared no permissions block, so the job inherited the
repository default. That default is a repo-level setting rather than a
property of the workflow, and repos created from this template may carry
read-write defaults.

checkout needs contents: read; setup-node and the npm steps need no
token scope, so nothing requires write.
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