In one line: GitHub Actions workflow lockfiles bring the Cargo.lock / package-lock.json split to CI — your workflow says the tag (the intent), and what actually runs is the SHA recorded in the lockfile (the resolution). What makes this different from hand-pinning SHAs comes down to two things: (1) it pins transitive dependencies (the actions your actions call), and (2) the runner checks, at job start, the repository's numeric IDs and whether the commit is reachable from the recorded ref.
gh actions-lock, generates .github/workflows/actions.lock.v1 tag of reviewdog/action-setup was repointed to a malicious commit. tj-actions/eslint-changed-files used that action as a composite step, and running it leaked a tj-actions token, which was then used to rewrite the changed-files tags. That made a real, costly lesson of the fact that pinning your own workflow by SHA doesn't help if an action you use calls @v1 inside.uses: owner/repo@v3 fetches whatever commit the v3 tag or branch points to at run time. Git tags can be moved, so nothing guarantees that the code you reviewed is the code that runs. The standard advice has been "pin to a full-length commit SHA and put the version in a comment," but that approach has four structural holes:
uses: lines in your own YAML. If that action is a composite action that calls other/action@v1, the tag is resolved again on every run. That's exactly the path the tj-actions attack took.owner/repo@SHA. It looks exactly like a correct SHA pin (zizmor's impostor-commit audit detects this).owner/repo is only a name. A SHA pin has no way to express that a transfer, deletion, or re-creation could leave a different repository behind the same name.ref-version-mismatch audit targets this).What we wanted was what language package managers already take for granted: a split between the manifest (intent) and the lockfile (resolution), plus the executor verifying that resolution.
# This file is machine-generated by `gh actions-lock`.
version: 'v0.0.3'
workflows:
'.github/workflows/lint.yml':
- 'actions/[email protected]'
- 'j178/[email protected]'
dependencies:
'actions/[email protected]':
ref: 'v7.0.1'
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
owner_id: 44036562
repo_id: 197814629
workflows: which dependencies each onboarded workflow uses.dependencies: which commit each reference resolved to. It records ref (the tag or branch it was resolved from), commit (the code that will actually run), and owner_id and repo_id (the source repository's numeric identity).uses: actions/[email protected]. A partial version like @v3 is narrowed to the full version it resolved to, such as @v3.1.0. The commit doesn't change, and --no-narrow turns this off.