chore(ci): give every workflow job explicit permissions - #193
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the three open
actions/missing-workflow-permissionscode-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:test.yml→testcontents: readcreate-release.yml→create-releasecontents: writemainand the release branchcreate-release.yml→create-summarycontents: read$GITHUB_STEP_SUMMARYand nothing elseI read
create-releasebefore scoping it: it doesgit push origin mainandgit push origin "$BRANCH_NAME", and makes nogh pr/gh release/gh apicalls, socontentsis genuinely all it needs — nopull-requests:or wider scope required.Deliberately untouched
publish.ymlalready declarescontents: read+id-token: writefor PyPI trusted publishing, which is why it was never flagged. Narrowing it would break the publish, so it is left exactly as-is.create-taglikewise already hadcontents: write.Validation
just test-allgreen — 526 passed / 17 skipped, ruff, basedpyright 0/0. Both workflow files parse as YAML and every job now resolves to an explicitpermissionsmap.