Skip to content

Limit GitHub Actions token permissions#2167

Closed
xsourabhsharma wants to merge 1 commit into
pallets:mainfrom
xsourabhsharma:codex/gha-token-permissions
Closed

Limit GitHub Actions token permissions#2167
xsourabhsharma wants to merge 1 commit into
pallets:mainfrom
xsourabhsharma:codex/gha-token-permissions

Conversation

@xsourabhsharma

Copy link
Copy Markdown

This limits the default GITHUB_TOKEN permissions for CI workflows that only need to read repository contents.

  • Add contents: read to the tests and pre-commit workflows.
  • Add contents: read to the publish workflow's build job, while preserving the existing release and PyPI job permissions.

This follows the principle of least privilege for GitHub Actions and reduces the impact if an action or job step is compromised.

Verification:

  • uv run --locked --group pre-commit pre-commit run --files .github/workflows/tests.yaml .github/workflows/pre-commit.yaml .github/workflows/publish.yaml
  • git diff --check

@ThiefMaster

Copy link
Copy Markdown
Member

We already configured this on the GH org level, so the default permissions are read-only

@xsourabhsharma

Copy link
Copy Markdown
Author

okay

@xsourabhsharma xsourabhsharma deleted the codex/gha-token-permissions branch May 11, 2026 16:47
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants