Skip to content

chore(ci): give every workflow job explicit permissions - #193

Merged
jfrench9 merged 1 commit into
mainfrom
chore/harden-workflow-permissions
Aug 22, 2026
Merged

chore(ci): give every workflow job explicit permissions#193
jfrench9 merged 1 commit into
mainfrom
chore/harden-workflow-permissions

Conversation

@jfrench9

Copy link
Copy Markdown
Member

Closes the three open actions/missing-workflow-permissions code-scanning alerts (medium).

What changed

Three jobs ran on the repository's default token scope because they declared no permissions: block. Each now gets only what it actually uses:

Job Permission Why
test.ymltest contents: read checkout, then local tooling only
create-release.ymlcreate-release contents: write pushes the version commit to main and the release branch
create-release.ymlcreate-summary contents: read writes $GITHUB_STEP_SUMMARY and nothing else

I read create-release before scoping it: it does git push origin main and git push origin "$BRANCH_NAME", and makes no gh pr / gh release / gh api calls, so contents is genuinely all it needs — no pull-requests: or wider scope required.

Deliberately untouched

publish.yml already declares contents: read + id-token: write for PyPI trusted publishing, which is why it was never flagged. Narrowing it would break the publish, so it is left exactly as-is. create-tag likewise already had contents: write.

Validation

just test-all green — 526 passed / 17 skipped, ruff, basedpyright 0/0. Both workflow files parse as YAML and every job now resolves to an explicit permissions map.

Three jobs ran on the repository's default token scope because they
declared no `permissions:` block, which code scanning flags as
actions/missing-workflow-permissions. Each now gets only what it uses:

- test: contents: read — checkout, then local tooling only
- create-release: contents: write — pushes the version commit to main
  and the release branch; it makes no gh API calls, so nothing beyond
  contents is needed
- create-summary: contents: read — writes $GITHUB_STEP_SUMMARY and
  nothing else

publish.yml already declared contents: read plus id-token: write for
PyPI trusted publishing and is deliberately untouched — narrowing it
would break the publish.
@jfrench9
jfrench9 merged commit 7c7d4e3 into main Aug 22, 2026
4 checks passed
@jfrench9
jfrench9 deleted the chore/harden-workflow-permissions branch August 22, 2026 02:45
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