AI Coding Assistant Claude Code Leaks Passwords and API Keys in Public GitHub Repositories

A widespread software security vulnerability has been uncovered involving Anthropic’s AI coding assistant, Claude Code, which is inadvertently exposing sensitive developer credentials—including plain-text passwords, cloud tokens, and proprietary API keys—within public GitHub repositories. Security researchers from Apiiro published a comprehensive analysis revealing that thousands of development settings files generated by the AI tool contain unmasked corporate secrets, posing an immediate threat to organizations leveraging autonomous coding agents in modern software development pipelines.
The core of the issue resides in how Claude Code manages user permissions and shell execution. By default, the AI assistant prompts developers for authorization before executing shell commands within a project environment. When a user selects the persistent authorization option—phrased as "Yes, and don’t ask again"—Claude Code records the command verbatim into a local project configuration file designated as .claude/settings.local.json.
While this design choice is intended to streamline development workflows by bypassing repetitive authorization prompts for routine tasks, it introduces a severe security flaw when developers input commands containing sensitive variables. If a developer runs a command containing plain-text credentials—such as database initialization strings, inline SSH logins, or cloud access keys—the entire string is committed to the local settings JSON file.
Furthermore, while Anthropic’s documentation states that Claude Code attempts to prevent these files from entering version control systems by adding them to the user’s global Git exclusion rules upon initial creation, this local safeguard fails under standard collaborative development conditions. The exclusion rule is restricted to an individual developer’s machine and global settings; it does not automatically propagate to the project’s shared .gitignore configuration. Consequently, if a developer manually stages and commits the .claude/settings.local.json file, or if automated AI-assisted commits merge the changes, the sensitive data becomes permanently indexed within the repository’s Git history, making it publicly accessible if the repository is hosted on platforms like GitHub.
Scale of the Exposure and Data Breakdown

To evaluate the scope of the exposure, researchers at Apiiro conducted a large-scale scan of public code repositories on GitHub, searching specifically for instances of the .claude/settings.local.json file. The findings illustrate a systemic vulnerability impacting thousands of codebases across enterprise and open-source environments.
Out of more than 104,000 instances of the configuration file discovered across approximately 103,600 unique repositories, researchers identified 1,122 active public files containing at least one hardcoded secret. In total, these files harbored 1,379 distinct sensitive items. The breakdown of the exposed credentials highlights a dangerous mix of database administrator credentials, internal cloud infrastructure keys, and developer platform tokens:
- Database Access Credentials: More than one-third of the discovered secrets directly target database security, including 379 distinct database connection passwords. Researchers highlighted critical exposures, such as admin-level cloud keys belonging to database vendors and master owner passwords for sensitive medical-records systems.
- Remote Server Logins: The scan detected 43 SSH login strings and keys configured for public-facing servers.
- Version Control and Package Manager Tokens: Exposed authentication tokens for prominent platforms such as GitHub, GitLab, and the npm registry accounted for 42 items.
- Cloud Infrastructure Keys: 23 Amazon Web Services (AWS) cryptographic and access keys were found residing unencrypted within the settings files.
The implications extend beyond the current production branches of the affected repositories. Apiiro’s analysis revealed that older iterations of the configuration files—often preserved within the Git commit history, deleted branches, or subsequent repository forks—harbored an additional 734 secrets across 509 repositories. Moreover, forks of impacted projects duplicated the vulnerability across 211 derivative repositories, amplifying the surface area for potential exploitation.
In approximately 539 of the 1,105 traced repositories, commits listing Claude as a co-author modified the settings file, indicating that the AI coding assistant itself frequently performed automated commits that integrated the vulnerable files directly into the project’s source tree. Furthermore, shared team configuration files—specifically .claude/settings.json, which are intentionally committed to repositories for collaborative workflows—accounted for another 298 exposed secrets spread across 298 distinct repositories. When factoring in historical commits, forks, and shared configuration files, the aggregate total reaches 2,539 exposed secrets across 1,994 unique repositories.
Chronology and Prior Warnings Ignored
The discovery of credential leakage within Claude Code is not entirely unprecedented, as concerned developers have flagged related anomalies months prior to Apiiro’s public disclosure.

