{"id":7778,"date":"2026-04-01T06:54:49","date_gmt":"2026-04-01T06:54:49","guid":{"rendered":"https:\/\/www.securitytoday.de\/2026\/04\/02\/post_id-6451\/"},"modified":"2026-04-10T08:20:16","modified_gmt":"2026-04-10T08:20:16","slug":"source-map-in-npm-package-how-anthropic-exposed-512000-lines-of-production-code","status":"publish","type":"post","link":"https:\/\/www.securitytoday.de\/en\/2026\/04\/01\/source-map-in-npm-package-how-anthropic-exposed-512000-lines-of-production-code\/","title":{"rendered":"Source Map in NPM Package: How Anthropic Exposed 512,000 Lines of Production Code"},"content":{"rendered":"<p style=\"color:#69d8ed;font-size:0.9em;margin:0 0 16px;padding:0;\">7 min Reading Time<\/p>\n<p><strong>A missing exclusion rule in the build pipeline exposed Anthropic\u2019s full production code on March 31, 2026. 512,000 lines of TypeScript, packaged into a 59.8 MB source map file within a public NPM package. On the same day, an independent supply-chain attack compromised the NPM package axios  &#8211;  one of the most widely used JavaScript packages globally. Two separate incidents, one ecosystem, one day. Together, they illustrate why NPM supply-chain security is no longer a niche concern for IT teams in 2026.<\/strong><\/p>\n<h2>TL;DR<\/h2>\n<ul>\n<li>NPM package @anthropic-ai\/claude-code v2.1.88 contained a 59.8 MB source map file with full TypeScript source code  &#8211;  caused by a missing .npmignore rule in the build pipeline.<\/li>\n<li>CWE classification: CWE-215 (Information Exposure Through Debug Information) and CWE-538 (Insertion of Sensitive Information into Externally-Accessible File).<\/li>\n<li>Six CVEs had already been documented in Claude Code prior to the leak, including API key exposures and sandbox bypasses.<\/li>\n<li>On the same day: supply-chain attack on axios (v1.14.1 and v0.30.4) with an embedded Remote Access Trojan via the fake dependency plain-crypto-js.<\/li>\n<li>Anthropic: &#8220;Packaging error due to human failure, not a security incident.&#8221; No customer data affected.<\/li>\n<\/ul>\n<h2>The Incident<\/h2>\n<p>On March 31, 2026, at 08:23 UTC, Chaofan Shou disclosed his discovery on X. Shou is a PhD candidate at UC Berkeley, co-founder of blockchain security startup Fuzzland, and a bug bounty researcher with $1.9 million in documented vulnerability reports. His finding: version 2.1.88 of the official NPM package @anthropic-ai\/claude-code included the file cli.js.map. This 59.8 MB source map contained the complete TypeScript source code in its sourcesContent field  &#8211;  approximately 1,900 files totaling 512,000 lines of production code.<\/p>\n<p>The source map also referenced a ZIP archive stored in a publicly accessible Cloudflare R2 bucket owned by Anthropic. Within hours, the community mirrored the code on GitHub. The most prominent repository reached over 41,500 forks. Anthropic responded with DMCA takedown notices; GitHub disabled over 8,100 repositories in the fork network. The code remains available on decentralized platforms.<\/p>\n<div class=\"evm-stat evm-stat-highlight\" style=\"text-align:center;background:#f0f9fa;border-radius:12px;padding:32px 24px;margin:32px 0;\">\n<div style=\"font-size:48px;font-weight:700;color:#004a59;letter-spacing:-0.03em;\">59.8 MB<\/div>\n<div style=\"font-size:15px;color:#444;margin-top:8px;\">Size of the source map file cli.js.map in the NPM package @anthropic-ai\/claude-code v2.1.88<\/div>\n<div style=\"font-size:12px;color:#888;margin-top:8px;\">Source: NPM Registry, March 31, 2026<\/div>\n<\/div>\n<p>The likely cause: Anthropic uses Bun as its JavaScript runtime. An open Bun bug (reported March 11, 2026) documents that Bun\u2019s bundler generates source maps by default  &#8211;  even in production mode, contrary to documentation. Neither .npmignore nor the files field in package.json excluded .map files.<\/p>\n<p>This wasn\u2019t the first incident of its kind: back in 2025, Claude Code versions v0.2.8 and v0.2.28 also contained source map files. Just days before this leak, around 3,000 internal Anthropic files appeared in a publicly accessible cache.<\/p>\n<p>Anthropic\u2019s official statement: &#8220;A release packaging error due to human failure, not a security incident.&#8221; Version 2.1.88 was withdrawn, and version 2.1.89 released.<\/p>\n<h2>Source Maps as an Underestimated Attack Vector<\/h2>\n<p>Source maps are JSON files that map compiled or minified JavaScript back to the original source code. Their sourcesContent field contains the full, readable source text. They are a legitimate debugging tool  &#8211;  but only in development environments. In production packages, they become a security risk.<\/p>\n<p>Tools like reverse-sourcemap, Shuji, or unwebpack-sourcemap can reconstruct the entire directory structure and readable source code from a single .map file. No reverse engineering required, no decompiler, no specialized expertise  &#8211;  just unpacking the file.<\/p>\n<p>In the case of Claude Code, the following were exposed: the complete four-tier permission model, Bash validation logic, OAuth 2.0 authentication flows, the MCP server architecture (Model Context Protocol), and 44 feature flags for unreleased features. Among them: an anti-distillation mechanism that injects fake tool definitions into API requests to poison training data collected by competitor models. And an &#8220;Undercover Mode&#8221; that removes all Anthropic references when the tool operates in public repositories.<\/p>\n<p>No customer data. No API keys. But the full intellectual property of the agent architecture  &#8211;  the result of thousands of development hours at a company valued at an estimated $380 billion.<\/p>\n<p>The problem isn\u2019t limited to Anthropic. Source maps in production packages are an industry-wide risk. A study by Ostorlab found that about five percent of examined web assets were vulnerable to source-map-based attacks. The difference: most affected organizations don\u2019t even know their .map files are publicly accessible.<\/p>\n<blockquote style=\"border-left:4px solid #69d8ed;margin:32px 0;padding:20px 24px;background:#fafafa;border-radius:0 8px 8px 0;font-size:1.1em;line-height:1.6;color:#333;\"><p>\n  &#8220;The irony is unreal &#8211; Anthropic markets Claude&#8217;s code-writing capabilities, yet their own code leaked due to a basic packaging mistake.&#8221;<br \/>\n  <cite style=\"display:block;margin-top:12px;font-size:0.8em;color:#888;font-style:normal;\">&#8211; Community reaction on Hacker News, March 31, 2026<\/cite>\n<\/p><\/blockquote>\n<h2>CWE Classification and Known Vulnerabilities<\/h2>\n<p>The source map leak primarily falls under two CWE categories:<\/p>\n<p><strong>CWE-215<\/strong> (Information Exposure Through Debug Information): Debug artifacts in production releases expose internal implementation details.<\/p>\n<p><strong>CWE-538<\/strong> (Insertion of Sensitive Information into Externally-Accessible File or Directory): Sensitive information placed in a file accessible to external actors.<\/p>\n<p>Additional applicable categories include CWE-540 (Inclusion of Sensitive Information in Source Code), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor), and OWASP A01:2021 (Broken Access Control).<\/p>\n<p>Prior to the source map leak, six CVEs had already been documented in Claude Code:<\/p>\n<div class=\"evm-stat evm-stat-row\" style=\"display:flex;gap:16px;margin:32px 0;flex-wrap:wrap;\">\n<div style=\"flex:1;min-width:200px;text-align:center;background:#f0f9fa;border-radius:8px;padding:20px 12px;border-top:3px solid #69d8ed;\">\n<div style=\"font-size:18px;font-weight:700;color:#004a59;\">CVE-2026-21852<\/div>\n<div style=\"font-size:12px;color:#666;margin-top:4px;\">API key leakage via ANTHROPIC_BASE_URL in manipulated repositories<\/div>\n<\/p><\/div>\n<div style=\"flex:1;min-width:200px;text-align:center;background:#f0f9fa;border-radius:8px;padding:20px 12px;border-top:3px solid #69d8ed;\">\n<div style=\"font-size:18px;font-weight:700;color:#004a59;\">CVE-2025-58764<\/div>\n<div style=\"font-size:12px;color:#666;margin-top:4px;\">Command parsing bypassed approval dialogs<\/div>\n<\/p><\/div>\n<div style=\"flex:1;min-width:200px;text-align:center;background:#f0f9fa;border-radius:8px;padding:20px 12px;border-top:3px solid #69d8ed;\">\n<div style=\"font-size:18px;font-weight:700;color:#004a59;\">CVE-2025-52882<\/div>\n<div style=\"font-size:12px;color:#666;margin-top:4px;\">IDE integrations accepted WebSocket connections from arbitrary origins<\/div>\n<\/p><\/div>\n<\/div>\n<p>Also included are CVE-2025-59828 (Yarn configuration execution before trust dialog), CVE-2025-64755 (Sed parsing bypassed read-only validation), and attack vectors documented by Check Point Research via manipulated project configurations.<\/p>\n<p>The pattern is clear: AI-powered development tools that read files, execute commands, and access networks are full-fledged attack surfaces  &#8211;  regardless of vendor. The leaked source code at least shows Anthropic recognizes the issue: a CLAUDE_CODE_SUBPROCESS_ENV_SCRUB flag was introduced to prevent environment variables (and potentially API keys) from being inherited by subprocesses. However, the fact this flag was added retroactively confirms that the security architecture evolved reactively rather than proactively.<\/p>\n<h2>On the Same Day: The axios Supply-Chain Attack<\/h2>\n<p>Independent of the Claude Code leak, on March 31, 2026, a supply-chain attack hit the NPM package axios  &#8211;  with 83 million weekly downloads, one of the most widely used JavaScript packages globally. Versions 1.14.1 and 0.30.4 contained a Remote Access Trojan via a fake dependency named plain-crypto-js. The attack was active between 00:21 and 03:29 UTC before npm removed the package.<\/p>\n<p>The timing is significant: anyone who installed or updated Claude Code via npm during this window may have pulled the compromised axios version as a transitive dependency. Two independent supply-chain issues, one ecosystem, one day. The axios attack was independently confirmed by SANS, Sophos, and BleepingComputer and attributed to the UNC1069 group (linked to North Korea).<\/p>\n<p>This incident fits into a timeline familiar to IT security teams: event-stream (2018), ua-parser-js (2021), colors.js (2022), the Astro attack via Shai-Hulud (2024), and now axios (2026). The NPM ecosystem  &#8211;  with its deeply nested dependency chains  &#8211;  remains one of the most critical attack surfaces in software development. Every transitive dependency is a potential attack vector  &#8211;  and most teams don\u2019t even know their full dependency tree.<\/p>\n<h2>What IT Teams Should Check Now<\/h2>\n<p>Five concrete actions derived from this incident:<\/p>\n<p><strong>1. Package audit for source maps.<\/strong> Run npm pack &#8211;dry-run on all internally published packages. Check whether .map files, .env files, or other debug artifacts are included in the package. This takes 30 seconds per package and would have prevented the Claude Code leak.<\/p>\n<p><strong>2. Use a whitelist approach instead of a blacklist.<\/strong> Define a files field in package.json as a whitelist, rather than relying on .npmignore (blacklist). Blacklists often miss new file types. Whitelists only include explicitly approved content.<\/p>\n<p><strong>3. Review bundler configuration.<\/strong> Build tools like Bun, esbuild, and webpack often generate source maps by default. Explicitly disable them for production builds: &#8211;sourcemap=none (Bun), &#8211;sourcemap=false (esbuild), or devtool: false (webpack).<\/p>\n<p><strong>4. Implement a CI\/CD gate.<\/strong> Add an automated check in the pipeline that fails the build if .map files, .env files, or other excluded patterns are found in the release artifact. Simple check: find dist\/ -name &#8220;*.map&#8221; -exec false {} +.<\/p>\n<p><strong>5. Use provenance attestations.<\/strong> npm publish &#8211;provenance creates a cryptographically signed attestation linking the build reproducibly to a specific commit and CI environment. This wouldn\u2019t have prevented the incident, but it makes tampering traceable.<\/p>\n<p><strong>6. Treat AI development tools as attack surfaces.<\/strong> Tools like Claude Code, GitHub Copilot, and Cursor have filesystem access, execute commands, and communicate with external APIs. They deserve the same security audits as any other software with privileged access. The six documented CVEs in Claude Code show: these tools are not immune to vulnerabilities that are already standard audit points in any other application class.<\/p>\n<h2>Frequently Asked Questions<\/h2>\n<h3>Were customer data or API keys exposed?<\/h3>\n<p>No. Anthropic and independent security analyses (Penligent) confirm: no customer data, no API keys, no credentials. What was exposed was the application code of the Claude Code CLI  &#8211;  its architecture, logic, and feature flags, not operational secrets.<\/p>\n<h3>How is this incident different from a supply-chain attack?<\/h3>\n<p>The Claude Code leak was an unintended configuration error (CWE-215), not a targeted attack. The axios incident on the same day, however, was a deliberate supply-chain attack involving injected malware. Both highlight different facets of the same problem: NPM packages as attack vectors.<\/p>\n<h3>What risk exists for Claude Code users?<\/h3>\n<p>The direct risk from the source map leak is low  &#8211;  the exposed code contained no secrets. More critical: users who installed Claude Code between 00:21 and 03:29 UTC on March 31 may have received the compromised axios version as a transitive dependency. Running npm audit and checking the axios version is recommended.<\/p>\n<h3>Was this Anthropic\u2019s first incident of this kind?<\/h3>\n<p>No. In 2025, Claude Code versions v0.2.8 and v0.2.28 also contained source map files. Just days before this leak, around 3,000 internal files appeared in a publicly accessible cache  &#8211;  including details about an unreleased AI model. Three incidents with the same root cause (.npmignore errors) suggest a systemic issue in the release pipeline.<\/p>\n<h3>How do I audit my own NPM packages?<\/h3>\n<p>Four steps: 1) npm pack &#8211;dry-run shows all files that would be included in the package. 2) Configure the package.json files field as a whitelist. 3) Disable bundler source maps for production. 4) Implement a CI gate that fails the build if .map files are present in the artifact.<\/p>\n<div style=\"background:#f0f9fa;border-radius:8px;padding:20px 24px;margin:24px 0;border-top:3px solid #69d8ed;\">\n<h2 style=\"margin-top:0;margin-bottom:12px;font-size:1.05em;\">Editor\u2019s Reading Recommendations<\/h2>\n<ul>\n<li>\u2192 <a href=\"https:\/\/www.cloudmagazin.com\/en\/2026\/04\/01\/claude-code-quellcode-leak-ki-agenten-architektur\/\"><strong>Claude Code Fully Leaked: What 512,000 Lines of Source Code Reveal About AI Agent Architectures<\/strong><\/a> (cloudmagazin) &#8211; Technical architecture analysis of the incident<\/li>\n<\/ul>\n<\/div>\n<div style=\"background:#f0f9fa;border-radius:8px;padding:20px 24px;margin:24px 0;border-top:3px solid #69d8ed;\">\n<h2 style=\"margin-top:0;margin-bottom:12px;font-size:1.05em;\">More from the MBF Media Network<\/h2>\n<ul>\n<li>\u2192 <a href=\"https:\/\/www.cloudmagazin.com\/en\/2026\/04\/01\/claude-code-quellcode-leak-ki-agenten-architektur\/\"><strong>Claude Code: The Architecture Behind the AI Agent<\/strong><\/a> (cloudmagazin)<\/li>\n<li>\u2192 <a href=\"https:\/\/mybusinessfuture.com\/\"><strong>AI Development Tools and Their Security Implications<\/strong><\/a> (MyBusinessFuture)<\/li>\n<\/ul>\n<\/div>\n<p><em>Header Image Source: Pexels \/ Towfiqu barbhuiya (px:11391947)<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"7 min Reading Time A missing exclusion rule in the build pipeline exposed Anthropic\u2019s full production code on March 31, 2026. 512,000 lines of TypeScript, packaged into a 59.8 MB source map file within a public NPM package. On the same day, an independent supply-chain attack compromised the NPM package axios &#8211; one of the [&hellip;]","protected":false},"author":50,"featured_media":6449,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"source map","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Source map in NPM package: See how 512,000 lines of code leaked\u2014learn to protect your builds and audit packages now.","_yoast_wpseo_meta-robots-noindex":"","_yoast_wpseo_meta-robots-nofollow":"","_yoast_wpseo_meta-robots-adv":"","_yoast_wpseo_canonical":"","_yoast_wpseo_opengraph-title":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_opengraph-image":"","_yoast_wpseo_opengraph-image-id":"","_yoast_wpseo_twitter-title":"","_yoast_wpseo_twitter-description":"","_yoast_wpseo_twitter-image":"","_yoast_wpseo_twitter-image-id":"","footnotes":""},"categories":[251],"tags":[],"class_list":["post-7778","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"wpml_language":"en","wpml_translation_of":6451,"_links":{"self":[{"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/posts\/7778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/comments?post=7778"}],"version-history":[{"count":2,"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/posts\/7778\/revisions"}],"predecessor-version":[{"id":9032,"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/posts\/7778\/revisions\/9032"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/media\/6449"}],"wp:attachment":[{"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/media?parent=7778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/categories?post=7778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.securitytoday.de\/en\/wp-json\/wp\/v2\/tags?post=7778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}