Skip to content

Pin release-workflow actions to commit SHAs + least-privilege token#862

Merged
bearsyankees merged 1 commit into
usestrix:mainfrom
timhaines:sha-pin-actions
Jul 23, 2026
Merged

Pin release-workflow actions to commit SHAs + least-privilege token#862
bearsyankees merged 1 commit into
usestrix:mainfrom
timhaines:sha-pin-actions

Conversation

@timhaines

@timhaines timhaines commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Pins every third-party action in the release workflow to a full commit SHA (with the version in a trailing comment), and tightens the workflow's token permissions.

Why: build-release.yml's release job has contents: write and publishes the binaries users install. Every uses: there is a mutable tag (@v2, @v4, …), and tag-hijacking of popular actions keeps happening: aquasecurity/trivy-action had 75 of its 76 tags force-pushed to steal CI credentials (Mar 2026, part of the TeamPCP campaign), following tj-actions/changed-files (2025) and before codfish/semantic-release-action (Jun 2026). In each case, workflows referencing the action by commit SHA were unaffected — a SHA is immutable, so pinning is the fix.

Changes:

  • SHA-pin all six actionscheckout, setup-python, setup-uv, upload-artifact, download-artifact, action-gh-release. Each is pinned to the commit its @major resolves to today, so there's no version change — pure immutability — with the concrete version in a trailing comment. (setup-uv's @v5 is an annotated tag; it's pinned to the underlying commit, not the tag object, so Dependabot tracks it correctly.)
  • Least-privilege token — a top-level permissions: contents: read (the build job only needs read; the release job keeps its explicit contents: write), and persist-credentials: false on the build checkout so the GITHUB_TOKEN isn't left in .git/config.

actionlint passes, and each pin resolves to the current released version.

Pairs with #860 — its github-actions Dependabot entry keeps these SHAs current (bumping the SHA + comment), so pinning doesn't leave them to go stale.

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens the release workflow against action tag changes and excess token access. The main changes are:

  • Pins six third-party actions to full commit SHAs.
  • Sets read-only repository access as the workflow default.
  • Disables persisted checkout credentials for builds.
  • Keeps write access scoped to the release job.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The release job retains the write permission needed to publish assets.

Important Files Changed

Filename Overview
.github/workflows/build-release.yml Pins external actions and limits token access while preserving the release job's required write permission.

Reviews (2): Last reviewed commit: "Pin release-workflow actions to commit S..." | Re-trigger Greptile

Every `uses:` in build-release.yml was a mutable tag; the `release` job has
`contents: write` and publishes the binaries users install, so a compromised
action could tamper the release. Action tag-hijacking keeps recurring
(aquasecurity/trivy-action, 75 tags, Mar 2026 TeamPCP; tj-actions, 2025;
codfish/semantic-release-action, Jun 2026) and SHA-pinned workflows were immune
each time. Pin all six actions to the commit each @major resolves to today
(concrete version in a trailing comment; setup-uv's annotated tag dereferenced
to its commit, not the tag object, so Dependabot tracks it). Also add a
top-level `permissions: contents: read` (the release job keeps its explicit
write) and `persist-credentials: false` on the build checkout.

actionlint passes. Pairs with usestrix#860 (Dependabot github-actions keeps the pins
current).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bearsyankees

Copy link
Copy Markdown
Collaborator

@greptile

@bearsyankees

Copy link
Copy Markdown
Collaborator

thanks LGTM! @timhaines

@bearsyankees
bearsyankees merged commit 960caf8 into usestrix:main Jul 23, 2026
1 check passed
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.

2 participants