Anthropic's Claude Code CLI Source Map Leak Exposed Entire Codebase

Technical deep-dive: How a single cli.js.map file accidentally open-sourced Anthropic’s entire Claude Code CLI (v2.1.88) If you’ve ever shipped a production JS/TS package, you know exactly what a source map is. A *.js.map is a JSON artifact generated by bundlers (Webpack, esbuild, Bun, Rollup, etc.) that adheres to the Source Map Revision 3 spec. It contains: → "version": 3 → "sources": array of original file paths → "names": original variable/function names → "mappings": VLQ-encoded segments that map every token in the minified cli.js back to the exact line/column in the original TypeScript → "sourceRoot" + "sourcesContent": sometimes the full original source embedded → "file": the generated bundle name Its sole purpose is to let debuggers (DevTools, VS Code, Sentry, etc.) reconstruct readable stack traces and enable source-level debugging. Yesterday, Anthropic published @anthropic-ai/claude-code@2.1.88 to npm. Inside the tarball sat a ~60 MB cli.js.map that should never have left their CI pipeline. Here’s exactly what went wrong (classic release-engineering foot-gun): 1. The package was built with Bun’s bundler (which defaults to sourcemap: true unless explicitly disabled). 2. No entry in .npmignore (or the files field in package.json) excluded *.map files. 3. The generated map still contained the original "sourceRoot" and relative paths pointing directly to Anthropic’s public Cloudflare R2 bucket. 4. That bucket held src.zip — the complete, unobfuscated 1,900+ TypeScript files (~512 kLOC) of the Claude Code agent. Result? Anyone who ran npm install @anthropic-ai/claude-code@2.1.88 could: 1. Extract cli.js.map 2. Parse the sources + sourcesContent (or follow the R2 URLs) 3. Download the full original codebase in seconds No de-minification required. No reverse-engineering tricks. Just pure, readable TypeScript — agent architecture, tool handlers, plugin system, feature flags, internal telemetry, unreleased modules (KAIROS, dreaming memory, Tamagotchi-style pet, etc.) all laid bare. Anthropic has since yanked the version and called it a “release packaging issue caused by human error.” No customer data or model weights were exposed — but the operational security optics for a “safety-first” lab are… not great. This is a textbook reminder that your build pipeline and .npmignore are now part of your threat model. #TypeScript #JavaScript #SourceMaps #BuildTools #npm #DevOps #Anthropic #Claude #AISecurity #ReverseEngineering

  • text

To view or add a comment, sign in

Explore content categories