← Back to blog
2026-04-01april-fools8gi8sosecurity

A Security Audit of the Claude Code Leak (It's Worse Than You Think)

0:00 / 0:00

Let me walk you through how Anthropic's flagship developer tool got its source code exposed to the entire internet. Not through a sophisticated zero-day. Not through a state-sponsored APT group. Through a .map file that shipped with an npm package.

I want you to sit with that for a moment.

The incident timeline

On March 31, 2026, researchers discovered that the Claude Code CLI had shipped sourcemaps in its npm distribution. Sourcemaps are debugging artifacts. They contain the original, pre-compiled source code. All 512,000 lines of it. The entire architecture of one of the most-used AI developer tools on the planet, readable by anyone with npm install and a text editor.

This is not exotic. This is the software equivalent of leaving your house keys taped to the front door with a note that says "please don't."

What the source revealed

The leaked code showed Claude Code's internal tool system, its context management, and its prompt architecture. Immediately, malicious npm packages began appearing. Typosquatted variants. Packages that looked like Claude Code plugins but contained credential harvesters. The DMCA takedown requests started within hours, which is the corporate equivalent of closing the barn door after the horse has not only bolted but started a competing horse farm.

My audit findings

Finding 1: Build pipeline hygiene. The sourcemap should have been stripped during the production build. This means either the build pipeline had no sourcemap exclusion step, or someone overrode it. Both are bad. One is incompetence. The other is worse.

Finding 2: Package review process. npm packages should be audited before publication. The contents of the tarball should be diffed against an allowlist. If your CI/CD pipeline publishes whatever npm pack produces without inspection, you do not have a pipeline. You have a catapult.

Finding 3: Incident response. DMCA takedowns are not incident response. They are reputation management. The source was already cached, forked, and redistributed before the first takedown landed. Once something hits npm's registry, it is in every mirror, every corporate proxy, every offline cache. You cannot un-ring that bell.

Finding 4: Supply chain exposure. The real question nobody is asking: what was hardcoded in that source? API endpoints? Internal service names? Authentication patterns? Every piece of infrastructure referenced in those 512,000 lines is now a known attack surface. Hope you enjoy rotating credentials at scale.

What 8GI does differently

Our build system strips sourcemaps, yes. But that is table stakes. We run a pre-publish audit that checksums the package contents against a manifest. If a file appears that is not on the manifest, the publish fails. Not warns. Fails. Hard.

We also do not put 512,000 lines of anything into a single distributable package. That is not architecture. That is a monolith wearing a trench coat pretending to be a CLI tool.

The deeper problem

The AI industry has decided that shipping fast is more important than shipping safely. MCP hit 97 million installs this month. Ninety-seven million. That is 97 million attack surfaces if any of those integrations have the same build hygiene as Claude Code's npm package.

Speed is not a security strategy. "Move fast and break things" is a threat model, not a motto.

Recommendations

  1. Strip all debugging artifacts from production builds. Test the output, not the intent.
  2. Implement package content allowlists in CI/CD.
  3. Assume your source will leak. Design your security model accordingly.
  4. Stop treating DMCA as incident response.

What is the worst that could happen? It already did. Via a .map file.

Happy April 1st. I wish this were a joke.