Skip to content

ci: set least-privilege token permissions on CI workflow#24

Merged
LueBangs-coder merged 1 commit into
mainfrom
chore/ci-least-privilege-token
Jun 27, 2026
Merged

ci: set least-privilege token permissions on CI workflow#24
LueBangs-coder merged 1 commit into
mainfrom
chore/ci-least-privilege-token

Conversation

@LueBangs-coder

Copy link
Copy Markdown
Owner

What

Add a top-level permissions: block to .github/workflows/ci.yml scoping the workflow GITHUB_TOKEN to contents: read.

Why

The CI workflow had no permissions: block, so it inherited the broad repository-default token scopes. The test job only checks out the repo and runs pytest + 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-import x2 — import nemesis.detectors in eval.py / __main__.py are load-bearing side-effect imports (they trigger detector registration; already marked # noqa: F401).
  • py/ineffectual-statement — the ... ellipsis in the Detector Protocol stub.

These should be dismissed in the code-scanning UI as "won't fix / false positive", not patched.

🤖 Generated with Claude Code

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>
@LueBangs-coder
LueBangs-coder merged commit 50f63b7 into main Jun 27, 2026
7 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