Pin GitHub Actions to commit SHAs - #118
Open
hf-security-analysis[bot] wants to merge 1 commit into
Open
hf-security-analysis[bot] wants to merge 1 commit into
hf-security-analysis[bot] wants to merge 1 commit into
Conversation
A tag is mutable: whoever controls the action's repository can move `v4` to different code, and the next run picks it up with no diff to review. Pinning to the commit SHA freezes the code that runs today.
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.
Workflow hardening
Actions pinned to commit SHAs
A version tag is mutable. Whoever controls an action's repository can move
v4to different code, and every workflow referencing
@v4picks that up on thenext run with nothing to review. That is how
tj-actions/changed-filesshippeda credential dumper to thousands of repositories in March 2025.
Pinning to a full commit SHA freezes the code that runs. The version tag stays
on the line as a comment, so the reference is still readable.
This pins, it does not upgrade. Every SHA below is the commit the tag
already resolves to today, so nothing about what your CI executes changes — it
only removes the ability for it to change without your knowing.
.github/workflows/lockfile_registry_guard.yml- uses: actions/checkout@v7.0.1- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1.github/workflows/sync_space.yml- uses: actions/checkout@v7.0.1- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1