ci: set least-privilege token permissions on CI workflow#24
Merged
Conversation
The CI workflow had no top-level `permissions:` block, so its GITHUB_TOKEN inherited the broad repository-default scopes. The test job only checks out the repo and runs the suite, so it needs `contents: read` and nothing more. Pinning the scope clears the OpenSSF Scorecard "Token-Permissions" finding. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Add a top-level
permissions:block to.github/workflows/ci.ymlscoping the workflowGITHUB_TOKENtocontents: read.Why
The CI workflow had no
permissions:block, so it inherited the broad repository-default token scopes. Thetestjob only checks out the repo and runspytest+pre-commit— it needs read access and nothing else. Explicitly scoping the token follows least-privilege and clears the OpenSSF Scorecard Token-Permissions code-scanning finding (TokenPermissionsID, ci.yml).Scope
One concern, one file, six added lines. No logic, test, or job changes.
Not addressed here (deliberately)
The three CodeQL
note-level findings are all false positives and are not code bugs:py/unused-importx2 —import nemesis.detectorsineval.py/__main__.pyare load-bearing side-effect imports (they trigger detector registration; already marked# noqa: F401).py/ineffectual-statement— the...ellipsis in theDetectorProtocol stub.These should be dismissed in the code-scanning UI as "won't fix / false positive", not patched.
🤖 Generated with Claude Code