Skip to content

ci: pin GitHub Actions to full-length commit SHA#554

Merged
einarwar merged 1 commit into
mainfrom
chore/pin-actions-to-sha
May 19, 2026
Merged

ci: pin GitHub Actions to full-length commit SHA#554
einarwar merged 1 commit into
mainfrom
chore/pin-actions-to-sha

Conversation

@einarwar
Copy link
Copy Markdown
Contributor

Summary

Pins every third-party GitHub Actions reference in .github/workflows/ to a full-length commit SHA, per the Equinor AppSec guidance for GitHub Actions runners.

Tag references like actions/checkout@v6 are mutable and can be repointed by the action's maintainer (or an attacker who compromises their account) to malicious code that then runs with our workflow's secrets. Pinning to a commit SHA makes the reference immutable.

What changed

Every uses: line that references a third-party action now uses a 40-character commit SHA with a trailing # vX.Y.Z comment:

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

The trailing version comment is preserved so Dependabot's GitHub Actions updater can bump the SHA and the human-readable version label together when a new release ships.

How the SHAs were chosen

Each SHA was resolved by querying api.github.com/repos/<owner>/<repo>/commits/<tag> for the major-version tag currently used in this repo (e.g. v6 -> v6.0.2 -> de0fac2…), so every pin is the exact commit that the previously-floating tag pointed to at the time of this PR.

Actions pinned

Action Pinned version
actions/cache v5.0.5
actions/checkout v6.0.2
actions/create-github-app-token v3.2.0
astral-sh/setup-uv v7.6.0
azure/login v3.0.0
docker/login-action v4.1.0
equinor/radix-github-actions v2.0.2
github/codeql-action (init + analyze) v4.35.5
googleapis/release-please-action v5.0.0
jdx/mise-action v4.0.1
pre-commit/action v3.0.1

Per Equinor AppSec recommendation [1], pin every third-party action
reference to an immutable commit SHA so a hijacked or moved tag cannot
silently inject code into our workflows. A trailing version comment is
kept on each line so Dependabot's GitHub Actions updater can bump the
pinned SHA and the version label together.

[1] https://equinor.github.io/appsec/toolbox/version-control/gh-actions-runners/#github-actions-in-general
@einarwar einarwar requested a review from a team as a code owner May 19, 2026 11:59
Copy link
Copy Markdown
Contributor

@sutne sutne left a comment

Choose a reason for hiding this comment

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

Very nice 🔐✨

@einarwar einarwar merged commit 10f9214 into main May 19, 2026
13 checks passed
@einarwar einarwar deleted the chore/pin-actions-to-sha branch May 19, 2026 12:29
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