Skip to content

ci: pin GitHub Actions to commit SHAs (#5br) - #525

Merged
danieljohnmorris merged 1 commit into
mainfrom
fix/pin-actions-shas
May 21, 2026
Merged

ci: pin GitHub Actions to commit SHAs (#5br)#525
danieljohnmorris merged 1 commit into
mainfrom
fix/pin-actions-shas

Conversation

@danieljohnmorris

Copy link
Copy Markdown
Collaborator

Summary

Every uses: foo/bar@vN reference across the three workflow files is now pinned to a full 40-char commit SHA, with the original tag preserved as a trailing # vN comment. Borrowed from Zero's rocicorp/mono#5998.

Why

GitHub tags are mutable. A compromised maintainer account, a leaked publish token, or a typo-squatted action can silently re-point v4 at malicious code, and our CI would pick it up on the next run with no visible diff. SHAs are immutable: pinning means an attacker who overwrites the tag can't change what our workflows actually execute. The cost is small (lose automatic minor-version updates) and dependabot covers the maintenance gap.

If you have dependabot enabled on the repo, add a .github/dependabot.yml config for package-ecosystem: github-actions so it opens PRs whenever a pinned action publishes a new SHA under its tag. That keeps us patched without giving the supply chain a free hand.

What's in the diff

  • .github/workflows/rust.yml - pinned actions/checkout@v5, actions/setup-python@v5, taiki-e/install-action@v2, codecov/codecov-action@v6
  • .github/workflows/release.yml - pinned actions/checkout@v4, dtolnay/rust-toolchain@stable, actions/upload-artifact@v4, actions/download-artifact@v4, actions/setup-node@v4, softprops/action-gh-release@v2, gitleaks/gitleaks-action@v2
  • .github/workflows/sync-next.yml - pinned actions/checkout@v4, peter-evans/create-pull-request@v6

12 unique action references resolved via gh api repos/<owner>/<repo>/git/refs/tags/<tag> (annotated tags followed to their target commit). YAML re-parses cleanly.

Test plan

  • Rust / lint workflow passes (uses the new pinned actions/checkout@93cb6e..., actions/setup-python@a26af6...)
  • Rust / skill-validate passes
  • Rust / build passes (taiki-e/install-action@65851e..., codecov/codecov-action@e79a69...)
  • Rust / coverage passes
  • Release workflow not exercised here; will be exercised on next tag push

Follow-ups

  • Add .github/dependabot.yml with a github-actions ecosystem block so dependabot opens PRs for SHA bumps as new versions land. Tracking separately to keep this PR purely about pinning.

Replace every uses: foo/bar@vN reference with uses: foo/bar@<40-char-sha> # vN
in the three workflow files. This prevents a malicious tag overwrite on any
action (actions/checkout, dtolnay/rust-toolchain, codecov/codecov-action,
gitleaks/gitleaks-action, etc.) from silently injecting code into our CI.

Tag comments preserved so reviewers and dependabot can still see the
intended major version at a glance.
@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@danieljohnmorris
danieljohnmorris merged commit bc1a404 into main May 21, 2026
5 checks passed
@danieljohnmorris
danieljohnmorris deleted the fix/pin-actions-shas branch May 21, 2026 10:02
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