ci: pin third-party Actions to commit SHAs (CWE-829)#1040
Open
GaltRanch wants to merge 1 commit into
Open
Conversation
Signed-off-by: GaltRanch <bruno@nexocore.uy>
aad030c to
e45aaa4
Compare
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 third-party GitHub Actions in the main
.github/workflows/of thecFS bundle to immutable 40-character commit SHAs, addressing
CWE-829: Inclusion of Functionality from Untrusted Control Sphere.
This PR covers 10 pinnings in the cFS main repo. Submodules
(
cfe/,osal/,tools/eds/) have separate workflow files; analogousPRs against those repositories will follow.
Why
Third-party Actions pinned to mutable tags (
@v2,@master, etc.)execute whatever the upstream maintainer pushes to that ref at workflow
run time. A maintainer compromise or a 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 hardening guidance explicitlyrecommends SHA pinning for third-party Actions:
Security hardening for GitHub Actions — using third-party actions.
Changes (10 pinnings across 7 workflow files)
build-doc-reusable.yml:56@master@<sha> # masterbuild-run-app-reusable.yml:49@master@<sha> # masterchangelog.yml:21@v2.1.1@<sha> # v2.1.1codeql-reusable.yml:77@master@<sha> # mastercodeql-reusable.yml:167@v1@<sha> # v1format-check.yml:26@master@<sha> # masterformat-check.yml:77@v2@<sha> # v2mcdc-reusable.yml:36@master@<sha> # mastermcdc-reusable.yml:148@v2@<sha> # v2unit-test-coverage-reusable.yml:44@master@<sha> # masterEach SHA was resolved via
gh apiagainst the tag/branch previously inuse. The human-readable ref is preserved as a
# <ref>comment so futureDependabot bumps and human reviewers can see the intended version.
@masterpins are particularly risky (branch HEAD moves on every push)— those are the highest-priority ones in this batch.
Submodule follow-ups (separate PRs to come)
5 additional findings in submodule workflows that need their own PRs:
cfe/.github/workflows/mcdc.yml:149(nasa/cFE)osal/.github/workflows/build-osal-documentation.yml:25(nasa/osal)osal/.github/workflows/mcdc.yml:34(nasa/osal)osal/.github/workflows/mcdc.yml:144(nasa/osal)tools/eds/.github/workflows/validation-test.yml:32(nasa/eds)Test plan
tag/branch HEADs previously in use).
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
via KCode (deterministic regex+AST patterns + LLM verifier). Fix generation
via KCode agentic mode (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