Skip to content
Rush Commerce
Software & Dev3 min read

Cloudflare can now block npm installs by name and version

Cloudflare Gateway shipped package registry security: HTTP policies that see npm, PyPI, Cargo and Maven downloads and allow or block them by name, version, and namespace.

Every supply chain post we've written for the past year ends the same way: know what your build installs. The honest problem with that advice is that most small teams have no place to enforce it. On August 13 Cloudflare shipped one. Cloudflare Gateway now detects package downloads and lets you write allow or block policies against them — by ecosystem, by package name, by version, at the network layer, before the bytes reach a laptop or a CI runner.

What actually happened

Per Cloudflare's package registry security docs, Gateway HTTP policies gained four new selectors: pkg.ecosystem, pkg.name, pkg.version, and pkg.namespace. A fifth, pkg.purl, is API-only. Seven ecosystems are detected today — npm, PyPI, RubyGems, Cargo, Go, Maven, and NuGet.

Two details make it more than a checkbox. First, detection reads the structure of the HTTP request URL rather than matching a registry hostname, so it also fires on traffic through corporate proxies like Artifactory, self-hosted mirrors, and CDN-fronted endpoints. Second, pkg.version supports real comparison operators — ==, !=, >, >=, <, <= — so "block this package below 2.4.1" is a policy, not a wiki page.

The requirements are where the work is. Package registry security needs TLS decryption enabled on the inspected traffic, and language runtimes that keep their own certificate stores need the inspection certificate installed in them. Node, Python, and Go each verify certificates their own way; the OS trust store is not enough. Detection is also fail-open: a request Gateway can't classify passes through.

Cloudflare shipped a second thing the same day that costs nothing to turn on — Certificate Transparency Monitoring went generally available on every plan, with certificates Cloudflare issues on your behalf now filtered out of the alerts. That was the reason most people muted it.

Why it matters for your business

The reason this lands is that it's a different layer than everything else you've been told to do. Lockfiles, hash pinning, and Dependabot cooldowns govern what your repository declares. They do not govern what a developer types into a terminal at 11pm, what a build script fetches transitively, or what a compromised tool pulls on its own — which is precisely how the LiteLLM compromise traveled. A network policy sees the fetch regardless of who initiated it.

For a five-person shop already on Cloudflare Zero Trust, the first useful policy is small: block the ecosystems you don't ship in. If nobody on the team writes Ruby or Rust, pkg.ecosystem in {rubygems, cargo} → Block is a one-line reduction in attack surface with zero engineering cost. The second is a named blocklist you can update in minutes when the next compromised-package advisory lands — the gap between "we read the advisory" and "the package can no longer be installed here" drops from a sprint to a policy save.

What we'd flag before you plan around it: TLS decryption across developer machines is a real project, not a toggle, and the fail-open behavior means this is a control that raises cost for an attacker rather than a guarantee. Treat it as the enforcement point your existing lockfile discipline never had, not as a replacement for it.

Key takeaways

  • Cloudflare Gateway HTTP policies now support pkg.ecosystem, pkg.name, pkg.version, and pkg.namespace selectors, plus API-only pkg.purl
  • Seven ecosystems detected: npm, PyPI, RubyGems, Cargo, Go, Maven, NuGet — matched on URL structure, so proxies, mirrors, and CDN endpoints are covered
  • pkg.version takes comparison operators, so version floors and ceilings become enforceable policy rather than documentation
  • Requires TLS decryption, and runtimes with their own trust stores need the inspection certificate installed; unclassified requests fail open
  • Certificate Transparency Monitoring also went GA on every Cloudflare plan at no cost, with self-issued certificate noise filtered out of alerts

Have the tooling but not the policy? We set up supply chain guardrails for small teams — network-layer package policy, hash-pinned builds, and short-lived CI credentials that survive the next advisory. See what we build or send us your setup.

Sources: Cloudflare Developer Docs, Cloudflare Blog.

  • #supply-chain
  • #cloudflare
  • #npm
  • #developer-tools
  • #security
TR

Tommy Rush — Founder, Rush Commerce

Operator turned builder. 15+ years running operations — now shipping the systems businesses run on. More

Get The Rush Report weekly — one email, zero fluff.