Software Supply Chain Security: A Practical Guide
Software supply chain security explained with real npm, PyPI and GitHub Actions attacks, and the lockfile, pinning, malware and SBOM controls that stop them.
Software supply chain security means knowing every package, build tool and pipeline that goes into your software, and stopping a compromised one before it ships. In practice that comes down to five controls: enforced lockfiles, malware detection on every package, pinned CI actions, short-lived publishing tokens and a continuously checked inventory of what you run.
This guide walks through the attacks that shaped the field in 2024 and 2025, each linked to its primary source, then the controls that would have stopped them, with commands you can run today. It is written by Strac, a Y Combinator-backed data security company trusted by enterprises, which runs dependency scanning, secret scanning and cloud checks in one platform.
Your software supply chain is everything you did not write but still ship: open-source packages and the packages they pull in, container base images, GitHub Actions, build tools, and the registries and accounts that publish them. Attackers have learned that compromising one popular link reaches thousands of companies at once. Every recent incident fits one of four paths:

Notice what is missing: a vulnerability. All four paths involve code that is malicious on purpose, so there is no CVE for a scanner to match until someone reports it. That is why software supply chain security needs more than the vulnerability scanning most teams already run. Our guide to software composition analysis covers the vulnerability side in depth.
A few incidents in the last two years show each attack path in action. Every row links to the primary source.
| When | Incident | Path | What it did |
|---|---|---|---|
| Mar 2024 | xz Utils backdoor (CVE-2024-3094) | Long-game insider | A contributor who earned maintainer trust over years shipped a backdoor in the compression library |
| Dec 2024 | Ultralytics on PyPI | Compromised CI/CD | A GitHub Actions compromise led to a stolen PyPI token and releases carrying a crypto miner |
| Mar 2025 | tj-actions/changed-files (CVE-2025-30066) | Compromised CI/CD | Repository tags were moved to malicious code that exposed secrets in workflow logs |
| Sep 2025 | Shai-Hulud npm worm | Hijacked maintainers | A self-replicating worm compromised more than 500 npm packages and stole tokens and secrets |
The tj-actions incident is the clearest lesson for CI. Thousands of workflows referenced the action by a tag such as @v45. When the tag was moved to a malicious commit, every one of those workflows ran the new code on its next build. Workflows pinned to a full commit SHA were unaffected.
npm malware rarely looks like malware. It is usually a normal package with one extra file and one extra line in package.json: an install script that runs automatically the moment the package is installed, with the full access of whoever ran npm install. On a developer laptop that means SSH keys, cloud credentials and npm tokens. In CI it means every secret the pipeline holds.

The 2025 worm added one twist: it used stolen npm tokens to publish infected versions of other packages the victim maintained, so it spread without any further attacker effort. You can see which packages in your tree run install scripts today:
# list every dependency that declares an install-time script
npm query ":attr(scripts, [preinstall]), :attr(scripts, [install]), :attr(scripts, [postinstall])" \
| jq -r '.[] | "\(.name)@\(.version)"'
# install without running any lifecycle scripts (then allow-list the few you need)
npm ci --ignore-scriptsAI coding agents add a new source of risk. Agents install packages on a developer's behalf and occasionally invent package names that do not exist, which attackers can register. We cover that and the look-alike problem in our guide to detecting malicious npm and PyPI packages.
Would you know within the hour if a package you use was hijacked?
Book a demo of Strac's supply chain scanning · Run a free security scan
A lockfile records the exact version and integrity hash of every package in your tree, including transitive ones. Committing it, and installing from it, means a newly published malicious version cannot slip into a build just because it matches a version range.
| Ecosystem | Lockfile | Install exactly from it |
|---|---|---|
| npm | package-lock.json | npm ci |
| pnpm | pnpm-lock.yaml | pnpm install --frozen-lockfile |
| Yarn | yarn.lock | yarn install --immutable |
| Python (pip) | requirements.txt with hashes | pip install --require-hashes -r requirements.txt |
| Poetry / uv | poetry.lock / uv.lock | poetry sync / uv sync --locked |
| Go | go.sum | go mod verify |
Pair it with a cooling-off period. Most hijacked releases are found and pulled within days, so waiting before adopting brand-new versions removes a large share of the risk at almost no cost. Most dependency update bots can be configured to wait a set number of days after a release before proposing it.
Treat your pipeline as part of the supply chain, because it is. Pin third-party actions to a full commit SHA, give the workflow token the least permission it needs, and prefer short-lived credentials over long-lived secrets:
permissions:
contents: read # default the GITHUB_TOKEN to read-only
steps:
# pinned to a commit SHA, with the version in a comment for humans
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2On the publishing side, GitHub announced a plan for a more secure npm supply chain after the 2025 attacks: trusted publishing from CI, publishing tokens that expire, and mandatory two-factor authentication for local publishing. If you maintain packages, move to trusted publishing. The SLSA framework and OpenSSF Scorecard are useful yardsticks for both your own builds and the projects you depend on.
A vulnerability scanner asks whether a package version has a known flaw. A malware check asks whether the package itself is hostile. You need both, and you need the second one to run continuously, because a package that was clean when you installed it can be reported as malicious tomorrow. This is what that looks like in Strac: the dependency chain, how serious it is, and the fix in one click.

