Kamil Józwik
← All posts

What the Claude Code npm Source Map Leak Actually Exposed

Anyone who has published a TypeScript CLI to npm knows how easily a stray build artifact slips into production. You enable source maps for local stack traces, edit an .npmignore rule or package.json files entry weeks later, and suddenly the tarball ships full sourcesContent or an unauthenticated reference straight to the original repository tree.

On March 31, that routine packaging slip hit Anthropic in public. Security researcher Chaofan Shou noticed that @anthropic-ai/claude-code version 2.1.88 on npm shipped a roughly 60 MB source map file, cli.js.map, reconstructing around 1,900 files and more than 512,000 lines of original TypeScript.

Anthropic pulled version 2.1.88 quickly and filed DMCA takedowns once mirrors began circulating on GitHub. As Anthropic noted in its statement, a release packaging error caused the exposure as opposed to a server breach, leaving user data, API keys, and model weights untouched. For engineers building AI agents, the leaked harness mattered far more than any gossip over unreleased easter eggs.

Inside the Harness Blueprint

When I looked at Anthropic acquiring Bun last December, it already seemed clear that runtime speed and CLI polish were becoming strategic priorities. Inspecting what version 2.1.88 contained confirms how much engineering sits behind Claude Code, which reads closer to a small desktop operating environment than a shell wrapper around completions.

Three architectural choices stood out from the codebase breakdown. First, the core query engine handles streaming orchestration, context compaction, caching, and roughly 40 discrete tools behind layered permission gates instead of handing unfiltered bash execution to the model. Second, feature flags such as KAIROS point directly toward persistent daemon infrastructure, including automated background memory consolidation (autoDream) so an agent can clean up observations between interactive runs. Third, the tree contains defensive mechanics alongside product experiments: deep-planning flags (ULTRAPLAN), clean-repo helpers (Undercover Mode), a terminal pet command (/buddy), and ANTI_DISTILLATION_CC guards built to inject decoy tool definitions against automated API scraping.

Watching TypeScript and Rust rewrites pop up on GitHub within hours, the broader Hacker News consensus landed in a pragmatic spot: Anthropic exposed client blueprints, while proprietary model weights and customer sessions stayed private. Seeing how much code sits inside the React/Ink terminal interface and tool state machines reinforces a lesson every team learns firsthand once prototypes hit real repos: prompt wording gets you a demo on Friday, while permission checks, crash recovery, and clean MCP routing consume half a million lines of careful TypeScript.

The Axios Supply Chain Collision Next Door

If developers spent April 1 dissecting TypeScript modules, security teams spent those same hours cleaning up a genuinely dangerous npm incident sitting one install command away. Within hours of the Claude Code map discovery, attackers used a hijacked maintainer account to push poisoned versions 1.14.1 and 0.30.4 of axios carrying a hidden plain-crypto-js dependency that drops a cross-platform remote access trojan during postinstall, detailed in StepSecurity’s incident breakdown.

The timing created an immediate trap. Thousands of developers hurried to inspect, mirror, or build copies of the leaked Claude Code source right when fresh typosquatted packages and active axios malware were spreading through npm. Installing an unpinned CLI mirror on a developer laptop holding cloud tokens, SSH keys, and .npmrc secrets exposes everything local terminal agents are authorized to read.

Switching coding agents onto signed native installers instead of mutable global npm installs eliminates an entire layer of third-party dependency tampering.

What Changes for JavaScript and Agent Tooling

Client-side CLI software runs on hardware the end user controls, so minification never works as permanent secrecy anyway. Having clean variable names gave rival harness builders a convenient reference manual, yet the real warning sits in CI and package security. Source map stripping and explicit files allowlists need hard automated checks in release pipelines before any artifact leaves CI, and local developer tools deserve stronger isolation from global package registries.