November 22, 2026

Security Flaw in Anthropic’s Claude Code Exposes Sensitive Developer Secrets on Public GitHub Repositories

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.

Claude Code's “Don't Ask Again” File Exposes Passwords and Keys in 1,122 Public Copies on GitHub

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.