The timeline of the vulnerability spans multiple months of unaddressed community reports:
- August 11, 2025: An initial bug report was filed on the official GitHub repository for Claude Code (Issue #5544), explicitly warning that approved shell commands containing API keys and authentication tokens were being recorded word-for-word within
settings.local.json. - January 3, 2026: Following a period of 60 days without human intervention or engineering engagement from the repository maintainers, an automated management bot closed the GitHub issue, categorizing it as "not planned."
- Early January 2026: Multiple subsequent bug reports submitted by developers addressing the same persistent storage flaw were similarly closed by automated moderation bots without receiving official commentary, remediation timelines, or patches from Anthropic representatives.
- Mid-January 2026: Security firm Apiiro completed its empirical scan of public repositories, confirming that the behavior could be reproduced across the latest model iterations, including Opus 5.5 and Fable 5.1, and formally published its findings alongside notification letters sent to affected corporate entities.
The failure of automated issue-tracking systems to escalate the security reports highlights persistent friction points in how emerging artificial intelligence startups handle vulnerability disclosures submitted through standard open-source developer channels.
Broader Implications for AI Coding Agents and Supply Chain Security
The incident represents a distinct class of security challenges unique to the rapid adoption of AI coding assistants and autonomous development agents. Unlike traditional software development, where developers explicitly manage environment variables and .env files through secure configuration management frameworks, AI agents frequently interact directly with the underlying operating system shell to execute testing suites, package installations, and database migrations.
Comparative analyses conducted by security researchers indicate that among 16 major coding assistant platforms evaluated for permission and storage practices, Claude Code is currently the only tool confirmed to persist full, unredacted shell commands containing sensitive inputs within local project configuration files by default.
Security analysts note that traditional automated secret-detection tools often struggle to identify these embedded credentials. When Apiiro deployed popular open-source secret scanners—such as Gitleaks and TruffleHog—against the compromised configuration files, the tools experienced significant blind spots. Gitleaks successfully flagged only 564 of the 1,122 secret-bearing files, while TruffleHog identified 643. Crucially, 215 of the files were completely missed by both scanners because the secrets were embedded as command-line arguments (such as inline parameters for database clients or environment assignment prefixes like PGPASSWORD= or sshpass -p) rather than adhering to traditional, recognizable API key formats.

This detection gap leaves organizations vulnerable to secondary threats, including automated malware vectors. In September 2025, security researchers documented the propagation of supply chain worms, such as the Shai-Hulud malware, which actively scanned compromised developer workstations for stored credentials and configuration files. Security experts warn that unencrypted configuration files residing on local developer machines present high-value targets for infostealer malware, even if the files are successfully prevented from reaching public source control hosting platforms like GitHub.
Recommended Remediation and Mitigation Strategies
In response to the widespread exposure, security researchers and enterprise defense teams have issued urgent remediation guidelines for both individual developers and corporate security organizations.
For Software Developers:
- Immediate Credential Rotation: Developers are advised to treat any password, API token, or cryptographic key that has ever been processed through Claude Code’s shell execution history as compromised. Immediate revocation and rotation of all affected secrets is necessary before attempting repository cleanups.
- Git History Scrubbing: Merely deleting the
.claude/settings.local.jsonfile from the working directory is insufficient to remove the vulnerability, as older versions remain embedded in the Git commit history. Teams must utilize advanced history-cleaning utilities, such asgit-filter-repoor BFG Repo-Cleaner, to purge sensitive records from all local and remote branches, tags, and forks. - Global Exclusion Verification: Developers must ensure that
.claude/settings.local.jsonis explicitly added to both global Git ignore rules and individual project.gitignorefiles to prevent future accidental staging.
For Enterprise Security and DevOps Teams:
- Automated Repository Auditing: Security operations centers must implement continuous code-scanning pipelines specifically configured to detect
.claude/settings.local.jsonand similar local configuration files across all internal and public-facing repositories. - Behavioral Guardrails: Organizations adopting AI coding agents should establish strict organizational policies prohibiting the input of raw production credentials into interactive prompt interfaces, enforcing the use of secure vault systems and environment variables instead.
- Supply Chain Monitoring: Organizations should audit third-party dependencies, Docker images, and zip archives to ensure that local AI configuration settings containing sensitive operational data have not been inadvertently bundled into build artifacts.
As the adoption of generative artificial intelligence accelerates across software engineering enterprises, the incident underscores the critical necessity for robust guardrails, proactive vulnerability disclosure triage, and secure-by-design architectures within autonomous development tools.







