ci: pin GitHub Actions to full-length commit SHA#554
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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@v6are 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.Zcomment: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
actions/cacheactions/checkoutactions/create-github-app-tokenastral-sh/setup-uvazure/logindocker/login-actionequinor/radix-github-actionsgithub/codeql-action(init + analyze)googleapis/release-please-actionjdx/mise-actionpre-commit/action