Lock Your GitHub Actions hugovk.dev · 84 points · 17 comments · HN thread TL;DR ...

@best

Lock Your GitHub Actions hugovk.dev · 84 points · 17 comments · HN thread

TL;DR Hugo van Kemenade describes how to adopt GitHub Actions' new workflow lockfiles (gh actions-lock) so workflows can use readable vX.Y.Z tags while still being protected from tag-moving supply-chain attacks. The post covers installing the gh extension, generating an actions.lock file, keeping Renovate/Dependabot in sync, verifying the lockfile in CI, and using zizmor v1.32.0+ to lint workflows.

  • Previously the advice was to pin actions to a full commit SHA, because tags are mutable and can be repointed at malicious code.
  • Install the github/gh-actions-lock gh extension and run gh actions-lock, which rewrites uses: lines to version tags and generates .github/workflows/actions.lock with commit SHAs and owner/repo IDs.
  • Renovate and Dependabot already support the lockfile; the author recommends using cooldowns for updates.
  • Add a separate CI job that runs gh actions-lock --verify (pinned to an extension version) to catch out-of-sync or unverifiable pins.
  • zizmor v1.32.0 is the first version that supports lockfiles; older versions recommend hash-pinning.

Discussion The thread is a mix of practical praise and skepticism about GitHub Actions in general. The maintainer of zizmor, woodruffw, adds detailed caveats: lockfiles only cover normal action calls, not reusable workflows, Docker images, or actions that run npx at runtime, and composite actions are only locked transitively, so the current default can weaken pins. Several commenters question whether the feature beats plain SHA pinning, and others argue the whole ecosystem is too risky and suggest avoiding third-party actions or running CI elsewhere. The mood is cautiously informed and somewhat cynical about GitHub's design choices.

  • Lockfiles are a real improvement over SHA pinning (some): Commenters note that lockfiles pin transitive dependencies and refuse impostor commits from forks, which hash-pinning alone did not reliably handle. Woodruffw calls it an excellent, long-awaited feature despite its gaps.
  • Lockfiles still leave significant gaps (many): Woodruffw lists unlocked reusable workflows, composite action handling, Docker images, and runtime npx calls. Others note that a locked action can still pull in unpinned dependencies, so full immutability is not guaranteed.
  • Avoid GitHub Actions entirely (some): Several commenters argue GitHub Actions has a long bad history and that self-hosted or other build orchestrators are simpler, cheaper, and safer.
  • Copy actions into your repo instead of importing them (a few): One commenter suggests inlining small actions rather than depending on third-party scripts, since many uses are just one-line shell commands.
  • Lockfile is just SHA pinning with extra steps (a few): A commenter dismisses the feature as repackaged SHA pinning with a version comment, a view met with the reply that GitHub enforces it.
  • Only trust vendor actions or none at all (a few): Some use only actions from GitHub or their own org, and one avoids all third-party actions including official checkout to reduce risk.

#GitHubActions #supplyChain #CI #security #zizmor