Skip to content

CI and release workflows: read-only token scope and pinned third-party code - #138

Open
serhii73 wants to merge 1 commit into
masterfrom
fix/ci-least-privilege-and-pinned-actions
Open

serhii73 wants to merge 1 commit into
masterfrom
fix/ci-least-privilege-and-pinned-actions

Conversation

@serhii73

Copy link
Copy Markdown
Collaborator

Changes to .github/workflows/main.yml and .pre-commit-config.yaml:

  • A top-level permissions: contents: read replaces the default token scope for every job.
  • Both actions/checkout steps run with persist-credentials: false, so the job token is not left in .git/config for the steps that run tox and pre-commit.
  • The third-party actions in main.yml and the ruff-pre-commit hook are pinned to commit SHAs. The version tags stay as comments. The SHAs were resolved from the tags with git ls-remote: actions/checkout v3, actions/setup-python v4, codecov/codecov-action v3, pre-commit/action v3.0.0, and astral-sh/ruff-pre-commit v0.16.10.

Not included:

Checked locally: both YAML files parse, pre-commit validate-config passes, and the pinned SHAs match the tags they replace.

🤖 Generated with Claude Code

- Declare a top-level `permissions: contents: read` in main.yml.
- Set `persist-credentials: false` on the checkout steps, so the job
  token is not left in .git/config for the steps that run tox and
  pre-commit.
- Pin the actions in main.yml and the ruff-pre-commit hook to commit
  SHAs. The version tags stay as comments.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
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