Skip to content

security: pin GitHub Actions to immutable commit SHAs#2

Open
gabehamilton wants to merge 1 commit intojuxt:mainfrom
gabehamilton:fix/med3-pin-github-actions-shas
Open

security: pin GitHub Actions to immutable commit SHAs#2
gabehamilton wants to merge 1 commit intojuxt:mainfrom
gabehamilton:fix/med3-pin-github-actions-shas

Conversation

@gabehamilton
Copy link

@gabehamilton gabehamilton commented Mar 5, 2026

Summary

  • The publish workflow (.github/workflows/publish.yml) references GitHub Actions using floating tags (@v4, @v5, @release/v1) that can be silently moved to point to different commits
  • This workflow publishes binary wheels to PyPI -- a compromised action could inject malicious code into published packages, affecting all downstream users
  • This PR replaces all floating tag references with immutable commit SHAs, preventing supply chain attacks via tag manipulation
  • Original tag names are preserved as inline comments for human readability and to simplify future version upgrades

Actions pinned

Action Old ref New SHA Version
actions/checkout @v4 34e114876b0b11c390a56381ad16ebd13914f8d5 v4.3.1
actions/setup-go @v5 40f1582b2485089dde7abd97c1529aa768e1baff v5.6.0
astral-sh/setup-uv @v4 38f3f104447c67c051c4a08e39b64a148898af3a v4.2.0
actions/upload-artifact @v4 ea165f8d65b6e75b540449e92b4886f43607fa02 v4.6.2
actions/download-artifact @v4 d3f86a106a0bac45b974a628896c90dbdf5c8093 v4.3.0
pypa/gh-action-pypi-publish @release/v1 ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e release/v1 branch head

Why this matters

GitHub Actions tags are mutable references. A compromised maintainer account or a supply chain attack on any of these action repositories could move a tag to point to malicious code. Since this workflow publishes to PyPI, the blast radius of such an attack would extend to every user who installs the package.

Pinning to commit SHAs ensures the exact code that runs in CI is the code that was reviewed and trusted at pin time.

Test plan

  • Verify workflow YAML is syntactically valid
  • Confirm all SHAs resolve to the expected commits via gh api repos/<owner>/<repo>/commits/<sha>
  • Next release triggers the workflow successfully with pinned SHAs

🤖 Generated with Claude Code

Replace floating tag references (e.g. @v4) with immutable commit SHAs
in the release workflow. Floating tags can be silently moved to point
to different (potentially malicious) commits, enabling a supply chain
attack that publishes tampered binaries to PyPI.

Tag names are preserved as comments for human readability.
Update SHAs deliberately when upgrading action versions.

Actions pinned:
- actions/checkout@v4 -> 34e1148 (v4.3.1)
- actions/setup-go@v5 -> 40f1582 (v5.6.0)
- astral-sh/setup-uv@v4 -> 38f3f10 (v4.2.0)
- actions/upload-artifact@v4 -> ea165f8 (v4.6.2)
- actions/download-artifact@v4 -> d3f86a1 (v4.3.0)
- pypa/gh-action-pypi-publish@release/v1 -> ed0c539

Co-Authored-By: Claude Sonnet 4.6 <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