AI Coding Tool Source Code Leak: Incident Review and Release Protection Measures

    This article reviews a source code leak involving an AI coding command-line tool. The leak occurred when a public package release shipped a source map file that linked to a publicly accessible object storage bucket. The article covers the incident timeline, the scope of the exposed material, four root causes across the build, release, storage, and monitoring processes, and practical controls for preventing similar incidents, from build configuration and artifact scanning to private object storage and incident response.

    Incident Overview: A Source Leak Caused by a Default Configuration

    On March 31, 2026, security researchers found that a new version of an AI coding command-line tool, published to a public package registry, contained source map files that should not have been included in a production package. The source map exposed the full source mapping and pointed to a publicly accessible object storage direct link. Anyone could download an unobfuscated source archive from that link. Public mirror repositories appeared quickly, and the community began analyzing the code line by line. Within hours, the incident became a typical software supply chain source code leak.

    This was not an isolated problem. Five days earlier, the tool’s development team had exposed internal assets through a content management system misconfiguration. The exposed material included draft product blog posts and details of a closed-door executive event. When the tool was first released on February 24, 2025, it had also exposed source code through a source map issue of the same type. The same basic configuration error recurred more than a year later. This suggests the problem was not a single oversight. The build, release, and audit pipeline lacked institutionalized controls.

    Timeline

    • 06:36 UTC: A new patch version was published to the public package registry. The release included a source map file of about 59.8 MB that contained the complete original source code and pointed to the development team’s own object storage bucket. Because the bucket was publicly accessible, anyone could download the full unobfuscated source archive.
    • 08:23 UTC: A security researcher publicly disclosed the issue on social media and included a direct download link to the source archive. The post quickly reached nearly ten million views. Several public mirror repositories began copying the leaked source, and the community moved into line-by-line analysis.
    • Morning to night of the same day: The scope of the leak became clear. It included about 1,906 files and more than 512,000 lines of typed scripting source code. The code was not a simple interface wrapper. It included more than 40 permission control tools, 46,000 lines of query engine code, a multi-agent coordination system, IDE bridging, and persistent memory mechanisms. It also exposed 35 compile-time feature flags, more than 120 undocumented environment variables, and 26 internal slash commands.
    • Same period: After learning of the incident, an independent developer carried out a clean-room rewrite. Before dawn, the developer finished rewriting the core functionality in a scripting language and made it public. Within hours, the repository gained tens of thousands of stars and forks, making it one of the fastest-growing public projects of the day.
    • Historical comparison: A source map issue had already appeared when the tool was first released on February 24, 2025. On March 26, 2026, a content management system asset was made public by default. Five days later, another release artifact leak occurred. This shows that the fixes addressed individual incidents, not the processes behind them.

    Scope of the Leak and Its Impact

    A source map looks like a debugging aid. It maps compressed runtime code back to the original source. In a production release, however, it effectively hands outsiders the source structure, variable names, module layout, comments, internal interfaces, and some configuration. The size of this leak shows that the exposure was not limited to a few business logic details. It revealed how an entire production-grade development platform was organized.

    The impact falls into four areas:

    First, the attack surface grew. Full source code helps attackers locate permission checks, command execution, network requests, plugin loading, and secret reading. This lowers the cost of finding vulnerabilities.

    Second, internal capabilities were exposed. Compile-time feature flags, undocumented environment variables, and internal commands reveal unreleased capabilities and experimental entry points. If outsiders use this information, they could probe, bypass, or socially engineer the system.

    Third, supply chain trust was damaged. Users of command-line tools expect that release artifacts do not contain debugging files or internal assets. The source map leak directly undermined that expectation.

    Fourth, competitors and the ecosystem moved faster. Public source code lowers the barrier to replicating a product. It also creates compliance and intellectual property risks. A clean-room rewrite can reduce copying risk, but it cannot remove the commercial losses caused by the leak itself.

    Root Cause Analysis: Four Controls Failed at Once

    1. Build defaults were not explicitly constrained

    Modern bundlers usually generate source maps by default to support development debugging. Development builds and production releases, however, require different configurations. If a production build does not explicitly disable source maps, or if the release configuration does not exclude map files, debugging artifacts ship with the runtime package. The root cause was not that developers did not understand the tooling. The default value was inherited in the wrong context.

    2. The release ignore list was missing

    A release artifact should contain only the files needed at runtime. If the release ignore configuration is missing, source directories, map files, environment variable files, and certificate files can all end up in the package. In this incident, the map file was not excluded, which shows that the release manifest was never reviewed for minimization.

    The source map pointed to an object storage direct link. This turned a file inside the package into a direct download of the full source archive. If an object storage bucket is public by default, or if there is no expiration policy for signed URLs, the bucket becomes a second leak channel that bypasses review at the package registry.

    4. The release pipeline lacked artifact auditing

    If a release included an artifact scan that checked for *.map, src/, .env*, certificate, and key files, the incident could have been blocked before upload. The recurrence of this type of problem shows that earlier fixes addressed single files. They did not turn the checks into permanent pipeline gates.

    Engineering Controls: Turning “Do Not Leak” Into Enforceable Gates

    Build layer: Explicitly disable source maps in production

    Production builds should use a separate configuration that explicitly disables source maps, or enables them only in a controlled debugging environment. Build output and source directories should be isolated, and the release directory should contain only runtime artifacts. An example configuration is shown below:

    1. # Publish configuration example, not specific platform syntax
    2. publish:
    3. include:
    4. - "dist/runtime/**"
    5. - "README*"
    6. exclude:
    7. - "**/*.map"
    8. - "**/src/**"
    9. - "**/.env*"
    10. - "**/*.pem"

    Artifact layer: Scan and block before release

    Before release, scan the artifact’s file list. If any file matches rules for source maps, source directories, environment variables, or certificates, block the release. Example pseudocode:

    1. artifact = open_package(artifact_path)
    2. files = list_files(artifact)
    3. blocked = match(files, ["**/*.map", "**/src/**", "**/.env*", "**/*.pem"])
    4. if blocked:
    5. fail("Release artifact contains source maps or sensitive files. Blocking release.")

    Teams should also generate a software bill of materials that records dependencies, versions, and artifact hashes. This makes later tracing easier.

    Release layer: Gate artifact repositories and minimize releases

    Releases to public package registries should pass through an artifact repository gate. Developers should not upload directly from development directories. Release packages should be signed and verified by hash, and the team should have a rollback plan for each version. Release permissions should be separate from build permissions, so that no single account can both change code and publish it directly.

    Storage layer: Keep object storage private by default

    Object storage buckets should be private by default. External access should use short-lived signed URLs, and long-lived public direct links should be prohibited. In a Baidu AI Cloud environment, teams can combine private object storage, artifact repositories, key management, and audit logging to build an isolated release and audit chain. Set alerts for bucket policy changes, public access settings, and unusual download activity.

    Monitoring and response layer: Contain quickly, not just delete later

    Teams should monitor public repositories, package registries, and social media for leaks, and set alerts for unusual downloads. After an incident, respond immediately: take down the affected artifact, revoke public access, rotate any keys that may have been exposed, roll back the version, preserve forensic logs, and decide whether to notify users. Incident response should not stop at deleting files. Teams must also confirm that no second leak channel remains.

    Action Checklist for Engineering Teams

    1. Explicitly disable source maps in production builds, and exclude map files in the release configuration.
    2. Include only runtime files in release packages. Source code, tests, environment variables, and certificates must not be part of the artifact.
    3. Scan release artifacts before publishing, and block the release if sensitive rules match.
    4. Keep object storage buckets private by default. Prohibit long-lived public direct links, and use short-lived signed access.
    5. Separate build, release, and storage permissions, and rotate keys on a regular schedule.
    6. Continuously monitor public package registries, code hosting platforms, and social media for leaks.
    7. Turn past incidents into pipeline rules instead of one-time patches.
    8. Isolate people and materials in clean-room rewrites, and keep process records to reduce compliance risk.

    Conclusion

    The core lessons from this incident are straightforward. A source map is a development debugging tool and should never be part of a production release. Object storage direct links carry high risk and should not be public by default. The release pipeline must make artifact minimization and sensitive file blocking mandatory gates. A single configuration mistake may affect only one version. Repeated incidents of the same type, however, show that the organization lacks institutionalized supply chain security governance. For teams that use AI coding tools and command-line tools, a source code leak can expose internal implementation details. It can also increase the risk of permission bypass, key leakage, and supply chain attacks. Connecting the build, artifact, release, storage, and response stages into a closed loop is the most reliable way to prevent similar incidents.