Tags move, so lock what your build pipeline runs
If your team builds software on GitHub, every push probably runs a dozen small pieces of other people's code. One checks out the repository, one sets up Node or Python, one logs in to your cloud account, one deploys. These are GitHub Actions, and they run inside your build pipeline with access to whatever it holds: deploy keys, cloud credentials, package publishing tokens.
Most workflow files pick them with a line like uses: actions/checkout@v4. That looks like a version number. It is not a promise. v4 is a Git tag, a label pointing at one commit, and tags can be moved. GitHub resolves the tag when the job runs, so your pipeline runs whatever the tag points at today, not what it pointed at when someone on your team last looked.
On 28 October GitHub made workflow lockfiles generally available on Free, Team, and Enterprise Cloud plans. A lockfile records the exact commit behind every action your workflows use, and GitHub runs that commit even if the tag moves.
Why a moved tag is the whole attack
In March 2025 an attacker, most likely using a stolen token belonging to a bot on the project, took over tj-actions/changed-files, a popular action, and retagged every version to point at a malicious commit. Any pipeline using it, at any version tag, started printing its secrets into the build logs. Nobody had changed a line in their own workflow files.
The long-standing advice has been to pin each action to its full commit SHA instead, the 40-character fingerprint that identifies one exact version of the code. That works, but it turns a readable workflow into rows of hex with version numbers in comments, and it only pins the action you named. If that action itself calls other actions by tag, those can still move underneath you.
What a lockfile does
The lockfile lives at .github/workflows/actions.lock. GitHub's documentation sets out how it works:
- It is generated by
gh actions-lock, an extension to GitHub's command-line tool. You never edit it by hand. - For each action it records the tag, the exact commit, and the numeric identity of the repository it came from. GitHub uses that identity to confirm, at run time, that the repository behind the name is still the one you locked.
- Once a workflow is onboarded, every action it uses must be in the lockfile, and the locked commit is what runs.
- It covers transitive dependencies: the actions your actions use.
- Your workflow files keep readable references like
@v7.0.1.
It also leaves things out, and they matter. It does not pin reusable workflows called from another repository; those need a full commit SHA, or their own lockfile in their own repository. It does not touch secrets, inputs, or the runner image. And as GitHub's announcement puts it, a lockfile does not decide whether a dependency is safe. It makes sure the code you reviewed is the code that runs.
Nor does it cover the packages your build installs, and they have the same weakness. A line like pip install agent-framework fetches whatever version is newest when the job runs. On 17 November two poisoned versions of agent-framework, Microsoft's official Python package for building AI agents, appeared under Microsoft's own project on PyPI, the main public library of Python packages. It is downloaded about 196,000 times a month. According to Elastic's security researchers, both versions ran a credential stealer every time Python started, whether or not anything used the package. It gathered secrets from the machine, then asked Azure DevOps, GitHub Actions, and Azure for fresh cloud tokens: exactly what a build pipeline holds. How the attacker got publishing access is not yet known.
Elastic flagged the first version six minutes after it went live, at 20:41 UTC. The second followed at 21:08 UTC, and PyPI removed both within the hour. Six minutes is fast, but any build that installed either version should assume every secret it could reach is gone, and stolen keys get used quickly. Researchers at Stony Brook University planted cloud keys in 300 public container images and saw the first one used 8 seconds after publication. So pin the packages your build installs to exact versions in a lockfile your package manager checks, the same idea as an actions lockfile, and let new releases wait a few days before you take them.
What it would not have stopped
In early October a wave of the GhostAction campaign used about 1,900 compromised GitHub accounts to push a fake "security audit" workflow into more than 30,000 repositories, according to GitGuardian. The workflow sent the repository's secrets, plus any credentials it found in the code and its history, to the attacker's server.
That was not a moved tag. It was a new workflow file committed by an account with write access, so a lockfile on its own would not have helped. GitHub's Require lockfile policy, which blocks any targeted workflow that isn't in the lockfile, would at least have forced the attacker to commit a matching lockfile entry too. That raises the bar. It is not a wall. The controls for that attack are the ones covered in our filing on poisoned packages: who can push, what protects those accounts, and whether changes to .github/workflows need someone else's approval.
How to set it up
GitHub's step-by-step guide is short. Python release manager Hugo van Kemenade has a good worked example from rolling it out across Python projects. In outline:
- Check what you are about to lock. The lockfile pins whatever your tags point at right now, so make sure each
uses:line is the version you actually want. - Turn on Dependabot for GitHub Actions first. Dependabot is GitHub's automated update tool. When it bumps an action in an onboarded workflow, it regenerates the lockfile entry in the same pull request. Set a cooldown so it waits a few days before proposing a new version. Malicious releases tend to be caught quickly, the same reason an 11-hour wait would have stopped the Claude Code extension backdoor.
- Generate it. Run
gh extension install github/gh-actions-lock, thengh actions-lockfrom the root of the repository. It scans every workflow, writes the lockfile, and rewrites youruses:lines to the exact version it resolved. - Read the whole diff before committing. If you restrict which actions may run, check that list: once a workflow is onboarded, it is matched against locked commits rather than tags, so an entry like
actions/checkout@v6stops matching. - Add a check. A job that runs
gh actions-lock --verifyon pull requests fails when the lockfile is stale. GitHub publishes a ready-made workflow for it. - Make someone own the diff. Add
actions.lockand.github/workflows/to yourCODEOWNERSfile, the list of who must approve changes to which paths, and require that approval. A changed commit in the lockfile means the code your pipeline runs has changed. A changed repository identity should almost never happen, so investigate before merging. - Then enforce it. Once every workflow is onboarded, switch on Require lockfile in the repository's Actions policies, so new workflows cannot quietly skip it.
If you use zizmor, the linter for GitHub Actions workflows, version 1.32.0 is the first that understands lockfiles. Older versions will keep telling you to pin by SHA.
If someone else builds your software
If an agency or contractor runs your build pipeline, you don't need to do any of this yourself. Ask them two questions: are the third-party actions in our pipeline pinned to exact commits, and who has to approve a change to the workflow files?
How Steelwise can help
Working out what your build pipeline runs, what it can reach, and who can change it is a short, defined piece of work. Get in touch if you would like a second pair of eyes on yours.
Further reading
- GitHub: Workflow dependency lockfiles
- GitHub: Enforcing lockfiles for action dependencies
- Hugo van Kemenade: Lock your GitHub Actions
- NCSC: Supply chain security guidance