Lesson 12 of 14 · 14m
Your CI Is the Attacker's Compute
Mutable action tags, pull_request_target, and over-privileged tokens hand your secrets to anyone who can open a PR.
uses: tj-actions/changed-files@v45 is a mutable pointer
A GitHub Actions workflow that references foo/action@v3 resolves that tag to a commit at run time. Tags move. On March 14–15, 2025, someone pushed a malicious commit to tj-actions/changed-files and re-pointed essentially every version tag — @v1 through @v46 — at it (CVE-2025-30066). Thousands of workflows that had done nothing wrong suddenly ran code that dumped CI secrets into public build logs, base64-wrapped. Pinning by tag was the vulnerability; the fix GitHub and hardening guides converged on is pinning by full commit SHA:
uses: tj-actions/changed-files@aabbccddeeff00112233445566778899aabbccdd # v46.0.1The SHA can't be re-pointed. The comment keeps the version readable for the next human. GitHub added an org/repo setting to require SHA pinning for all actions — turn it on and the mutable-tag attack class dies for your workflows.
Codecov already proved the pattern
January 31, 2021: Codecov's bash uploader script — curl https://codecov.io/bash | bash in ten thousand pipelines — was modified on their server. For over two months it exfiltrated environment variables: credentials, tokens, secrets, whatever CI exported. Disclosed April 15. The lesson isn't "Codecov was careless" — it's that curl | bash and mutable action refs both mean "run whatever this endpoint serves today, with my secrets in scope."
pull_request_target: secrets on fork code
The subtlest GitHub trap. pull_request runs the PR's workflow with no secrets for forks — safe. pull_request_target runs the base repo's workflow with secrets and a write-capable GITHUB_TOKEN — designed for labeling/commenting on PRs. If that workflow then does actions/checkout of the PR's head and runs its code — a test suite, a build, npm install on a poisoned package.json — you've handed repo write access and every secret to anyone who can open a pull request. The rule is absolute: under pull_request_target, never check out or execute PR-head code. Checkout the base ref, or use a separate unprivileged workflow. If you need secrets to comment on a PR, split the jobs: unprivileged job runs the code, privileged job posts the result — never both in one context.
The token and the runner
GITHUB_TOKEN defaults matter: grant permissions: explicitly — start at contents: read and add only what the job needs. A contents: write token in a job that runs third-party actions is lateral movement waiting.
Self-hosted runners on public repos are worse than they look: a poisoned job on a persistent runner can leave implants that survive between builds. Ephemeral runners — one VM per job — collapse persistence. If self-hosted is unavoidable, restrict them to private repos and treat the runner image as rebuildable.
And for deploy credentials, OIDC replaces stored secrets entirely: GitHub's job token → aws-actions/configure-aws-credentials role assumption, or GCP Workload Identity. A credential that expires with the job can't be exfiltrated and replayed next month.
The wrong mental model
"CI is infrastructure, not attack surface." CI is where your secrets, your signing keys, and your deploy credentials live — and it executes third-party code every run, by design. Egress filtering (step-security/harden-runner, or firewall rules on self-hosted runners) is the last control: a payload that can't reach its endpoint can't exfiltrate. The tj-actions attacker didn't compromise ten thousand orgs; they compromised one GitHub account, and ten thousand orgs' pipelines ran the payload themselves.
Practice
- SHA-pin every action; enable the org-level "require SHA pinning" policy.
permissions:on every job, starting minimal.- Secrets only in jobs behind
environment:protection rules where reviewers gate access. - Never run PR code under
pull_request_target. - Ephemeral runners; OIDC for cloud auth;
npm ci --ignore-scriptsinside jobs that install untrusted trees.
Every line of your workflow file is a dependency. Pin it like one.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Buying Time: Package Managers Are Adding Delay as a Security Control
Composer 2.11 shipped a cooldown that refuses to install a version until it has aged. vlt now holds npm publishes until their dependencies actually exist, because 22% of new npm versions land broken. And Ruby Central's reviewers threw out 90% of what an AI scanner flagged.
Your npm Install Just Ran Someone Else's Code: Why Dependency Security Has to Start Before CI
A pull request checkout, a poisoned GitHub Actions cache, and an OIDC token pulled straight out of runner memory. That's how 84 malicious versions of TanStack's packages hit npm in six minutes.
CVE-2025-62718: Critical Axios SSRF Vulnerability Explained
A critical SSRF flaw in Axios was used in a North Korean supply chain attack. Here's what it does and how to patch it today.
What is Supply Chain Security? Dependencies, SBOMs, and the Attack That Hit 2.6 Billion npm Downloads
Your application is only as secure as every package it depends on. In September 2025, attackers compromised 27 npm packages with 2.6 billion weekly downloads by phishing one maintainer.