Key Takeaways
- Git URL and remote tarball dependencies are fetched from their own location, never through your registry.
- Across 53,707 package versions we track, 811 dependency specs resolve outside the registry.
- Branch, tag, and unpinned references are the real risk, since their code can change without a release.
- A byte-for-byte rebuild proves fidelity, not containment, so a faithfully reproduced escape is still an escape.
Most teams that run a private npm registry describe it the same way. Everything goes through Nexus or Artifactory, the public registry sits behind a proxy, and nothing lands on a developer laptop or a CI runner without passing through the one door they control.
That’s mostly true. It’s the “mostly” that’s worth talking about.
While building SecureChain, TuxCare’s service that rebuilds open source packages from source and ships them with provenance, we went looking for the cases where it isn’t true. We went through 53,707 versions of the npm packages in the dependency graph we track and flagged every dependency that tells npm to skip the registry altogether. This post covers what we found, why your registry configuration can’t redirect these dependencies, and what to check in your own projects this week.
What we mean by an escaping dependency
A mirror-escaping dependency is a dependency declared with a git URL, a tarball URL, or some other remote location instead of a package name and version range, so npm fetches it directly from that location rather than resolving it through your registry.
Here’s one. The names are changed, but the shape is exactly what we found in the runtime dependencies of a published package:
"dependencies": {
"lodash": "^4.15.0",
"some-markdown-lib": "git://github.com/some-user/some-markdown-lib.git"
}
The first line is the normal case. npm asks whatever registry you’ve configured for a lodash version that satisfies ^4.15.0. The second line has no version, no commit, and no registry. It names a repository on a personal GitHub account, and npm fetches whatever happens to be on its default branch at the moment you install.
If that git:// prefix looks dead to you, good eye. GitHub switched off the unauthenticated git protocol back in 2022. That doesn’t make the dependency inert. npm normalizes GitHub git:// URLs to HTTPS, so on any setup that allows git dependencies, it still resolves and installs. A spec that looks broken in code review works fine in practice, which is a pretty good way for something to stay unnoticed for years.
Why your registry settings can’t touch it
The registry setting in .npmrc answers one question. When a dependency is a name and a range, where should npm look it up? A git URL or an HTTPS tarball link isn’t that kind of dependency. It carries its own location, and npm goes there directly. Scoped registry overrides, auth tokens, a proxy repository in front of npmjs.org: none of it enters the picture, because npm never makes a registry request for that dependency in the first place.
Depth doesn’t help either. If a package three levels down your tree declares one, your install reaches out to GitHub mid-install, from a laptop or runner you assumed only talked to your registry. When those machines can’t reach GitHub, the install fails, and that’s how a lot of teams find out these exist. When they can, nothing fails and nobody notices.
Lockfiles help less than people expect. npm does record the resolved commit for a git dependency, so repeat installs from the same lockfile get the same code. But the first resolution still takes whatever the branch held that day, and every fetch still goes to GitHub rather than your registry. A lockfile pins the content. It doesn’t change where the content comes from.
What 53,707 package versions told us
Across those 53,707 package versions, we found 811 dependency specs that resolve outside the registry, spread over 682 versions of 303 distinct packages. GitHub accounts for 730 of them. The rest is a grab bag of CDN links, vendor download hosts, personal hosting, and one GitHub gist pressed into service as a dependency.
Of the 811 specs, 636 are dev dependencies. Consumers of the published package don’t normally install those, though they do get fetched whenever the package itself is built, which matters if you care about reproducible builds.
The other 175 sit in runtime or optional dependencies, the consumer-facing scopes. That number needs an asterisk, and it’s better to hand it over now than have someone point it out later. Of those 175, 155 come from a single long-abandoned CLI tool with dozens of published versions and nothing in the dependency graph we track depending on it. Take that one out and you’re left with 20 consumer-facing escaping specs across 15 packages.
Twenty sounds small, and it is. Nobody should read this as an epidemic. But 13 of those 20 point at a branch or a bare repository, which means the code behind them can change at any moment. Small numbers are also exactly how this sort of thing hides. Nobody audits the 15 packages they didn’t know were special.
Not every escape is equally dangerous
The shape of the spec matters far more than where it points.
A dependency pinned to a full commit SHA is content-addressed. A repository owner can’t move that reference to a different commit the way they can a branch or a tag, so even if the repository changes hands tomorrow, you get what was there when the pin was written. What’s left is availability, plus the fact that it still bypasses your registry. That’s a containment problem more than a code-injection one.
Bare repository URLs, branches, tags, and semver-resolved git refs should all be treated as mutable. No ref at all means the default branch. A #branch ref follows the branch. A #semver: range resolves against matching tags or refs at install time. And tags deserve their own sentence, because people treat them like versions. They aren’t. A tag is a pointer, and the repository owner can move it to a different commit whenever they feel like it. If it isn’t a SHA, assume it can change.
Remote tarball URLs should generally go in the mutable bucket too, unless something pins their integrity independently. GitHub’s generated source archives have changed checksums before without anyone touching the repository, so even a link that looks fixed isn’t promising you the same bytes.
In our census, the split was lopsided. Under that classification, 687 of the 811 specs were mutable and only 124 were pinned to a SHA. We didn’t count file:, link:, workspace:, or relative paths at all. There were 1,061 of those, and we excluded them because they never touch the network, so they can’t escape anything.
Now look at what the mutable case doesn’t require. No account takeover, no typosquat, no stolen publish token. The owner of that fork can push to their own default branch on a Tuesday afternoon, and the next fresh install anywhere picks it up. There’s no version bump, no publish event, and nothing new on the registry for a scanner to look at. If the URL points at a domain someone forgets to renew, you don’t even need the owner. Whoever registers the domain next can get a valid certificate for it and decide what your install downloads.
A green build doesn’t settle it
This is the part that bothered us most.
A rebuild pipeline checks fidelity. We build from source, pack the tarball, and confirm it matches the upstream tarball byte for byte. If it matches, we know our rebuild didn’t change a single byte of what upstream shipped. That’s a valuable guarantee, and we’ll defend it to anyone.
It’s also not the guarantee people tend to assume. Fidelity means we reproduced upstream faithfully. If upstream’s manifest says to go fetch something from a personal fork, a faithful rebuild says exactly the same thing. A faithfully reproduced hole is still a hole.
Provenance has the same boundary. A SLSA attestation tells you how an artifact was built, where, and from what source. It doesn’t tell you what that artifact will ask a customer’s package manager to fetch later, on a different machine, weeks after the build finished. That’s the scope SLSA defines for provenance, and it’s a sensible scope. Provenance attests to how something was made, never to whether it should have been.
You could watch the network during builds instead, and some rebuild efforts do exactly that. It catches things a manifest scan never will, like a postinstall script that downloads a binary from somewhere. But it only describes your build. The install that matters happens on someone else’s machine, later, and your build proxy never sees it. Each approach covers a blind spot the other one has.
The lesson we took from all this is that fidelity and containment are different questions and they need different checks. Fold a containment check into your verification step and a failure no longer tells you which question failed.
The fix that almost made things worse
The obvious fix is to mirror it. Copy the git dependency into the registry as a proper package, rewrite the spec to a normal version range, and move on.
There’s a catch. The moment you edit package.json, your tarball no longer matches upstream, and the fidelity check rightly rejects it. You end up choosing among three things you want: byte-for-byte fidelity, real containment, and packages that install as drop-in replacements without anyone changing their code. You get two.
Naming the copy turned out to be its own trap. In one case, the git dependency pointed at a years-old personal fork whose package.json declared a capitalized package name and a version that had never been published anywhere. npm doesn’t accept new package names with uppercase letters, so that name was out. The lowercase name was already taken on the public registry, by a different fork, at a lower version number. Publish our copy under that name at the higher version, and a resolver configured to compare candidates across private and public sources could prefer ours.
That’s close to the textbook recipe for dependency confusion. We’d have manufactured the exact class of problem we were trying to close.
A clean answer in a case like that is a new scoped name that can’t collide with anything public, plus a rewrite of the consuming manifest so it points there. It’s more work, and it means the package stops automatically following someone’s branch. We’ve come around to thinking that last part is a feature. Silently tracking a stranger’s default branch was the vulnerability, not a service.
What to check in your own projects
Start by finding them. npm can do this for you with its query command:
npm query ":type(git), :type(remote)"
That walks your installed dependency tree and returns everything that came from a git repository or a remote URL, transitive dependencies included. When it turns something up, you’ll want to know which results are direct and which arrived three levels down.
If you’ve already moved to npm 12, you’ve probably met some of these the hard way. Git and remote URL dependencies are now blocked by default, and an install that hits one fails until you opt in with allow-git or allow-remote. That’s a good default, and an overdue one. It’s tempting to set allow-git=all so the pipeline goes green again, but that puts you right back where you started, except now there’s a config line that makes it look like a deliberate decision. If the only git dependencies you need are in your own package.json, the root value limits the exception to those and keeps transitive ones blocked. pnpm 11 does much the same thing out of the box. Its blockExoticSubdeps setting now defaults to true, which blocks git and tarball specs in transitive dependencies while still allowing the ones you declare yourself.
Notice where that control lives, though. It’s the client refusing to fetch, not your registry containing anything. Your private registry still never sees these dependencies. The client just declines to go get them.
For whatever the query turns up, look at the shape before anything else. A SHA pin in a dev dependency is usually a lower-priority containment issue. A branch, a tag, or a bare repository URL in a runtime dependency is the one to fix, either by moving to a published version if one exists or by vendoring a pinned copy under a scoped name you own. And if your CI runners can reach github.com freely, it’s worth asking whether they actually need to, since egress control sees these fetches no matter what the manifest says.
Where that leaves the mirror
None of this makes private registries pointless. They do a lot of work. They just answer a narrower question than the one people ask of them. “Did this package come from somewhere we control?” isn’t the same question as “Does everything this package needs come from somewhere we control?”
That second question kept coming up while we were building SecureChain, and it’s changed how we read a package.json. We now treat the shape of every dependency spec as a security signal, right alongside the version range.
If your team has npm dependencies it can’t easily replace, that’s the problem TuxCare works on. SecureChain covers actively maintained packages, rebuilt from source with provenance, and Endless Lifecycle Support covers the end-of-life frameworks upstream has stopped patching but your application still depends on.
Frequently asked questions
What does it mean when a dependency escapes the registry?
It means a package declares one of its dependencies with a git URL, a tarball URL, or another remote location instead of a name and version range. npm resolves that dependency directly from the location in the spec rather than through the registry configured in .npmrc, unless the client is set to block that source type. Either way, a private registry or proxy has no say over it.
Does a private npm registry protect against git dependencies?
No. Registry routing only applies to dependencies declared by name and version range, so a git or remote URL dependency never passes through your private registry. What can stop it is the npm client itself. npm 12 blocks git and remote URL dependencies by default through its allow-git and allow-remote settings, which is a separate control from the registry.
Does npm 12 block git dependencies?
Yes, by default. npm 12 sets allow-git and allow-remote to none, so git and remote URL dependencies, including transitive ones, fail to install unless you opt in. Setting allow-git=root permits only the git dependencies declared in your own package.json, while all permits them everywhere in the tree.
Is a git dependency pinned to a commit SHA safer?
Yes, much safer than a branch or tag reference, because the owner can’t point a commit hash at different code. It still bypasses your registry and depends on the repository staying available, so treat it as something to track rather than something to ignore.
Does SLSA provenance mean a package is safe to install?
No. SLSA provenance attests to how and where an artifact was built and from what source. It doesn’t vouch for the source code itself, and it doesn’t cover dependencies the package fetches from outside the registry when someone installs it later.
