Skip to content

🔒 Pin GitHub Actions to commit SHAs#1626

Merged
paulinebm merged 5 commits intomainfrom
security/pin-actions-to-sha
Apr 7, 2026
Merged

🔒 Pin GitHub Actions to commit SHAs#1626
paulinebm merged 5 commits intomainfrom
security/pin-actions-to-sha

Conversation

@paulinebm
Copy link
Copy Markdown
Contributor

🔒 Pin GitHub Actions to commit SHAs

This PR pins all GitHub Actions to their exact commit SHA instead of mutable tags or branch names.

Why?
Pinning to a SHA prevents supply chain attacks where a tag (e.g. v4) could be moved to point to malicious code.

Changes

Workflow Action Avant Après SHA
tests.yml actions/checkout v6 v6.0.2 de0fac2e4500…
tests.yml pnpm/action-setup v4 v4 b906affcce14…
tests.yml actions/setup-node v6 v6 53b83947a5a9…
documentation.yml huggingface/doc-builder/.github/workflows/build_main_documentation.yml main main 90b4ee2c10b8…
pr-documentation.yml huggingface/doc-builder/.github/workflows/build_pr_documentation.yml main main 90b4ee2c10b8…
upload-pr-documentation.yml huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml main main 90b4ee2c10b8…
publish.yml actions/checkout v6 v6.0.2 de0fac2e4500…
publish.yml pnpm/action-setup v4 v4 b906affcce14…
publish.yml actions/setup-node v6 v6 53b83947a5a9…

🤖 Generated by /github-actions-audit — [security/pin-actions-to-sha]

Closes huggingface/tracking-issues#283

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sroussey
Copy link
Copy Markdown
Contributor

sroussey commented Apr 3, 2026

Tags are mutable by default, though github lets individual repos decide that (which is not as helpful as it sounds), but pinning has its own issues. I think github still has a global git repo for all forks, so while only the maintainer can set a tag, anyone can have a sha hash on the maintainers repo. In that case, you make some bad code in a fork of a project, and then go to another project, like this one, and propose pinning shas and either pinning the wrong sha at the beginning or updating shas for minor versions at a later date. Not suggesting this is you, btw. But the maintainers of the project get lots of extra work for themselves if they go this route. The docs action is based on main! It changes a lot -- that is where i would do it.

At least with tags, it is required to infiltrate the main repo. Not so with sha hashes. Last i remember.

I'd be wary of this change. It make things way easier for the next person.

@paulinebm paulinebm merged commit 60379e2 into main Apr 7, 2026
4 checks 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.

3 participants