Why GitHub Actions SHA Pinning Is Not Enough
Why GitHub Actions SHA Pinning Is Not Enough
Every third-party action in a workflow can be pinned to a full commit SHA and the pipeline can still execute untrusted code. That is not evidence that Git hashes are broken. It means that immutability, provenance, transitive dependencies and execution privileges are different security questions.
A full commit SHA prevents a moving branch or tag from silently changing the Git object selected by that reference. It does not establish that the original selection was trustworthy, that the commit belongs to the release an engineer intended to use, or that the action will not fetch mutable code at runtime. Nor does it limit the secrets and deployment permissions available to the job.
The March 2026 Trivy compromise illustrates why the distinction matters. Aqua Security's incident advisory describes both maliciously redirected tags and an exposure path in which an older, safely pinned parent action called a mutable downstream action. Defending the pipeline requires inspecting the chain, not abandoning SHA pinning.
Four questions behind a single uses: line
| Question | What a full SHA does | What it does not establish |
|---|---|---|
| Can this reference silently move? | It fixes the referenced Git object. | It does not prevent a reviewed workflow update from selecting a different object. |
| Is this the intended upstream release? | It identifies a commit. | It does not establish project ownership, release membership or trusted authorship. |
| Is everything the job executes fixed? | It fixes the referenced action's Git content. | It does not automatically pin nested actions, downloaded tools or container dependencies. |
| Can the job damage production? | Nothing directly. | Token permissions, cloud roles, secrets and runner access need separate controls. |
A commit being viewable through a repository interface is not, by itself, proof that maintainers released it or included it in a trusted branch. Repository networks and forks make the distinction operationally important. Verify the publisher, the expected release and the relationship between the release and the selected commit. Signatures and attestations can support that decision only when their identities and policy are verified too.
A comment next to a SHA may make reviews easier, but it is not a security control. A comment saying vX can be wrong. Check the release-to-commit mapping rather than approving the label.
What the Trivy incident actually shows
According to Aqua's advisory GHSA-69fq-xp46-6x23, attackers used compromised credentials on March 19, 2026 to publish a malicious Trivy 0.69.4 release and move numerous trivy-action and setup-trivy tags to malicious commits. Separately, malicious container images appeared in a later exposure window. These are distinct artifacts and time windows; investigate each rather than treating every use of the Trivy name as proof of compromise.
The advisory identifies a subtler case: an older trivy-action commit could itself be safely SHA-pinned while its setup-trivy dependency was still referenced through a mutable tag. During the downstream exposure window, a workflow using that parent could therefore fetch malicious code. The parent SHA did not change. The trust boundary failed at the next dependency.
Aqua also described an impostor actions/checkout commit introduced into the release pipeline. The lesson is not that a legitimate SHA spontaneously mutated. A wrong commit can be selected during an update or introduced through compromised credentials, and a fixed reference will faithfully keep selecting that wrong commit.
For incident response, distinguish exposure, execution and confirmed compromise. A dependency's presence in a repository does not prove that a compromised version ran. Examine workflow run times, resolved commits, downloaded artifacts and the permissions available to the affected job. Aqua recommends rotating secrets accessible to pipelines when the malicious version may have executed.
What workflow lockfiles change
GitHub announced general availability of workflow dependency lockfiles on October 28, 2026 for its listed cloud and hosted plans. Teams can keep readable tags or branch names in a workflow while the runner uses recorded commits for onboarded workflows. GitHub's CLI extension generates .github/workflows/actions.lock, including action dependencies and transitive action dependencies, and administrators can require the policy where supported.
This closes an important operational gap: a tag moving after review need not silently move the executed action. It also gives reviewers a clearer dependency inventory. GitHub explicitly states, however, that a lockfile does not determine whether a dependency is safe. A malicious commit locked on day one remains malicious.
The lockfile should not be confused with a complete bill of everything that runs. Inspect action scripts for tools downloaded at runtime, package installation and container build inputs; do not assume every network-fetched dependency is covered by the action lock. An automated update pull request is useful because it creates a review point, not because its existence proves the update is safe.
Start with the jobs that can change production
Inventory deployment jobs, release workflows, package publishers and jobs able to obtain cloud credentials. For each job, record the repository and environment, trigger, GITHUB_TOKEN permissions, secrets, OIDC identity, runner type and network access.
Set permissions at the narrowest practical scope. A job that only reads source should not inherit release-writing privileges. When using OIDC to replace long-lived cloud keys, inspect the cloud trust policy as well as the workflow: a short-lived token still grants whatever permissions the role and trust conditions allow. Restrict the accepted repository, branch, environment and other supported identity claims to the intended deployment path.
Trace the dependency beyond the top-level pin
For each action, establish the expected publisher and map the SHA to the intended release. Review the change between the old and new commits. Then inspect composite action uses: entries, reusable workflows, Dockerfiles and scripts that download tools. A pinned Docker action can still depend on a mutable base image or dependencies resolved during build or execution.
For JavaScript actions, understand how the checked-in distribution relates to source and how updates are produced. For container-based actions, track image digests and build inputs where practical. A reviewed dependency graph is not a guarantee of harmlessness; it is a concrete record of what was trusted and why.
The right level of review depends on the job's privileges. An action running a formatting check without secrets is not equivalent to an action holding package-publishing or production deployment credentials. Separate low-trust testing from high-trust publishing and require stronger review at the boundary.
Separate untrusted contributions from privileged execution
An external pull request can change code that a test job executes. A privileged trigger or an unsafe checkout can combine that untrusted code with write tokens and secrets. Pinning all third-party actions does not remove that risk.
Review pull_request_target workflows carefully: identify the actual code being checked out, where it came from and what privileges are available when it executes. Run untrusted tests without production credentials, and promote a verified artifact into a separate deployment job with an appropriate approval boundary.
Persistent self-hosted runners introduce another boundary. Files, processes or credentials left by one job can affect the next. Ephemeral runners, clean workspaces and restricted outbound access reduce persistence and blast radius, but they do not prevent malicious code from using the permissions already granted to its own job.
Build an incident-ready evidence trail
When a vendor reports a compromise, the investigation should be able to answer:
- Which repositories and workflows used the affected component?
- Which exact commit, binary or container digest ran during the published exposure window?
- Which tokens, cloud roles, secrets and network destinations were available?
- Which runner and artifacts must be isolated and preserved?
- Which credentials and downstream artifacts need rotation, replacement or investigation?
Keep run IDs, resolved dependency revisions, artifact digests and relevant cloud audit events for an appropriate retention period. Missing logs are an evidence gap, not a clean bill of health. If execution cannot be ruled out, document the uncertainty and decide credential rotation and containment according to the reachable permissions and business impact.
Practical review checklist
- Replace mutable action references in sensitive workflows with full SHAs or an applicable workflow lockfile policy.
- Verify the upstream publisher, expected release and commit before approving a pin or lockfile update.
- Review nested action references, executable scripts, downloaded binaries and image build inputs.
- Reduce job-level token permissions and secret access; protect release and production environments.
- Restrict cloud OIDC trust to the intended workload identity, not merely the organization name.
- Separate untrusted pull request execution from jobs that can publish or deploy.
- Practice isolating runners, preserving evidence and rotating credentials before an incident occurs.
Frequently asked questions
Should teams stop using SHA pinning?
No. It is a valuable defense against tags or branches silently moving to a different commit. It must be paired with dependency review, provenance checks and least privilege.
Is a full version tag equivalent to a full SHA?
A normal tag can move. A full commit SHA identifies a fixed Git object. Some projects use immutable-release protections, but those protections depend on the release and configuration; do not assume every tag is immutable.
Does a safe top-level SHA secure all nested dependencies?
No. A pinned action can call another action through a mutable reference or download a tool at runtime. Check those dependencies and the privileges of the job executing them.
Source and scope note
This analysis draws on Aqua Security's GHSA-69fq-xp46-6x23, Trivy ecosystem supply chain temporarily compromised, and GitHub's announcements GitHub Actions policy now supports blocking and SHA pinning actions (August 15, 2025) and GitHub Actions workflow lockfiles are generally available (October 28, 2026). Incident findings are attributed to their publishers; Eresus Security is not claiming to have independently reproduced the attack. Verify current product availability and vendor guidance before deployment.
Related reading: CI/CD build-script security.
AI Security Starter Training
Request a practical checklist for prompt injection, RAG data leakage, MCP risks, and model-file security before launch.
Related Services
Scope Estimator
Get a rough engagement size before the scoping call.
- What this depth covers
- Full coverage of the OWASP-family test plan for the in-scope targets: broken access control, injection, authn and authz flaws, business-logic abuse, findings with reproduction steps.
- What it does not cover
- Multi-week adversary emulation, physical and phishing vectors, custom exploit development, source-code review.
Indicative effort
~5 tester-days
Estimate only, not a quote. It scales with the three factors above and assumes the targets are reachable and test accounts are provided in the test window.