We unpacked 445 popular npm packages. 39% of them ship their full original source.
Your git repo is not what your users install. npm publish ships whatever npm pack puts in the tarball, and that decision is made by build output, a files field, and ignore files — not by what you committed. We downloaded
Your git repo is not what your users install. npm publish ships whatever npm pack puts in the tarball, and that decision is made by build output, a files field, and ignore files — not by what you committed. We downloaded the latest published tarball of 445 npm packages — the exact bytes npm install fetches — and inspected every file inside. Here is what is actually in there.
The numbers
-
56% ship source maps. 247 of 445 packages publish
.mapfiles — roughly 32,000 map files in total. -
39% embed the full original source. 173 packages inline
sourcesContentin their maps, which means the complete pre-build source — comments, internal file names and all — can be reconstructed from the tarball. - 35% are over 1 MB unpacked. 157 packages exceed 1 MB and 32 exceed 10 MB. The median is 422.4 KB. The largest tarball in the set is 94.4 MB.
- 5% matched a secret pattern or sensitive-file rule. 21 packages. We don't publish which ones or what matched — some are test fixtures, and the rest belong with the maintainer, not in an article.
- 42% had nothing flagged at all. A clean tarball is entirely achievable. More on who manages it below.
Smaller counts, same story: 3 packages shipped CI configuration, 2 shipped editor configuration, and 2 shipped test-coverage output.
How we looked (and why git doesn't tell you this)
Method: for each package, take the latest published tarball from the registry, unpack it, and run a heuristic scan over every file — looking for source maps (and whether they carry sourcesContent), environment files and credential formats, secret patterns, internal docs, coverage and debug output, and nested archives.
This is a different view from a git secret scanner. A scanner reads your repository. But npm pack doesn't mirror your repository:
- If
package.jsonhas afilesfield, npm uses it as an allowlist and ignores.npmignoreentirely. - If there's no
filesfield, npm falls back to.npmignore— and the moment a.npmignoreexists, it replaces.gitignorefor packaging purposes. Anything you excluded only in.gitignoreis back in play. - Your
dist/folder is generated after all of this. Whatever the bundler emitted — maps included — is what ships.
So a repo can be perfectly clean and the tarball still leaks. The only reliable check is to inspect the artifact itself.
What this looks like in practice
These are ordinary, well-maintained packages. That's the point — none of this requires carelessness, just defaults nobody revisited.
- @hubspot/[email protected] ships 8,280 files, of which 2,759 are source maps.
- @langchain/[email protected] ships 684 source maps; 498 of them embed the full original source.
- @coinbase/[email protected] ships 1,134 source maps — and had 29 additional matches for secret patterns or sensitive file types. The report deliberately doesn't say which files; details go to the maintainer via a live scan, not onto a public page.
-
@browserbasehq/[email protected] is a small package — 16 files — but one is a source map with full source embedded, and another is a nested archive (
dist/assets/stagehand-extension.zip), the kind of build leftover that's easy to ship without noticing. - [email protected] manages 94.4 MB unpacked across just 36 files.
- At the other end: [email protected] ships 27 files with nothing flagged, and [email protected] ships 12. Generated SDKs and big CLIs have a harder job than a 12-file utility, but the gap between 27 files and 8,280 is configuration, not necessity.
Is a shipped source map actually a problem?
It depends on the package, and the reports say so too. If your code is open source, the original is public anyway — the maps are mostly install weight, and they can genuinely help debugging. The calculus changes for closed-source SDKs and CLIs, internal packages published to public registries by mistake, and anything where comments and file structure are themselves information. A map with sourcesContent is not a hint about your source. It is your source.
The secret-pattern matches deserve the same nuance: a heuristic match is often a test fixture or a documentation example. Sometimes it isn't. Either way, the person who should find out first is the maintainer, before publish — not a reader after it.
What to do about it
Four things, in order:
-
Look at your own tarball.
npm pack --dry-runlists exactly what will ship. If you have never read that list for your package, that's the whole problem in one sentence. -
Use a
filesallowlist."files": ["dist"]inpackage.json, then narrow it — e.g."files": ["dist", "!dist/**/*.map"]. Remember that addingfilesdisables.npmignore, so the allowlist has to be complete. -
Decide about maps explicitly. Strip them from release builds (
"sourceMap": false, or your bundler's equivalent), or upload them privately to your error tracker instead of the registry. Emitting them by default and shipping them by default are two separate decisions; most packages only ever made the first one. - If something real already shipped, rotate first. Excluding a file from the next release does not un-publish it — old versions stay on the registry. Rotate the credential, then fix the packaging.
Check yours
Every finding above came from a build-config default nobody looked at. The check takes a minute: ReleaseShield's scanner is free, needs no login, and inspects the same artifact your users download — scan your package or browse the per-package reports to see what your dependencies ship. If your tarball is clean, the report page for your package includes a badge you can put in your README so it stays that way:
[](https://releaseshield.lineanswered.com/npm/<your-package>?ref=badge)
Method note: automated heuristic scan of each package's latest public tarball, figures recomputed on every crawl (last run 2026-11-21). Findings describe tarball contents; they are not a judgment of a package's security or its maintainers, and many flagged files are intentional.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.