GitHub Actions finally gets lockfiles, ending the SHA-pinning era
Lock Your GitHub Actions
GitHub Actions now supports workflow lockfiles, so you can reference actions by version tag instead of pasting full commit SHAs. Hugo van Kemenade walks through installing the gh-actions-lock extension, running gh actions-lock to generate .github/workflows/actions.lock, and validating it in CI with a dedicated job. Renovate and Dependabot already update lockfiles, and zizmor v1.32.0 supports them too. The lockfile pins each tag to a verified commit, keeping supply-chain protection without the hash clutter.
Because GitHub Actions are fetched from Git, the previous advice was to pin to a full SHA instead of a tag. This is because tags are mutable and susceptible to supply-chain attacks where an attacker points a previously safe tag at malicious code.
- woodruffw
The advice here is really great (as I'd expect from Hugo), but as the maintainer of zizmor I want to note some caveats with the current iteration of workflow lockfiles:
- They only lock normal action calls. If your workflows invoke other reusable workflows, you need to keep those hash-pinned manually for now.
- Composite actions are not themselves locked. Instead, they get locked transitively through their callsites i.e. the workflows that call them. This makes any individual caller that uses lockfiles safe, but it also makes the current `gh actions-lock` default unsafe (since it removes hash-pins from the composite action itself, meaning that any external caller that invokes the action loses their transitive pinning).
- Other forms of `uses:` clauses, like Docker images, are also not currently locked via the lockfile. And the same for forms of interior mutability (like an action running `npx ...` under the hood, although the latter is fully outside of GitHub's control to prevent. But these mean that you can't assume that a fully locked Actions setup is in fact 100% immutable.
I hope they address these gaps soon, because it's otherwise an excellent (and long-awaited) feature.
- Already__Taken
Quoting someone else's blog I've forgotten but you're trading the trust in the repo owner not moving a tag for trusting whoever merges the commit hash to have checked that's a release in the repo you want and not _some_ forks commit. All forks on github are the same repo you can pin any commit, merged upstream or not.
IMO Github should make Immutable tags mandatory to publish on https://github.com/marketplace
- klodolph
I think my main advice is to avoid GH actions at all, unless avoiding them is somehow painful. There is just a long bad history here.
- SchemaLoad
Are people finding a real need for importing and updating git actions? Aren't they usually just running a one line bash command? I'd just copy paste the action in to your config so it's fully locked and under your control rather than importing some opaque script from a no name github user.
- insanitybit
ctrl + f "zizmor"
8 found
I endose this article.