Skip to content

ci: pin GitHub Actions to full commit SHAs#1014

Merged
mergify[bot] merged 1 commit intopython-wheel-build:mainfrom
mprpic:pin-github-actions-shas
Apr 2, 2026
Merged

ci: pin GitHub Actions to full commit SHAs#1014
mergify[bot] merged 1 commit intopython-wheel-build:mainfrom
mprpic:pin-github-actions-shas

Conversation

@mprpic
Copy link
Copy Markdown
Contributor

@mprpic mprpic commented Apr 2, 2026

Pull Request Description

What

Pins all third-party GitHub Actions to their full commit SHAs instead of mutable tags to prevent supply chain attacks via tag manipulation. The original tag/branch is preserved as an inline comment for readability.

Dependabot is already configured to propose update to these actions any time a new version is released.

See also #1008.

Why

https://www.stepsecurity.io/blog/pinning-github-actions-for-enhanced-security-a-complete-guide

Pins all third-party GitHub Actions to their full commit SHAs instead of
mutable tags to prevent supply chain attacks via tag manipulation. The
original tag/branch is preserved as an inline comment for readability.

Dependabot is already configured to propose update to these actions any
time a new version is released.

See also python-wheel-build#1008.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Martin Prpič <mprpic@redhat.com>
@mprpic mprpic requested a review from a team as a code owner April 2, 2026 01:05
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

This pull request pins external GitHub Actions to specific commit SHAs across three CI/CD workflow files. The .github/workflows/check.yaml file pins actions/checkout and actions/setup-python to fixed commits; .github/workflows/python-publish.yaml pins three actions (checkout, setup-python, and gh-action-pypi-publish); and .github/workflows/test.yaml pins five actions (checkout, setup-python, actions-rs/toolchain, upload-artifact, and download-artifact). All workflow logic, conditions, parameters, and commands remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: pinning GitHub Actions to full commit SHAs across multiple workflow files.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the security rationale for pinning GitHub Actions to commit SHAs and referencing relevant documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify bot added the ci label Apr 2, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/check.yaml:
- Around line 14-19: The workflow currently relies on default token permissions;
update each job to declare explicit minimal read-only permissions by adding a
permissions block (e.g., permissions: contents: read, id-token: write only if
needed) to every job that uses the actions referenced (look for the steps with
uses: actions/checkout@de0fac2e... and uses: actions/setup-python@a309ff8b...),
and repeat the same change for the other jobs highlighted (around the other
occurrences). Ensure you set only the required scopes (typically contents: read
and any specific additional scopes) and remove reliance on implicit default
permissions.

In @.github/workflows/test.yaml:
- Around line 28-31: Add explicit least-privilege permissions blocks to each
GitHub Actions job (e.g., the unit, e2e, and coverage jobs) so they no longer
inherit repository defaults; update the workflow (.github/workflows/test.yaml)
by inserting a permissions mapping under each job definition (unit, e2e,
coverage and any other jobs around the same area) that declares only the
required scopes (for example read-only for contents, packages, checks, and no
write tokens unless explicitly needed) to lock down access even if repo defaults
change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b4952ed9-c9b5-4440-a23d-a4033d086889

📥 Commits

Reviewing files that changed from the base of the PR and between 2cf0e7d and 940b112.

📒 Files selected for processing (3)
  • .github/workflows/check.yaml
  • .github/workflows/python-publish.yaml
  • .github/workflows/test.yaml

Comment thread .github/workflows/check.yaml
Comment thread .github/workflows/test.yaml
@mergify mergify bot merged commit 3072a0c into python-wheel-build:main Apr 2, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants