ownlife-web-logo
First LookNpmSupply-chain-securityMalwareAugust 1, 20266 min read

npm Now Scans Every Package for Malware at Publish Time: and It Will Break Your CI/CD

npm now scans every package for malware at publish time, adding a 5–15 min delay. Here's what breaks in CI/CD pipelines, how to fix it, and why it matters.

Sponsor

npm Now Scans Every Package for Malware at Publish Time: and It Will Break Your CI/CD

Photo by ETA+ on Unsplash

npm Now Scans Every Package for Malware at Publish Time — and It Will Break Your CI/CD

Starting this week, every npm publish passes through an automated malware scan before the package becomes installable. It's the registry's most significant security gate in years, and it will break some CI/CD pipelines.

GitHub announced on July 28 that npm is introducing automatic scanning of packages at publish time, adding a delay of roughly five to fifteen minutes between running npm publish and a package becoming available for install. Packages flagged as malicious can be blocked outright. A new metadata requirement also forces publishers of "dual-use" packages — tools like network scanners or credential testers that have legitimate security applications but obvious abuse potential — to explicitly declare their intent.

For the vast majority of developers, this means updating a mental model: publishing is no longer instantaneous. For maintainers with automated release pipelines, it means real engineering work.

How the Scanning Works

The mechanics are straightforward. When you run npm publish, the registry now queues your package for automated analysis before making it available. The GitHub Blog changelog puts a typical scan at about five minutes, but can stretch to fifteen minutes or more during peak traffic or for larger, more complex packages. GitHub explicitly notes these times are not a service guarantee and may change as the scanning system evolves.

Three outcomes are possible: the package publishes normally, it gets held for manual review, or it's blocked. If blocked, the publisher receives a notification with an option to appeal.

There's an important operational detail here. While a scan is pending, npm dist-tag still works. But npm deprecate and npm unpublish won't function until the package clears scanning and becomes available. That asymmetry matters if your release automation chains multiple npm commands together.

The dual-use metadata requirement adds another layer. If your package contains capabilities that could be used for offensive security — think port scanners, exploit frameworks, credential harvesters — you'll need to declare that in your package metadata. GitHub hasn't published the full schema yet, but the changelog indicates this will be a required field for packages whose content triggers dual-use classification during the scan.

What This Breaks in CI/CD Pipelines (and How to Fix It)

If your CI/CD pipeline runs npm publish and then immediately tries to install the just-published version in a downstream step, it will fail. This is the most common pattern that needs updating.

The fix is simple but tedious: add a polling step or a delay after publish. Check npm view <package>@<version> in a loop until it resolves, or add a conservative wait. Neither is elegant, but both work. Monorepo setups that publish multiple interdependent packages in sequence are particularly exposed, since each package in the chain now carries its own scan delay.

Some teams will be tempted to hardcode a five-minute sleep. Don't. GitHub's changelog is clear that scan times are variable and subject to change. A retry loop with backoff is more resilient.

For teams using GitHub Actions, the integration path is likely smoother since GitHub controls both the registry and the CI platform. Expect first-party action steps or workflow templates to surface soon. For Jenkins, GitLab CI, or other platforms, you're writing the retry logic yourself.

The Supply Chain Context

This isn't happening in a vacuum. npm's malware problem has been escalating for years, and recent incidents have made the case for pre-publish scanning hard to argue against.

BleepingComputer's coverage details how multiple official SAP npm packages were compromised in a supply-chain attack attributed to TeamPCP. The attackers modified packages supporting SAP's Cloud Application Programming Model to include a malicious preinstall script that downloaded and executed an obfuscated payload. That payload stole credentials, authentication tokens, and environment variables from both developer machines and CI/CD runners — including attempting to extract secrets directly from runner process memory.

These weren't obscure packages. They were official SAP tooling used in enterprise development. The attack demonstrated that even well-maintained, widely-trusted packages can be weaponized through compromised maintainer accounts or build infrastructure.

GitHub had already been building toward this moment. Back in March, the company added malware detection to Dependabot, letting repositories receive alerts when their dependencies included known malicious versions. That system matched installed packages against advisories in the GitHub Advisory Database — useful, but reactive: by the time Dependabot flagged a compromised package, developers may have already installed and run it. Publish-time scanning shifts the defense upstream, catching malware before it enters the registry at all.

Is This Enough? The Security Theater Debate

Not everyone is convinced that scanning and delays solve the fundamental problem. A blog post by developer Outvi V argues that cooldown-based approaches are "security theater", pointing out a collective action problem: if everyone waits for someone else to vet a package, nobody actually does the vetting. "Everyone is waiting for everyone else to be the canary, and the canary does not exist," the post argues.

It's a fair critique, but it conflates two different mechanisms. Cooldown periods — where package managers like pnpm and Yarn delay installing newly published versions — rely on the hope that the community will spot problems during the waiting period. npm's publish-time scanning is different: it's automated analysis, not a waiting game. The scan doesn't depend on community vigilance; it depends on the quality of GitHub's detection engine.

That said, the detection engine is the critical variable. Automated scanners are good at catching known malware signatures and obvious obfuscation patterns. They're less reliable against novel attacks, especially ones that use legitimate-looking code paths or trigger malicious behavior only in specific environments. The SAP compromise, for instance, used an obfuscated payload downloaded at runtime — a pattern that's detectable but easy to evolve past.

The dual-use metadata requirement is an interesting hedge. By forcing publishers to self-declare offensive capabilities, npm creates a paper trail that makes it harder to claim ignorance. It also gives the scanning system a signal to weight: a package that contains network scanning code but doesn't declare dual-use intent is more suspicious than one that does.

The Broader Shift in Registry Security

npm's move fits a broader pattern worth tracking. Security frameworks across the industry are converging on the idea that automated classification and severity scoring need to happen before code reaches users, not after. As we explored in our coverage of Anthropic's jailbreak severity framework, the AI security world is grappling with the same challenge: building shared taxonomies and automated triage systems that can operate at the speed of deployment.

Package registries face a version of this problem at massive scale. npm processes enormous volumes of publishes daily, and any scanning system needs to balance thoroughness against latency. Five to fifteen minutes is a reasonable tradeoff for most workflows, but it sets a precedent. If scan times creep upward as detection grows more sophisticated, the developer experience cost rises with them.

Other ecosystems are watching: PyPI has experimented with malware detection, and crates.io has discussed similar measures for the Rust ecosystem. npm, as the largest package registry by volume, tends to set the template that others follow. If publish-time scanning proves effective at reducing supply-chain attacks without creating unacceptable friction, expect it to become a baseline expectation across language ecosystems within the next year or two.

What to Do Right Now

If you maintain npm packages, audit your publish workflows this week. Look for any step that assumes immediate availability after npm publish. Add retry logic. Test it against the new delay.

If you publish dual-use packages, review the metadata requirements in the GitHub changelog and update your package.json before your next release.

If you're a consumer of npm packages, this is good news that requires no action on your part. Publish-time scanning is an imperfect defense, but it's a meaningful one — especially against the class of low-sophistication attacks that make up the bulk of npm malware. The more interesting question is what happens when attackers adapt. That's when we'll find out whether GitHub's scanning engine can keep pace.

What's your next step?

Every journey begins with a single step. Which insight from this article will you act on first?

Sponsor