A practical guide to implementing dependency lockfiles in GitHub Actions, the new GA feature that pins specific commits in your workflows.
GitHub has released workflow dependency lockfiles in GitHub Actions for general availability, just two weeks after entering public preview. This feature solves a known problem: when you use a reference like actions/checkout@v4, that tag can change without your repository being modified. An attacker who compromises an action can inject malicious code into your pipeline without leaving a trace in your code.
The traditional solution was to pin full commits with SHAs, but this reduces readability and doesn't cover transitive dependencies of composite actions. Lockfiles record the commits of both direct and transitive dependencies in a .github/workflows/actions.lock file, and the runner executes exactly those commits even if tags or branches change later.
What You Need
To implement lockfiles, you need access to GitHub Enterprise Cloud, Enterprise Cloud with data residency, Team plan, or Free plan. You will also need to install the gh actions-lock extension for the GitHub CLI, hosted in the gh-actions-lock repository. This tool generates and maintains the lockfile.
- GitHub CLI installed on your local machine
- Write permissions to the repository where you want to enable lockfiles
- Existing workflows you want to protect
- Dependabot configured if you want synchronized automatic updates

Steps to Implement Lockfiles
- Install the extension by running
gh extension install github/gh-actions-lockin your terminal. - Navigate to the repository where you want to enable lockfiles and run
gh actions-lock initto generate the.github/workflows/actions.lockfile. - Review the dependencies listed in the lockfile before committing. GitHub explicitly warns that the lockfile guarantees you use the locked commits, but it does not determine if those commits are secure.
- Add the lockfile to your repository with a normal commit and push.
- Configure the verification mode in your CI by running
gh actions-lock verifyas a pipeline step to detect differences between workflows and the lockfile.
Adoption can be incremental. Once a workflow is configured, each dependency needs an entry in the lockfile. This allows migrating flow by flow instead of converting an entire organization at once. We recommend starting with high-privilege workflows like release or deployment workflows.
Governance Policies and Limitations
Enterprise, organization, or repository administrators can enable a "Require lockfile" policy to enforce adoption at the corresponding scope. Refer to the official lockfile documentation for detailed configuration instructions.
It's important to understand the limitations: the lockfile does not evaluate whether locked dependencies are trustworthy. The security value depends on the review that occurs when an entry is created or updated. In practice, the Dependabot pull request becomes the review point. Teams that auto-merge these updates without review could propagate malicious code directly into the lockfile.

Comparison with Other Platforms
GitLab recommends manually pinning includes and components to commit SHAs, as well as pinning images to digests. After the incidents in March 2026, they introduced pipeline execution policies that block known attack patterns instead of creating a dependency manifest. Azure Pipelines follows the Microsoft Zero Trust guide which suggests SHA pinning and limiting Marketplace extensions.
Cross-platform tools like pinner and ActionSieve help pin references and detect missing pins, but they do not resolve transitive dependencies. This is precisely the gap that GitHub's lockfile design addresses, although none of these solutions judge whether a pinned dependency is trustworthy.
Original source: infoq.com
Article generated with AI.larebelion



Publicar un comentario