The rapid integration of artificial intelligence into the software development lifecycle has promised unprecedented gains in productivity, but a new security revelation suggests that these gains may come at a significant cost to data integrity. A recent investigation has uncovered a troubling vulnerability in Claude Code, the command-line AI coding assistant developed by Anthropic. It appears that sensitive information, including passwords, API keys, and authentication tokens, is being inadvertently leaked into public GitHub repositories due to the way the tool handles automated command execution permissions.
The issue stems from a feature designed to streamline the developer experience. When Claude Code suggests a shell command, it typically asks for user approval. However, to avoid repetitive prompts, users are given the option to select "Yes, and don’t ask again." While this accelerates the workflow, it triggers a background process where the AI assistant saves the specific command—verbatim—into a project settings file. If that command contains a secret, such as a database password or an API token passed as an argument, that secret is stored in plain text within the project directory.
According to a detailed report released by the software security firm Apiiro, these secrets are not just staying on local machines. They are finding their way into the public domain. Researchers discovered over 1,100 public copies of these settings files on GitHub that contain at least one exposed secret. The scale of the leak highlights a fundamental friction between the convenience of AI-driven automation and the rigorous demands of modern cybersecurity.
The Mechanics of a Silent Leak
To understand how these leaks occur, one must look at the internal architecture of Claude Code’s permission system. By default, the assistant is designed to be cautious, seeking explicit permission before interacting with the user’s terminal. When a developer grants permanent permission for a specific command pattern, Claude Code records this "allow rule" in a file named .claude/settings.local.json.
The documentation for Claude Code specifies that this file is intended to store project-specific configurations and permissions. The problem arises because the tool does not always store a generic pattern for the command; in many instances, it stores the exact string that was executed. If a developer runs a command like docker login -u username -p mysecretpassword, and then tells Claude Code to remember that permission, the string mysecretpassword is written directly into the JSON file.
Anthropic has implemented some safeguards to prevent these files from being committed to version control. According to the tool’s documentation, the first time Claude Code creates this file, it attempts to add the path to the user’s global Git excludes file. This is a configuration setting on the developer’s local machine that tells Git to ignore certain files across all repositories on that specific computer.
However, security researchers from Apiiro point out a critical flaw in this approach. A global exclude only affects the local environment of a single developer. It does nothing to protect a file that has already been accidentally staged or committed to a repository. Furthermore, Claude Code does not automatically add the .claude/ directory to the project’s own .gitignore file. This means the protection is not "portable"; if the project is shared with another developer or cloned to a different environment, the safety mechanism is no longer in place, and the sensitive settings file becomes eligible for inclusion in the next commit.

The evidence suggests that this is not merely a theoretical risk. In their analysis of 1,105 repositories, researchers found that 539 of them contained commits where Claude was listed as a "co-author." This indicates that the AI assistant itself may be facilitating the commitment of its own configuration files during automated coding sessions, effectively bypassing the very protections intended to keep the files local.
Quantifying the Exposure: The Apiiro Findings
The scope of the exposure is vast. Apiiro’s researchers conducted a comprehensive scan of public GitHub repositories and identified 104,185 copies of the .claude/settings.local.json file across more than 103,000 repositories. Upon closer inspection, approximately 1.1% of these files—1,122 individual copies—were found to contain at least one verifiable secret. In total, the researchers identified 1,379 distinct secrets exposed to the public.
The methodology used to identify these secrets was rigorous. A value was only flagged if it matched a known cryptographic key format or if it appeared as a password or token in immediate proximity to a public server address. To ensure accuracy and reduce false positives, an AI-based reviewer was used to confirm the nature of the data. While the researchers did not attempt to use the secrets to gain unauthorized access, they did notify several affected parties. One company confirmed that a leaked key found by the researchers was indeed active and provided access to their systems.
The nature of the leaked data is particularly concerning for enterprise security. More than a third of the identified secrets provided direct access to databases. The haul included 379 database passwords, 43 SSH logins for public-facing servers, and 23 AWS access keys. Additionally, 42 tokens for critical development platforms like GitHub, GitLab, and npm were discovered.
The victims of these leaks are not limited to individual hobbyists. Apiiro identified 63 distinct organizations among the owners of the leaked files, many of which are software companies ranging from small startups to established vendors. In one particularly egregious case, a database vendor’s own administrative-level cloud key was found in a public repository. In another, the owner password for a database containing medical records was left exposed.
The longevity of these leaks is another point of concern. As of earlier this week, every file identified as containing a secret remained on the default branch of its respective repository. In half of those cases, the sensitive information had been publicly available for at least 217 days. Even when a developer realizes the mistake and deletes the file, the danger persists. Because Git is a version control system, the secret remains embedded in the repository’s history and in any forks that were created while the file was present. Apiiro found 734 secrets in older versions of files that had since been deleted, and another 211 secrets in repository forks.
The Failure of Traditional Security Tools
One of the most alarming aspects of this discovery is that traditional security scanners are largely failing to detect these leaks. Common tools like gitleaks and TruffleHog are designed to scan repositories for secrets, but they often rely on identifying specific patterns or high-entropy strings that look like API keys.

