Skip to content

ci: pin all GitHub Actions to full-length commit SHAs#2122

Merged
iMicknl merged 1 commit into
mainfrom
ci/pin-actions-to-sha
Jun 4, 2026
Merged

ci: pin all GitHub Actions to full-length commit SHAs#2122
iMicknl merged 1 commit into
mainfrom
ci/pin-actions-to-sha

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Jun 4, 2026

Pin every action reference across all 8 workflow files to an immutable 40-char commit SHA, each with a trailing `# vX.Y.Z` comment.

Why

A tag like `@v6` is a mutable pointer — whoever controls the action's repo can re-point it at malicious code, which every run then picks up silently. Pinning to a full SHA makes the reference immutable (GitHub / OpenSSF Scorecard hardening recommendation). Highest blast radius here: `pypa/gh-action-pypi-publish` (PyPI trusted publishing) and `peter-evans/create-pull-request` (write-token PR creation).

Notes

  • SHAs resolved from the live GitHub API (annotated tags dereferenced to their commits); version comments cross-checked against the exact tag at each SHA.
  • `pypa/gh-action-pypi-publish` moved from the `release/v1` branch to a pinned SHA.
  • Dependabot keeps both the SHA and the version comment up to date — no loss of update automation; the `uv` `lockfile-only` strategy is unaffected (it lives only in the uv ecosystem block).

Follow-up

After merge, enable the repo setting "Require actions to be pinned to a full-length commit SHA" to prevent any future unpinned ref from being reintroduced. (Enabling it before merge would break CI, since it rejects tag/branch refs.)

Pin every action reference to an immutable 40-char commit SHA with a
trailing version comment, hardening against supply-chain attacks via
mutable tags. Dependabot keeps both the SHA and comment up to date.
Copilot AI review requested due to automatic review settings June 4, 2026 19:45
@iMicknl iMicknl requested a review from tetienne as a code owner June 4, 2026 19:45
@github-actions github-actions Bot added the ci Continuous Integration label Jun 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the repository’s GitHub Actions supply chain by replacing all tag/branch-based uses: references in workflows with immutable 40-character commit SHAs, annotated with the corresponding action version comment. This aligns with GitHub/OpenSSF recommendations and reduces the risk of upstream tag/branch retargeting.

Changes:

  • Pinned all uses: action references across workflows to full-length commit SHAs with trailing # vX.Y.Z comments.
  • Replaced pypa/gh-action-pypi-publish@release/v1 with a pinned SHA (keeping trusted publishing semantics while removing the mutable ref).
  • Ensured no remaining @v* or @main action references exist in .github/workflows/* (verified), and spot-verified tags resolve to the pinned SHAs for the updated actions.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/workflows/test.yml Pins checkout/setup-python/setup-uv actions to immutable SHAs.
.github/workflows/release.yml Pins workflow actions and replaces PyPI publish action branch ref with a SHA.
.github/workflows/release-drafter.yml Pins release-drafter action to a SHA with version comment.
.github/workflows/pr-labeler.yml Pins PR labeler action to a SHA with version comment.
.github/workflows/lint.yaml Pins checkout/setup-python/setup-uv actions to immutable SHAs.
.github/workflows/generate-enums.yml Pins actions including create-pull-request to an immutable SHA.
.github/workflows/docs.yml Pins workflow actions including Pages upload/deploy actions to SHAs.
.github/workflows/codeql.yml Pins checkout and CodeQL init/analyze actions to SHAs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iMicknl iMicknl merged commit 6a976d8 into main Jun 4, 2026
11 checks passed
@iMicknl iMicknl deleted the ci/pin-actions-to-sha branch June 4, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants