Same build step, same tag, different code: what would have stopped it?
In short
A tag like v1 can be moved to other code. A commit's fingerprint follows from its content. Why pinning to the SHA keeps a build on the code you chose.
Same build step, same tag, but someone had moved the tag, and different code ran. That is what happened to the GitHub Action
tj-actions/changed-files in March 2025: according to GitHub's advisory, several of its version tags were changed after the fact to point at a malicious commit. What would have stopped it? This post works through why a tag is only a name, how Git turns content into a fingerprint, and what pinning to that fingerprint does. The action
org-a/build in the reel is made up, and its moved tag was staged, not a real incident.
A tag is a name, and names can be moved
A GitHub Actions workflow pulls in someone else's action with a line like this:
- uses: org-a/build@v1
v1 is a tag. It points at a commit, but it is not that commit. GitHub's "Secure use reference" says so plainly: a tag can be moved or deleted if a bad actor gains access to the repository storing the action. The page adds that the risk is there even if you trust the author.
Here is how little it takes, in a throwaway local repository with a made-up author and a fixed date:
v1 -> 4d096da93cf7212c5b705e52763a19bdc159dceegit tag -f v1v1 -> f23237cbbd5ac10b22325f49fb9afae8d3db7ebf
One command, and the same name points at a different commit. The workflow file reads exactly as it did before.
What happened with tj-actions/changed-files
CISA describes tj-actions/changed-files as a popular third-party GitHub Action that detects which files have changed in a pull request or commit. The GitHub Advisory Database entry (CVE-2025-30066) records:
- Attackers retroactively changed several version tags to point at a malicious commit.
-
The advisory lists
v1.0.0,v35.7.7-secandv44.5.1, all pointing at the same commit,0e58ed86…. - The code pulled secrets out of the runner's memory and printed them in the workflow logs. In repositories with public logs, anyone could read them.
- Versions up to 45.0.7 are listed as affected; 46.0.1 is the patched version.
CISA adds that the compromise was potentially enabled by the compromise of another action, reviewdog/action-setup@v1. That, too, is a reference by tag.
Git works out a fingerprint from the content
Besides names, Git has a second way to refer to code. Pro Git, the book published on git-scm.com, describes it: Git stores every piece of content under a 40-character SHA-1 checksum, computed from the content plus a short header that gives the object type and size. It does not store the file name there, only the content.
The book shows this with a file called test.txt. We recomputed its example in Python and with
git hash-object (git 2.55.0), and both match the book:
"version 1" -> 83baae61804e65cc73a7201a7252750c76066a30"version 2" -> 1f7a7a472abf3dd9643fd615f6da379c4acb3e3achanged in the content: 1 of 10 characterschanged in the fingerprint: 36 of 40 characters
One character of the file changes, and 36 of the fingerprint's 40 characters change with it. The 36 is the count for this change only; a different change gives a different count.
New code, new fingerprint
A commit follows the same rule one level up. According to Pro Git, a tree object holds the SHA-1 of each file, and a commit names the SHA-1 of its tree. Change a file and its fingerprint changes, so the tree's changes, so the commit's changes.
In our throwaway repository, the first version of action.sh has one line. The second adds a line
echo sending your secrets away, which only prints text:
first commit: 4d096da93cf7212c5b705e52763a19bdc159dceesecond commit: f23237cbbd5ac10b22325f49fb9afae8d3db7ebf
NIST's Secure Hash Standard, FIPS 180-4, gives the purpose of such digests in one sentence: they are used to detect whether a message has been changed since the digest was generated.
The test: the tag moves, the pin stays
For repositories without a lockfile, GitHub recommends pinning actions to a full-length commit SHA. The workflow line then reads:
- uses: org-a/build@4d096da93cf7212c5b705e52763a19bdc159dcee # v1
The # v1 comment is only there for people. GitHub's page notes that Dependabot keeps such a comment up to date when it sits on the same line.
Now v1 is moved again, as above with git tag -f. The pinned line still names
4d096da9…, and that fingerprint still belongs to the original code. To put other code behind exactly that SHA, GitHub says, an attacker would need to generate a SHA-1 collision for a valid Git object. So a moved tag changes nothing your build runs.
Check it yourself
You can recompute Pro Git's fingerprints with Git itself, without writing anything to a repository:
printf 'version 1\n' | git hash-object --stdinprintf 'version 2\n' | git hash-object --stdin
And you can watch a tag move in an empty test repository:
git tag v1 # tag the current commitgit rev-parse 'v1^{commit}'# make a new commit, then:git tag -f v1 # same name, new commitgit rev-parse 'v1^{commit}'
What the pin does not do
- It holds, it does not clean. A pin on a bad commit stays bad. The tj-actions advisory explicitly tells you to update workflows that reference the malicious commit directly by its SHA.
- The SHA has to come from the right repository. GitHub advises checking that it is from the action's repository and not from a fork.
- It covers the line it is written on. GitHub calls a workflow dependency lockfile the strongest protection: it records the exact commit for every action, including transitive dependencies, and supersedes SHA pinning in repositories that adopt it.
- Dependabot raises no alerts for pinned actions. According to GitHub, Dependabot only raises alerts for vulnerable actions that use semantic versioning, not for actions pinned to SHA values.
- It rests on SHA-1. "New code, new fingerprint" holds as long as nobody can make two contents with the same SHA-1 value. GitHub states that condition itself.
- 36 of 40 is a single count for this file and this change, not a fixed figure.
Get the next explainer
Every Cube Algos reel gets a post like this one: the mechanism worked through, with sources and limits. If you would like the next one by email, sign up below. You will first get an email with a confirmation link; you are only on the list after you click it, and every email has a link to unsubscribe.
Sources
- GitHub Docs, "Secure use reference": tags can be moved or deleted, pinning to a full-length commit SHA, the SHA-1 collision, the fork check, the lockfile as the strongest protection, Dependabot.
- GitHub Advisory Database, CVE-2025-30066, tj-actions/changed-files: the retroactively changed tags, the commit, the secrets in the logs, affected and patched versions.
-
CISA, "Supply Chain Compromise of Third-Party tj-actions/changed-files": what the action does, the possible link to
reviewdog/action-setup@v1. -
Pro Git, "Git Internals - Git Objects": 40-character SHA-1 of content plus header, the
version 1/version 2example, trees and commits. - NIST, "FIPS 180-4, Secure Hash Standard": digests detect whether a message has been changed.
All sources last opened on 1 December 2026. The 36-of-40 count, the commit values and the moved tag come from our own runs, not from the sources.
More posts
-
Why did the API key survive obfuscation?
A key written into Dart code ships in the app file, and --obfuscate only renames symbols. What one search finds, and what a server changes.
-
If Claude Code runs the deploy script anyway, why does nothing go live?
A Claude Code deny rule matches command text, so a full path slips past. A contract deployment still needs a signature from a private key.
-
How does a smart contract know your phone signed?
Since Fusaka, Ethereum has a built-in checker for P-256 signatures. It takes five numbers and answers 1 or nothing, worked through step by step.
-
How do you add money when 0.1 + 0.2 is not 0.3?
Binary floating point builds fractions from halves, where a tenth never ends. That is why 0.1 + 0.2 is not 0.3, and why money is counted in whole cents.