Skip to content

Lesson 8 of 13 · 20m

Supply Chain: Pin Everything Your Pipeline Trusts

Tags move and digests don't — pinning actions to SHAs, images to digests, and dependencies to a lockfile is what stands between you and the next tj-actions.

Every uses: line is remote code execution resolved at run time. actions/checkout@v5 is not a version — it's a git tag, and tags are mutable: the repository's owner can point v5 at a different commit tomorrow, and your next run executes that commit with your GITHUB_TOKEN, your secrets, and your runner. The supply chain of your pipeline is every action you trust, every package the lockfile resolves, and every base image you pull — and it gets attacked on a schedule.

The incident that made it concrete

On March 14–15, 2025, tj-actions/changed-files — a popular action in thousands of workflows — had every version tag re-pointed to a malicious commit (CVE-2025-30066). Any workflow that ran in the window executed code that walked process.env and dumped secrets to the workflow log, base64-wrapped so they'd survive masking. Public repos leaked credentials into publicly readable logs; Coinbase's agentkit was among the targeted repos, per Palo Alto Unit 42's writeup. The poison never touched the action's source branches — only the tags moved. Workflows pinned to @v45 ran the malicious commit. Workflows pinned to a full commit SHA ran the commit they always ran.

Four years earlier, Codecov's bash uploader got the same treatment — modified in January 2021, disclosed in April — exfiltrating CI environment variables from every repo that used it. Same mechanism, same lesson: code your pipeline runs from someone else's repo is only as immutable as the ref you name.

The pinning discipline

Pin every uses: to a full-length commit SHA, and keep the human-readable version in a comment:

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

A full SHA is immutable — it names content, not a pointer. A tag is a promise someone else keeps. This costs nothing operationally: Dependabot updates pinned SHAs for the github-actions package ecosystem, and Renovate does the same — you get update PRs with real diffs to review instead of silent tag drift.

The same rule applies to containers. node:22 is a tag that moves; node:22@sha256:… is a digest that can't. Dockerfiles, image: fields in service containers, and deploy manifests all want digests when reproducibility matters — and in deploy manifests it always matters.

Keeping pinned SHAs current is a solved problem — Dependabot's github-actions ecosystem opens update PRs for them:

# .github/dependabot.yml
version: 2
updates:
  - package-ecosystem: github-actions
    directory: /
    schedule: { interval: weekly }

Each PR bumps the SHA and the comment together — a reviewable diff instead of silent drift.

The lockfile is the dependency record

npm ci installs exactly what package-lock.json says — resolved URL, integrity sha512, pinned version — and fails on drift. The lockfile is your supply-chain record: npm audit and osv-scanner read it against the advisory databases, and a dependency-bump PR shows a lockfile diff, which is why lockfile diffs deserve review attention instead of a scroll-past. A diff that touches ten thousand lines to bump lodash is where a typosquat hides.

GITHUB_TOKEN deserves the same minimalism — default it to nothing and elevate per job:

permissions: { contents: read }
jobs:
  release:
    permissions: { contents: write, id-token: write }

A workflow that declares no permissions inherits the repo default — which for repos created before February 2023 can still be read-write on everything. Read-write is what attackers want; it's how a stolen GITHUB_TOKEN commits malicious code into the repo that trusted it.

Field notes

  • Audit on: triggers when reviewing workflow diffs — a new pull_request_target is a threat-model change, not a YAML change.
  • step-security/harden-runner (egress auditing) and OSSF Scorecard (ossf/scorecard-action) instrument the pipeline against itself.
  • First-party actions from actions/ and github/ are a smaller blast radius than a stranger's repo — but the tag is still mutable. Pin anyway; the comment keeps it readable.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.