The Spectrum Dispatch News

technology

GitHub Actions Now Supports Workflow Lockfiles for Supply Chain Security

A new lockfile feature lets developers pin GitHub Actions to specific commits, reducing vulnerability to tag-based supply chain attacks.

GitHub Actions Now Supports Workflow Lockfiles for Supply Chain Security

GitHub Actions now supports workflow lockfiles, a security feature that addresses vulnerabilities in how Actions are versioned and fetched from Git repositories.

GitHub Actions Now Supports Workflow Lockfiles for Supply Chain Security

Previously, the recommended practice was to pin Actions to full SHA hashes rather than tags, since tags are mutable and can be exploited in supply chain attacks where an attacker redirects a previously safe tag to malicious code. For example, a workflow might reference actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 to lock to a specific commit.

The new lockfile approach simplifies this process. Developers can install the gh-actions-lock extension for the GitHub CLI and run gh actions-lock in their repository. This tool converts workflows from SHA-pinned references back to semantic version tags (like v7.0.1) while generating a machine-readable lockfile at .github/workflows/actions.lock that records the exact commit SHA for each Action.

According to the source, the lockfile format includes version information, a list of workflows and their dependencies, and detailed commit data for each pinned Action, including repository IDs and owner IDs. This allows version tags to remain human-readable in workflow files while maintaining cryptographic verification through the lockfile.

Both Renovate and Dependabot already support lockfiles, meaning periodic dependency updates will automatically refresh both workflows and lockfiles. GitHub recommends validating lockfiles in CI pipelines to ensure they remain synchronized with workflow definitions and that locked pins still verify upstream. This can be accomplished by running gh actions-lock --verify as a separate CI job.

The source also recommends using zizmor, a security linter for GitHub Actions. Versions before v1.32.0 recommended hash-pinning, but v1.32.0 and later support the new lockfile approach. Developers can integrate zizmor into their pre-commit hooks to catch security issues automatically.

The lockfile feature represents a shift toward making supply chain security for GitHub Actions more maintainable by reducing the friction of SHA-pinning while preserving cryptographic guarantees through machine-generated lockfiles.

Key facts

  • GitHub Actions now supports workflow lockfiles to prevent supply chain attacks through tag mutation
  • Developers can use the gh-actions-lock CLI extension to convert SHA-pinned Actions to semantic version tags backed by lockfiles
  • The lockfile records exact commit SHAs, repository IDs, and owner information for each pinned Action
  • Both Renovate and Dependabot support lockfiles for automated dependency updates
  • GitHub recommends validating lockfiles in CI using gh actions-lock –verify to ensure they stay in sync

Sources

← All posts