When Apiiro ran these tools over the 1,122 files known to contain secrets, the results were inconsistent. Gitleaks flagged 564 files, while TruffleHog identified 643. Most notably, 215 files containing confirmed secrets were missed by both tools. The reason for this blind spot lies in the context of the leak. Because the secrets are often embedded within a command string—such as a password following a -p flag in a terminal command—they look like ordinary words to a scanner that isn’t specifically looking for command-line arguments. To a standard scanner, mysql -p mypassword123 looks like a routine line of code rather than a critical security vulnerability.
This "contextual camouflage" makes the Claude Code leaks particularly dangerous, as developers may have a false sense of security, believing that their automated scanning tools would have alerted them to any accidental disclosures.
The risk is compounded by the fact that malicious actors are already aware of these types of vulnerabilities. In September 2025, security analysts tracked the "Shai-Hulud" worm, a piece of malware that specifically targeted developer machines. The worm was designed to run the TruffleHog scanner locally on infected systems to find and exfiltrate secrets. As AI agents like Claude Code become more common, they create new, centralized locations for malware to harvest credentials.
Recommendations for Developers and Security Teams
In light of these findings, security experts are urging developers to rethink how they interact with AI coding assistants. The primary advice for those using Claude Code is to be extremely cautious when using the "don’t ask again" feature for any command that requires authentication.
If a developer suspects that a secret has been saved in a .claude settings file, the recommended course of action is not just to delete the file, but to "rotate" the credentials immediately. This involves changing every password, token, or key that has ever been recorded in the file. Once the secrets themselves are invalidated, the developer should then work to scrub the Git history using specialized tools to ensure that the information is removed from all previous commits and forks.
For organizations and security teams, the researchers suggest a more proactive approach. This includes:
- Implementing strict policies regarding the use of AI coding agents and the automation of shell commands.
- Updating internal security scanners to specifically look for
.claude/settings.local.jsonand.claude/settings.jsonfiles. - Ensuring that project-level
.gitignorefiles are updated to explicitly exclude the.claude/directory across all repositories. - Monitoring for "co-authored" commits by AI agents to ensure that configuration files are not being pushed to remote servers.
The researchers also noted that while Claude Code is the most prominent example of this behavior, it is not the only AI tool that developers use. However, in a comparison of 16 different coding agents, Claude Code was the only one confirmed to save the full text of approved commands in a project-level configuration file by default.

A History of Unaddressed Warnings
Perhaps the most frustrating element of this security lapse is that it was not unknown to the developer community. Users of Claude Code have been raising alarms about this specific behavior for months. A bug report was filed on the official Claude Code GitHub repository as early as August 11, 2025, explicitly stating that API keys and tokens were being stored in plain text within the settings.local.json file.
Despite the clear risk outlined in the report, the issue did not receive a formal response from Anthropic. Instead, the report was automatically closed by a bot in early January 2026 after 60 days of inactivity, marked as "not planned." Three other related reports cited by the researchers met a similar fate, with the most recent being closed just yesterday.
This lack of engagement from the tool’s developers has drawn criticism from the security community. As AI companies push for deeper integration into the developer’s environment, there is an expectation that security reports regarding the core functionality of these tools will be prioritized. The silence from Anthropic, combined with the automated closure of high-risk security reports, suggests a potential gap in the oversight of AI-assisted development tools.
As of the time of publication, the vulnerability remains a functional part of the Claude Code ecosystem. Developers are encouraged to manually audit their .claude directories and treat any automated command history as a potential source of data leakage until a more robust, secure permission model is implemented by the manufacturer.
