Skip to content

ci(security): default the GITHUB_TOKEN to contents: read - #11

Merged
nabheet merged 1 commit into
mainfrom
fix/codeql-alerts
Oct 31, 2026
Merged

nabheet merged 1 commit into
mainfrom
fix/codeql-alerts

Conversation

@nabheet

@nabheet nabheet commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Clears the open CodeQL actions/missing-workflow-permissions alert on the test job by giving the workflow a read-only default token.

Change

  • permissions: contents: read at workflow level.
  • publish and prerelease keep their own job-level blocks (contents/id-token/pull-requests), which replace the workflow default — their access is unchanged.
  • test only checks out, installs and builds, so read-only is sufficient.

Why

The repository default token is read/write, so any job without a permissions: block hands the workflow more authority than it needs. A workflow-level block makes read-only the default for this file and for any job added later.

Verification

  • yq parse: workflow permissions.contents: read; per-job permissions unchanged for publish/prerelease.
  • CI on this PR runs the full test job, which now runs under the read-only token — that is the live check that nothing needed write.

Clears the open CodeQL actions/missing-workflow-permissions alert on the
`test` job. publish and prerelease declare their own job-level permissions
(contents/id-token/pull-requests), which replace this workflow default, so
their access is unchanged; `test` only checks out, installs and builds,
which read-only covers. A new job now inherits read-only instead of the
repository default.
@nabheet
nabheet marked this pull request as ready for review October 31, 2026 04:26
@nabheet
nabheet merged commit 8be50c8 into main Oct 31, 2026
6 checks passed
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