Skip to main content
Commerce Security logo, "All 12 PCI DSS Requirements in Plain English," "Get it now for free," "Complete Survival Guide" and a button toclick to get it
Should You Pin Every CI/CD Dependency to a SHA?Software Supply Chain Security
4 min readFor Procurement Security Professionals

Should You Pin Every CI/CD Dependency to a SHA?

The Question at Hand

The FBI's advisory following the TeamPCP supply chain attacks recommends pinning all GitHub Actions workflows to verified commit SHA hashes instead of using floating version tags. This guidance addresses a specific threat: attackers who stole publishing credentials and pushed malicious versions through trusted release channels across multiple distribution ecosystems.

However, pinning every dependency to a SHA hash introduces its own challenges. You're trading the risk of using a compromised floating tag for the risk of running outdated code with known vulnerabilities because your pinned version never updates. For procurement security teams evaluating build tooling and CI/CD vendor arrangements, this is a practical decision with significant consequences.

The Case for Strict SHA Pinning

The TeamPCP campaign highlights why version tags can't be trusted as immutable references. When attackers compromised Trivy's publishing credentials, they pushed malicious code that downstream consumers pulled automatically because those consumers referenced @latest or @v1.2.3 tags. LiteLLM's build pipeline installed Trivy without pinning it to a verified version, making it an entry point for the attack.

SHA pinning breaks this chain. A commit hash is cryptographically bound to a specific code state. Even if an attacker compromises publishing credentials and pushes new malicious releases, they can't alter the code at a SHA you've already verified. Your pipeline pulls exactly what you audited, not what an attacker published three hours ago.

This approach extends beyond credential theft. Maintainer account compromises, insider threats, and even unintended breaking changes in minor version updates become non-issues when you pin to SHAs. You control when and how dependencies update, not the upstream maintainer's release schedule.

For organizations operating under SR 23-4 or the EBA Outsourcing Guidelines, this control aligns with the requirement for continuous monitoring of active arrangements. You're not monitoring if you don't know what version you're running. SHA pinning ensures that visibility.

The operational cost is real but manageable. Tools like Dependabot and Renovate can automate SHA update pull requests. Your review process becomes: examine the diff between the old SHA and the proposed new SHA, verify the signature, and merge if clean. It's more deliberate than auto-consuming floating tags, but that deliberation is the point.

The Case for Selective Pinning

Strict SHA pinning for every action, scanner, and build tool creates a maintenance burden that most teams can't sustain. The TeamPCP actor potentially compromised over 1,000 organizations globally, but the confirmed victim count is just 16 organizations. This gap between potential exposure and confirmed compromise is important when allocating finite security resources.

Pinning introduces latency between upstream security patches and your consumption of them. When a critical vulnerability is fixed in a widely used action, you don't get the fix automatically. You get it when someone on your team notices the update, reviews the SHA diff, and merges the change. In a large organization with hundreds of repositories, that review queue becomes a bottleneck. You're potentially running vulnerable code longer than teams who use semantic version ranges and get patches automatically.

Selective pinning acknowledges the threat but calibrates the response. Pin your critical path: actions that handle secrets, publish artifacts, or interact with production infrastructure. Allow less sensitive tooling (linters, formatters, documentation generators) to float within semantic version constraints. The risk profile of a compromised markdown linter is different from a compromised publishing action.

This approach also aligns with how most package ecosystems work. The npm and PyPI compromises in the TeamPCP campaign succeeded because developers routinely install packages without verifying hashes. Strict SHA pinning for GitHub Actions while leaving package dependencies on floating ranges creates an inconsistent security posture. You've hardened one vector while leaving others exposed.

Where Practitioners Actually Land

Most organizations adopt a hybrid model driven by criticality classification. Actions that touch credentials, deployment keys, or customer data get pinned to SHAs with mandatory review cycles. Everything else uses semantic versioning with automated dependency updates and post-merge verification.

The FBI advisory lists tpcp-docs and docs-tpcp as repository names the worm creates using stolen credentials. That's a detection signal, not a prevention control. Teams layer multiple defenses: SHA pinning for high-risk actions, branch protection rules requiring review on workflow changes, secret scanning to catch exposed credentials before they're weaponized, and audit logging to flag unexpected repository creation.

Concentration risk assessment matters too. If your entire build infrastructure depends on a single action maintained by a small team with no formal security program, that's a single-provider dependency worth pinning regardless of what the action does. If you're using an action from a well-resourced project with public security audits and a history of rapid incident response, the risk calculation shifts.

Our Take

Pin actions that handle secrets or publish artifacts. Use semantic versioning with automated updates for everything else, but implement detection controls that flag unexpected workflow modifications or repository creation patterns.

The TeamPCP campaign succeeded because organizations treated CI/CD pipelines as trusted infrastructure rather than attack surfaces. Strict SHA pinning addresses that oversight, but it's not the only control that does. A mature vendor risk management program treats build tooling like any other third-party arrangement: assess the provider's security posture, classify by criticality, implement controls proportional to risk, and monitor continuously.

The FBI's recommendation to rotate all CI/CD secrets, publishing tokens, and cloud credentials accessible during exposure windows is essential if you suspect compromise. Pinning prevents future exposure; rotation limits the blast radius of past exposure. You need both.

The harder question isn't whether to pin, it's whether your team has the capacity to maintain what you pin. A SHA-pinned action you never update is often less secure than a floating tag from a responsive maintainer. Be honest about your operational reality before you commit to a control you can't sustain.

Promotional banner graphic asking if you are ready for PCI DSS 4.0 with a call-to-action to get the guide

You Might Also Like