TL;DR

For two years the advice for GitHub Actions security was “pin your actions to a full commit SHA.” I gave that advice too. It’s still right, but it only solves half the problem. A SHA tells you what code runs. It doesn’t tell you whose code it is. Because forks share an object store with their parent, a commit that exists only in an attacker’s fork can be referenced through the original repository’s name, and the workflow runs it. Add a provenance check to your pins, audit the triggers checkout v7 doesn’t cover, and get ready for December 2, when GitHub starts blocking pull_request_target by default on public repositories.

Originally published at portfolio.hagzag.com.

The PR that only changed forty hex characters

Picture the review. A pull request bumps one line in a workflow:

- uses: some-org/[email protected]   # v2.1.0
+ uses: some-org/[email protected]   # v2.1.1

Same owner/repo. Same comment style. A full 40-character SHA, which is exactly what your policy asks for. Most reviewers would approve it. Many do it from Dependabot without a second look.

Aiden Vaines showed what happens next. He forked his own test action to a different account, committed a new step in the fork, and opened a PR against a consuming repo that changed only the SHA to the fork’s commit. The uses: path still pointed at the original repository. The workflow ran the fork’s code. No provenance error, and no “commit not found.”

GitHub treats this as by design. A fork network shares one object graph, and if an object is reachable, it can be fetched through any repository in that network.

Trivy already showed us this

In March, aquasecurity/trivy was compromised. One reconstruction describes a commit titled fix(ci): Use correct checkout pinning that pinned actions/checkout to a SHA labeled # v6.0.2. That version doesn’t exist. The SHA belonged to a commit in a fork of actions/checkout, and it pulled build-time code from a typo-squatted domain into a release.

Accounts of the Trivy incident differ. Another write-up describes tag rewrites on trivy-action a few weeks later. I won’t claim certainty about every detail. The pattern is enough: the attack carried a pin and a plausible comment, and the pin passed every check that only asks “is it a SHA?”

The contrarian part: a pin is immutability, not provenance

We merged two different properties into one rule:

  • Immutability: the code behind this reference can’t change after I review it. A SHA gives you that, and it’s why pinning beat mutable tags like @v4.
  • Provenance: this code came from the maintainers I meant to trust. A SHA alone says nothing about that.

Tag-hijacking attacks are an immutability problem, so pinning stopped them, and we called the job done. Fork-commit attacks are a provenance problem, and they slip through the same control we’re proud of.

GitHub’s own 2026 fixes follow the same pattern: they close some of these attacks and leave others open. actions/checkout v7, released June 18, refuses to check out a fork PR’s head or merge commit under pull_request_target. Wiz’s Pwn Request Reckoning (October 26) sums it up: the changes “don’t eliminate the vulnerability class.” Here’s what still works, per Wiz:

  • SHA pins to old checkout releases. If your pin resolves to a release from before the backport, like v4.3.0, you get none of the new protection. Your careful pinning is what keeps you on the vulnerable version.
  • Other ways to fetch PR code: git clone, gh pr checkout and third-party checkout actions skip the guard.
  • Other triggers: issue_comment and repository_dispatch aren’t covered.
  • Script injection with no checkout at all: ${{ github.event.pull_request.title }} interpolated into run:.
  • Artifact poisoning: an unprivileged build uploads an artifact that a privileged workflow_run executes.
  • The escape hatch: allow-unsafe-pr-checkout: true.

What I’d add on top of pinning

1. Verify every pinned SHA is on an upstream tag. This is a cheap provenance check you can run in CI:

#!/usr/bin/env bash
# For each "uses: owner/repo@<40-hex>" in workflows, confirm the SHA is
# what an upstream tag points to. A fork-only commit won't match any tag.
set -uo pipefail
fail=0
while IFS=@ read -r ref sha; do
  repo=$(echo "$ref" | cut -d/ -f1-2)            # drop sub-paths like owner/repo/sub
  tags=$(git ls-remote --tags "https://github.com/$repo" </dev/null)
  if grep -q "^$sha" <<<"$tags"; then
    echo "OK      $repo@$sha"                      # matches a tag (incl. peeled ^{})
  else
    echo "UNKNOWN $repo@$sha  <- not on any upstream tag, review it"
    fail=1
  fi
done < <(grep -rhoE 'uses:\s*[^@ ]+@[0-9a-f]{40}' .github/workflows \
           | sed -E 's/uses:\s*//' | sort -u)
exit $fail

It has limits. A SHA on an upstream branch with no tag shows as UNKNOWN, which is exactly what you want a human to look at. Pair it with Dependabot or Renovate so pins move to tagged releases, not to arbitrary commits.

2. Run a workflow linter that understands these attacks. zizmor flags pull_request_target misuse, template injection and unpinned uses. actionlint covers the basics. Fail the build on new findings.

3. Fix the trigger, not just the checkout. Use pull_request unless you truly need secrets. Pass event data through env: and never interpolate it into run:. Put privileged jobs behind environments with required reviewers. That’s the same “push access shouldn’t mean secret access” point from The AI Vendor You Forgot to Offboard.

4. Shrink what a hijacked step can reach. Default permissions: contents: read, OIDC instead of stored cloud secrets, and egress control on runners (StepSecurity’s harden-runner with egress-policy: block). If a fork commit does run, it should find nothing worth stealing and nowhere to send it.

5. Prepare for December 2. Per Wiz, GitHub will begin enforcing a default policy that blocks pull_request_target on public repositories with no explicit event policy. If an open-source repo relies on it, decide now whether to set a policy or migrate. Don’t find out from a broken release pipeline.

What actually goes wrong

The tag check above will annoy people. Plenty of good actions publish fixes on main before tagging, and teams pin to those commits to get a fix early. You’ll need an allowlist with an owner and an expiry for each exception. Otherwise people just disable the check.

There’s a time cost too. Patch windows are shrinking: Google’s Project Zero has moved to fixed 30-day disclosure, and it says patch soak time “is no longer meaningful.” Stricter pin review means slower updates, and slower updates mean longer exposure to known bugs. The answer isn’t to skip review. It’s automation that moves you to the next tagged release quickly, so humans review the exceptions instead of every bump.

Conclusion

SHA pinning stopped attackers from changing code after you trusted it. It never proved that you trusted the right code in the first place. In 2026 attackers worked out that difference, and our policies are still catching up. Keep your pins, add a provenance check, and audit triggers instead of trusting the checkout action to protect you. And put December 2 on your calendar.