Skip to content

Pin GitHub Actions to commit SHAs - #118

Open
hf-security-analysis[bot] wants to merge 1 commit into
mainfrom
security/pin-actions-to-sha
Open

hf-security-analysis[bot] wants to merge 1 commit into
mainfrom
security/pin-actions-to-sha

Conversation

@hf-security-analysis

Copy link
Copy Markdown
Contributor

Workflow hardening

Actions pinned to commit SHAs

A version tag is mutable. Whoever controls an action's repository can move v4
to different code, and every workflow referencing @v4 picks that up on the
next run with nothing to review. That is how tj-actions/changed-files shipped
a 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.

Workflow Before After
.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

Opened by the workflow security bot. It changes what this pull request says it
changes, and nothing else.

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.
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.

0 participants