NewsCrawler.org

Why @v7-style tags in GitHub Actions are risky and how actions.lock replaces them

GitHub Actions で checkout@v7 のようなバージョン指定を書くのはやめよう! 時代は actions.lock!
Immutableマーク
Image: zenn.dev

An engineer working with Progate on a contract basis warns against referencing GitHub Actions with mutable tags like actions/checkout@v7. Such a tag resolves to the newest v7.x.x release for as long as maintainers keep re-pointing it to the latest commit, but it also means a workflow will automatically install a malicious version if an attacker publishes one and moves the tag. In March 2026, aquasecurity/trivy-action, the GitHub Action for the Trivy vulnerability scanner, was attacked this way: the attacker rewrote most of its version tags with a force push[1] and turned the Action into malware that steals credentials. Since the contents of the tags themselves were replaced, pinning a patch version such as @v7.0.1 would not have helped.

Pinning by tag only helps when the Immutable Releases[2] feature is enabled, which forbids reusing the tag name of an already published release; trivy-action uses it for v0.36.0, but actions/checkout did not as of October 29, 2026. GitHub's official documentation recommends locking with a lockfile[3] or, where a lockfile cannot be adopted, pinning the full-length commit SHA[4], written out completely so it cannot collide with another commit by prefix.

The actions.lock lockfile entered public preview on October 14, 2026 and became generally available (GA) on October 28, 2026, and GitHub's documentation calls it the best mitigation. The workflow file keeps readable version numbers while .github/workflows/actions.lock stores the commit hashes, and the lockfile also traces Actions invoked inside other Actions: in the trivy-action incident the tampered code lived in aquasecurity/setup-trivy, which trivy-action called internally, so pinning only the top-level Action would not have protected users. After installing the github/gh-actions-lock extension for the GitHub CLI, running gh actions-lock generates and updates the lockfile and rewrites vague tags like @v7 into exact versions; updating a workflow without regenerating the lockfile fails CI with an Invalid lockfile error.

Read the original zenn.dev

Sources

  • Zenn JA

    GitHub Actions で checkout@v7 のようなバージョン指定を書くのはやめよう! 時代は actions.lock!

    192 likes53 bookmarks0 comments

Published: First seen: Читать по-русски

Open as a page