Strac reads every lockfile in your GitHub or GitLab repos, builds an inventory of every direct and transitive package, and checks it against vulnerability and malware databases. When a new advisory or malware report lands, it is matched against that inventory without rescanning, so you learn whether you are affected in seconds. Look-alike package names are flagged too. Fixes come as a pull request with the smallest safe upgrade. See how Strac's SCA works.
Every supply chain attack in the table above was ultimately after credentials. The best defense is to have fewer of them lying around. Strac's secret scanning searches every file and the full git history of every repo for API keys and tokens, checks with a read-only call whether each one still works, and fails pull requests that add new ones. Because Strac is a data security company first, its DLP also finds the same keys pasted into Slack, Google Drive and AI chats, places a git-only scanner cannot follow. If a bad package did run on a machine, rotate every token it could have read, starting with npm, GitHub and cloud keys.
A software bill of materials is the inventory that makes incident response fast. When the next worm hits the news, the question is always the same: do we run any affected version, anywhere? Teams with a current SBOM answer in minutes. Teams without one grep through repos for a day. Our SBOM guide covers formats and how to generate one from lockfiles, and Strac exports CycloneDX and SPDX on demand.

Every FROM line pulls in an operating system's worth of packages you did not choose. Treat base images like dependencies: pin them by digest so a re-tagged image cannot change under you, prefer slim or minimal bases with fewer packages to patch, and rebuild on a schedule so security fixes actually reach production.
# look up the digest behind a tag
docker buildx imagetools inspect node:22-slim
# Dockerfile: pin by digest, keep the tag in a comment for humans
FROM node:22-slim@sha256:<digest-from-the-command-above> # node:22-slimInside the image, the same lockfile rules apply: copy the lockfile first and install with npm ci or its equivalent, never a bare install that can resolve new versions at build time.
When the next incident hits the news, work through the same five steps every time:
# when did this package enter (or leave) the lockfile?
git log -S 'compromised-package' --oneline -- package-lock.jsonYou do not need a dedicated team to cover most of the risk. A realistic first month looks like this:
npm ci or its equivalent.A quick way to see where you stand is Strac's free scan: connect GitHub, pick up to 10 repos, and get a report of leaked secrets and vulnerable or malicious packages.

Supply chain questions now show up in every enterprise security questionnaire: do you scan dependencies, how fast do you patch, can you provide an SBOM, how do you secure CI. SOC 2 touches the same ground through vulnerability detection (CC7.1), change management (CC8.1) and vendor risk (CC9.2), as covered in our SOC 2 controls guide. With Strac, dependency fixes, secret rotations and cloud checks are saved as SOC 2, ISO 27001 and HIPAA evidence automatically, in the same platform as compliance automation and the AI pen test, so the answers to those questionnaires are already written down. For a comparison of tools in this space, see our roundup of the best SCA tools, and for how it all fits together, our guide to application security posture management.
One practical tip: keep a short written description of your supply chain controls, covering lockfiles, pinned actions, scanning, token policy and incident steps. It answers half of every vendor questionnaire, and it doubles as the onboarding document for the next engineer who touches CI.
See every package you ship, and every one that should not be there.
Book a demo of Strac's software supply chain security · Run a free security scan
Software supply chain security is protecting everything that goes into your software besides the code your team writes: open-source packages, build tools, CI/CD pipelines, container images and the accounts that publish them. The goal is to know every component you ship and to stop a compromised one before it reaches production.
In September 2025 a self-replicating worm known as Shai-Hulud compromised more than 500 npm packages, according to CISA. Each infected package stole tokens from the machine that installed it and used them to publish infected versions of more packages.
Commit and enforce lockfiles, install with npm ci, block install scripts where you can, wait before adopting brand-new versions, and run a scanner that checks every package against a malware feed, not only a vulnerability database. Rotate any token exposed on a machine that installed a bad package.
No. An SBOM is an inventory: it tells you what you ship. It does not block a malicious package or fix a vulnerable one. It becomes valuable when it is kept current and checked continuously against new advisories.
Indirectly. SOC 2 asks you to detect vulnerabilities (CC7.1), manage changes (CC8.1) and manage vendor risk (CC9.2). Open-source dependencies and CI tools fall under all three, and auditors increasingly ask how you vet them.
.avif)
.avif)
.avif)
.avif)
.avif)


.gif)

