AI Coding Tool Source Code Leak: A Technical Postmortem of a Source Map Incident
A mainstream AI command-line coding tool recently had its full source code exposed because debug source map files were bundled into its published package. This postmortem explains why source maps can effectively equal source code, what the leaked files revealed about the tool's stack, tools, commands, and permission model, and where the real risks lie. It also offers a checklist for making artifact review a mandatory pipeline gate, so configuration changes cannot quietly reintroduce a past leak.
Incident Overview: A “Non-Attack” Source Code Leak
Recently, the full implementation code of a mainstream AI command-line coding tool was published publicly. Security researchers disclosed on social platforms that the tool’s published package contained debug source map files. Anyone could read the original source directly from them. Within hours, the news had spread, the code had been compiled into a public repository, and that repository was quickly attracting widespread attention.
Notably, this was not an intrusion. There was no exploit, no privilege escalation, and no insider leak. The real cause was a configuration oversight in the release process: mapping files meant only for local debugging were packaged into the externally published artifacts. Incidents of this type tend to follow a pattern of “zero technical barrier, full exposure.” The damage does not come from attacker capability, but from the publisher’s failure to review its build artifacts.
Even more concerning, a similar problem appeared more than a year ago and was fixed at the time. It then resurfaced in a recent version, even though the previous release’s artifacts were clean. This detail strongly suggests that the root cause is not a one-off mistake, but a missing automated artifact review step. Without one, any change to the build configuration can bring a historical problem back.
How Source Maps Work — and Why They Can Equal Source Code
In modern frontend and Node.js ecosystems, code is commonly bundled, minified, and transpiled before release. The results are smaller artifacts that load faster, but they are almost impossible to read. Source maps were designed to make debugging such code easier. They are JSON files that record the mapping between positions in the minified code and the corresponding positions in the original source.
At the core of a source map are two arrays:
{"version": 3,"sources": ["src/tools/file-read.ts", "src/tools/bash.ts"],"sourcesContent": ["<full original TypeScript code>...", "..."],"mappings": "AAAA,CAAC,OAAO……"}
sources: the paths of the original files, which directly expose the project’s directory structure.sourcesContent: the full contents of the original files, effectively the source code itself.mappings: line/column mappings used to locate breakpoints and errors.
The key conclusion: as long as sourcesContent is present, there is no real “decompilation” or “deobfuscation” difficulty. A script of roughly ten lines can parse the JSON and reconstruct the complete project directory by path.
In this incident, the published package grew from about 17MB to 31MB. The extra size came from the mapping file, tens of megabytes in size. An unexplained jump in package size is by itself one of the easiest signals to monitor.
What the Source Code Actually Exposed
According to the review, the project contained about 1,900 TypeScript source files and roughly 510,000 lines of code. It covered the complete implementation of the AI command-line coding tool. The information can be grouped into four layers:
- Technology stack: the runtime is a high-performance JavaScript runtime rather than traditional Node.js. The terminal interface uses a React-based terminal rendering approach, building CLI interactions in a componentized way. There are also clear dependencies for command parsing, schema validation, built-in search, protocol integration, and feature flags. In effect, this makes the tool’s architectural decisions public.
- Tooling system: there are about 39 tool implementations covering command execution, file read/write, search, sub-task dispatch, network access, integration with external capabilities, and more. Each tool’s permission checks, input validation, and error handling logic are visible.
- Interaction layer: there are about 50 slash commands. They include diagnostics, cost tracking, cross-device collaboration, and several internal experimental commands. Together, they reveal the product roadmap and the direction of internal experiments.
- Security boundary: the implementation details of the permission model, allowlist policies, and confirmation flows for sensitive operations are fully exposed. Attackers can use this to design more precise paths for social engineering.
Risk Boundaries: No Need to Panic, But Don’t Underestimate It
In an objective assessment, this leak does not involve model weights and does not contain user data. As a result, ordinary users are not directly affected. The real losses fall into three areas:
- Intellectual property: the core engineering implementation and architectural approach can be replicated at low cost.
- Expanded attack surface: internal commands, experimental features, and permission implementation details provide material for social engineering and prompt injection attacks.
- Competition and compliance: once unpublished internal implementations are exposed, they may come with internal comments, temporary flags, or environment clues. This can trigger compliance review.
Defense Checklist: Make Artifact Review a Mandatory Pipeline Gate
- Build side: explicitly disable map output in production builds, or emit maps that do not contain
sourcesContent. Keep internal debugging artifacts physically separate from the artifacts published externally. - Verification side: in CI, add an artifact size baseline and a file-type allowlist. The build should fail if
.mapfiles,.d.tsfiles, test fixtures, or similar files are present. Size changes beyond a set threshold should require manual confirmation. - Release side: before release, automatically unpack and scan the artifacts for signatures such as
sourcesContentandsourceMappingURL. Keep artifact signatures and traceable release records on file. - Governance side: make artifact manifest comparison a required gate for every release. Back-scan historical versions as well, so the same problem cannot come back when a configuration change is rolled back.
- Platform side: use cloud container platforms, pipeline services, log services, and monitoring and alerting capabilities to build a unified system for artifact scanning and abnormal size alerts. This makes the process from build to release observable end to end.
Recommendations for Users
For developers, “minimize the published artifact” should be the default principle: ship only the files needed to run. For enterprise users, when evaluating AI coding tools, look at whether the vendor has an artifact review process, a track record of vulnerability response, and clear documentation of its permission model.
In its related engineering practices, Baidu AI Cloud likewise emphasizes build artifact governance and end-to-end security observability. Such foundational capabilities are often an implicit measure of platform maturity.
A source map is an efficiency tool, not an asset. Leaving it in your release is where an incident begins.
