Join our Newsletter — 33% off our NHI Course
Home› FAQ› Cyber Security› What is the difference between pinning a GitHub…
Cyber Security

What is the difference between pinning a GitHub Action to a commit SHA and using a moving version tag?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated November 5, 2026 Domain: Cyber Security

Pinning to a full commit SHA locks the workflow to one immutable revision, so the referenced code cannot change silently after review. A moving version tag can be retargeted by a maintainer or attacker, which means the same workflow line may execute different code later. For supply chain defense, immutable references are safer.

Why Immutable Git References Are Safer Than Moving Tags

Pinning a GitHub Action to a full commit SHA makes the referenced code immutable from the workflow’s point of view. That matters because the workflow will always resolve to the same revision, even if the publisher later updates tags or changes release pointers. A moving version tag is easier to maintain, but it also creates a trust problem because the executed code can change without the workflow line changing.

That difference is not just operational convenience, it is a supply chain control choice. A SHA pin gives you reproducibility, review stability, and a clearer audit trail for exactly what ran. A tag gives the maintainer flexibility, but it also means the same workflow can drift to new code over time, including code introduced after your review or by someone who compromises the release channel.

In practice, the security value comes from the immutability of the reference rather than from the popularity of the action. If the action is third-party or widely reused, the risk is still present whenever the reference can be retargeted. For a useful implementation guide to GitHub-specific hardening, see the GitHub and GitHub Actions Security Guide, which covers action pinning, permissions, and workflow hardening.

What Changes When the Reference Can Move

A commit SHA is a fixed content address, so it limits surprise unless the repository history itself is rewritten. A tag is a label, not a guarantee, and that distinction matters in CI/CD because the workflow file often looks unchanged while the executed dependency changes underneath it. The security issue is therefore not only malicious tampering, but also accidental drift when a maintainer republishes or retargets a release.

This is why pinning is commonly treated as a baseline supply chain safeguard. It helps preserve change control, makes incident review easier, and reduces the chance that a trusted workflow silently inherits new behaviour. A strong reference point is the broader CI/CD identity and trust model described in CI/CD Pipeline Identity Security Guide, which explains how pinned actions, trusted publishing, and token boundaries fit together.

Version tags still have a role when teams need semver-style maintenance or want to follow a release line deliberately. The difference is that a tag should be treated as a convenience layer, not as a security boundary. If your workflow depends on consistent behaviour, the pin must be the enforcement point and the tag must remain informational at best.

How to Choose the Safer Pattern in Real Workflows

The right choice depends on whether you value stability or convenience, but for security-sensitive pipelines the safer default is to pin to an immutable commit and review updates explicitly. That does not mean every action must be frozen forever. It means changes should enter through code review, not through silent tag movement. This is especially important for build and release jobs where the action can touch secrets, signing steps, or deployment credentials.

One practical exception is controlled maintenance workflows where a team accepts the operational trade-off of following a release tag. Even then, the team should monitor upstream changes and have a defined process for re-reviewing the action when the tag shifts. Where the workflow handles untrusted input or has access to production-scoped secrets, the case for SHA pinning is much stronger than the case for a moving tag.

For incident handling and recovery planning when a workflow dependency is suspected of changing maliciously, the CI/CD Pipeline Compromise Playbook is the most relevant internal reference, because it focuses on workflow triage, evidence preservation, secret rotation, and clean rebuilds after pipeline trust has been lost.

Risk and Threat Considerations

Moving tags create a supply chain exposure because the trusted name in the workflow can outlive the code it originally pointed to. If an attacker compromises the maintainer account, release process, or repository, they may be able to retarget the tag and get malicious code executed in downstream workflows without changing the consumer’s workflow file. Even without an attacker, routine tag retargeting can create an integrity gap between review time and runtime.

Failure mechanism: The workflow trusts a mutable pointer instead of an immutable revision, so later tag movement can substitute different code for the reviewed code path.

Impact: The pipeline may execute unreviewed logic, exposing secrets, signed artifacts, build outputs, or deployment paths to compromise.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5, CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5SA-10 — Developer Configuration ManagementPinned actions support controlled software component change in pipelines.
CM-3 — Configuration Change ControlCommit-SHA pinning enforces explicit approval for workflow dependency changes.
SI-7 — Software, Firmware, and Information IntegrityImmutable references reduce silent substitution of workflow code by retargeted tags.
Recommendation — Require immutable references and review upstream changes before updating workflow dependencies. Approve and track every action version change instead of following moving tags blindly. Verify workflow integrity with immutable references and trust-boundary checks.
CIS Controls v8CIS-16 — Application Software SecurityThird-party actions are software dependencies that need controlled updates and integrity checks.
Recommendation — Pin external actions and review dependency updates before they reach production workflows.
NIST CSF 2.0PR.DS-10 — Integrity mechanisms are implementedSHA pinning preserves integrity of workflow dependencies against silent retargeting.
Recommendation — Implement integrity checks by pinning actions to immutable revisions.

Practitioner Guidance

What to verify: Check whether the workflow references a full commit SHA for every third-party action that can affect secrets, build outputs, or deployment state. If a tag is used, confirm there is an explicit review process for every upstream update and that the team knows who owns that review.

Decision rule: If the action can read secrets, publish artifacts, or influence release integrity, treat a moving tag as a higher-risk choice and prefer immutable pinning. If the action is low impact and tightly controlled, a tag may be acceptable only if the drift is actively monitored.

Practitioner takeaway: The safest default is not “latest trusted release”, it is “exact code you reviewed”, because supply chain trust breaks the moment a reference can move without your approval.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 5, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org