ci: pin third-party Actions to commit SHAs (CWE-829)#511
Open
GaltRanch wants to merge 1 commit into
Open
Conversation
Signed-off-by: GaltRanch <bruno@nexocore.uy>
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
Pin all third-party GitHub Actions in
.github/workflows/to immutable40-character commit SHAs, addressing CWE-829: Inclusion of Functionality
from Untrusted Control Sphere.
Why
A third-party Action pinned to a mutable tag (
@v5,@v4,@master,etc.) executes whatever the upstream maintainer pushes to that tag at
workflow run time. A maintainer-account compromise or a malicious tag
rewrite causes the action to run attacker code with
${{ secrets.* }}in scope.
The March 2025 tj-actions/changed-files supply-chain incident
(CVE-2025-30066) was
exactly this shape: 23,000+ workflows compromised because they used
@v45instead of a SHA. GitHub's own hardening guidance explicitlyrecommends SHA pinning for third-party Actions:
Security hardening for GitHub Actions — using third-party actions.
Changes
.github/workflows/build.yml:56@v5@<sha> # v5.github/workflows/build.yml:152@v4@<sha> # v4.github/workflows/build.yml:205@v4@<sha> # v4.github/workflows/build.yml:238@v4@<sha> # v4.github/workflows/cpp-linter.yml:17@v0.15@<sha> # v0.15.github/workflows/cpp-linter.yml:26@v5@<sha> # v5Each SHA was resolved via
gh api repos/<owner>/<repo>/git/refs/tags/<tag>against the tag that was previously in use. The human-readable version is
preserved as an inline comment so dependabot / human reviewers can still
see what version is pinned.
NASA actions (
actions/*,github/*) are not touched because they'reGitHub-published and outside the third-party threat model.
Test plan
tags previously in use; nothing functionally changes).
comment updates — this is the recommended posture.
Provenance
Discovered by Kulvex Code (KCode),
a deterministic SAST scanner. Pattern:
cloud-006-gha-third-party-no-sha.Per common AI-assist disclosure practice: AI tooling was used. Discovery
ran through KCode with deterministic regex+AST patterns and an LLM verifier
(Grok 4 Fast). Fix generation ran through KCode's agentic mode with Grok
4.2 reasoning + Claude Sonnet 4.5 fallback. Each SHA resolution was done
by
gh apicalls, not invented.— Bruno Aiub · AstroLexis · Kulvex Code · contact@astrolexis.space