← Google News

Claude Code can leak secrets in public npm packages - SecurityBrief Asia

Google News · April 22, 2026

Detailed Analysis

Anthropic accidentally exposed the full source code of its proprietary Claude Code tool through a packaging error in npm version 2.1.88, releasing a 60 MB source map file (`cli.js.map`) that contained over 512,000 lines of code spanning nearly 2,000 TypeScript files. The mistake stemmed from a missing `.npmignore` configuration that would have excluded the source map from the published package — an elementary but consequential oversight. Security researcher Chaofan Shou first surfaced the discovery on X, where the post accumulated 28.8 million views, and the reconstructed codebase was rapidly mirrored to a public GitHub repository that amassed over 84,000 stars and 82,000 forks, making it among the fastest-growing repositories in the platform's history. Anthropic confirmed that no customer data or credentials were exposed in the incident, characterized it as a "release packaging issue," issued DMCA takedowns, and removed the affected package from the npm registry.

The security implications extend well beyond the initial embarrassment of an inadvertent open-source release. AI security firm Straiker highlighted that adversaries can now study Claude Code's internal architecture — including its four-stage context management pipeline — to develop targeted jailbreaks, design guardrail bypasses, or engineer persistent backdoors that exploit known implementation details. Among the features revealed in the leaked codebase is a capability referred to as "Undercover Mode," which instructs Claude to make stealth contributions to open-source repositories without surfacing information identifying Anthropic as the originating organization. The exposure of such design decisions invites scrutiny not only of security posture but also of the broader ethical intentions embedded in the tool's architecture.

The incident quickly generated secondary attack vectors. Threat actors operating under the npm username "pacifier136" launched typosquatting campaigns, publishing malicious packages that mimicked internal Claude Code dependencies and targeting developers attempting to compile the leaked source. This cascading effect illustrates a well-documented pattern in software supply chain security: a single upstream exposure can rapidly weaponize an entire ecosystem of downstream developers who engage with the leaked material. The speed and scale of exploitation attempts in this case underscore how effectively the open-source community — including malicious actors — can operationalize leaked proprietary code.

The Claude Code leak arrives at a moment when AI development tooling occupies an increasingly sensitive position in the software supply chain. Agentic coding assistants like Claude Code operate with elevated privileges — accessing codebases, executing terminal commands, and interacting with external APIs — which means any compromise of their internals carries disproportionate risk relative to conventional software leaks. Anthropic's announcement of preventive measures signals awareness of the gap, but the incident reinforces a broader industry challenge: AI companies moving at speed to ship competitive developer tools are applying consumer software release cadences to systems whose internal logic, when exposed, can directly inform adversarial AI exploitation. The absence of a basic `.npmignore` file serving as the single point of failure for a closed-source product of this sensitivity will likely prompt renewed scrutiny of release engineering practices across the AI tooling sector.

Read original article →