5 Sources
[1]
Claude Code settings files expose thousands of secrets on GitHub
"Do not ask again" prompt leads to passwords, API keys, and more being shared. Claude Code is leaking sensitive information on public GitHub instances thanks to a partial oversight in the way its settings files are handled. That's the finding of AI security researchers at Apiiro, who discovered
[2]
Claude Code's 'don't ask again' button has a secrets-spilling problem
More than 30,000 distinct secrets were found in Claude Code's local settings files on public GitHub, with thousands still valid when detected. endif; ?> A configuration file meant to store local command permissions on Anthropic's Claude Code is exposing thousands of API keys, database credentials
[3]
Claude Code's "don't ask again" button is leaking passwords and API keys to public GitHub repos
Serving tech enthusiasts for over 25 years. TechSpot means tech analysis and advice you can trust. Facepalm: A feature in Claude Code meant to save developers a few clicks is exposing database passwords, API tokens and private keys in public GitHub repositories. When a developer tells Anthropic's
[4]
Did Claude Code's 'don't ask again' option accidentally expose your enterprise's passwords and keys?
If you or your organization use Anthropic's popular AI coding assistant Claude Code to develop software, you may want to check your public GitHub repositories. A seemingly harmless option designed to save developers time has also been saving sensitive passwords and security credentials in files
[5]
Claude Code flaw exposes passwords and keys on public GitHub repositories
Claude Code has exposed sensitive credentials in public GitHub repositories after its permission settings recorded full shell commands, including embedded passwords and access keys, security firm Apiiro said. Apiiro found 1,122 publicly accessible Claude Code settings files containing credentials
Share
Copy Link
Anthropic's Claude Code AI coding assistant has exposed over 31,000 secrets including database passwords, API keys, and cloud credentials on public GitHub repositories. The leak stems from the tool's 'don't ask again' permission feature, which saves full shell commands containing sensitive credentials to local settings files that can accidentally become public.

A security flaw in Anthropic's Claude Code AI coding assistant has exposed thousands of sensitive credentials on public GitHub repositories, with researchers discovering 31,088 distinct secrets across 23,276 repositories
2
. The exposed secrets include database passwords, API tokens, cloud provider keys, and root logins from 63 different organizations1
. Of the exposed credentials, 5,343 were still valid when GitGuardian detected them, with database identifiers accounting for 2,280 distinct working credentials2
.The leak stems from Claude Code's command approval system. When developers use the AI coding assistant to execute shell commands, the tool requests permission before proceeding. To streamline workflow, users can select "Yes, and don't ask again" to approve future executions without repeated prompts
4
. The problem arises because Claude Code saves the entire approved command, including any embedded credentials, to a local settings file called .claude/settings.local.json1
.For instance, when a developer asks Claude Code to interact with an API, they might approve a curl command containing an API key in its HTTP header. The tool then stores that complete command as an approved rule, leaving the credential in plain text within the configuration file
2
. Monthly leaks in settings.local.json peaked at 12,535 occurrences in April 2026, then fell to 959 by October 2026, though researchers haven't determined what caused this change2
.Anthropicโ€™s documentation states that Claude Code automatically adds the settings file to a developer's global .gitignore list, which should prevent it from being shared publicly
1
. However, this protection doesn't cover every scenario. The .gitignore setting exists in the developer's own Git configuration, not in the repository itself. If a repository is cloned to another machine or a folder becomes a repo later, that protection may not be in place3
.Apiiro reports that Claude Code often commits changes to the settings file without user input, further complicating the issue
1
. Researchers at Apiiro found over 100,000 cases where Claude Code's local settings files had been uploaded to public GitHub repositories1
. The exposed credentials belonged to organizations ranging from small development teams and startups to established technology vendors, including passwords for production databases and credentials associated with applications handling medical records4
.The security flaw extends beyond GitHub. GitGuardian examined public Docker Hub images and found 613 distinct secrets in Claude Code settings files, with 99 valid when detected
2
. The credentials appeared across 543 image repositories and 7,625 tags. One valid Cloudflare API token appeared across 559 image tags, while a database password appeared in 643 tags across seven image repositories2
.The problem arises when developers use Docker's "COPY.." instruction to copy an entire project working directory into an image. Unlike Git, Docker doesn't automatically respect the repository's .gitignore file, meaning a Claude Code configuration file excluded from source control can still be copied into a container image unless developers explicitly exclude it through .dockerignore
2
.Conventional secret scanners failed to catch a substantial portion of the exposure. Of the roughly 1,100 exposed secrets Apiiro found, 215 were not flagged by either gitleaks or TruffleHog, two widely used open-source scanners
3
. This represents close to one in five exposed credentials. Passwords embedded in command-line arguments and environment variable assignments often lack the recognizable formats that provider-specific detection rules look for2
.GitGuardian found that 67% of the occurrences in settings.local.json for which it could establish validity were working credentials
2
. Database identifiers accounted for the largest category of valid secrets, followed by cloud provider tokens and AI tokens.This security flaw isn't new. The issue was flagged in a Claude Code bug report as far back as August 2025
1
. Other bug reports noted that the sensitive settings file was sometimes not added to the user's .gitignore list or that Claude Code could add sensitive commands to another file not protected from git sharing. All these bug reports were closed without action after 60 days of inactivity1
.Related Stories
Boris Cherny, head of Claude Code at Anthropic, acknowledged the issue in a Hacker News discussion, stating the team is "looking into what we can do to prevent this"
5
. He noted that these settings files should almost never be checked into source control and that cases appeared when "the files were manually created and checked in"3
.Cherny recommended using Claude Code's auto mode, which uses classifiers to automatically route routine permission prompts without requiring manually maintaining allow/deny lists
1
. However, when another user noted that sensitive commands can still be saved to settings files in auto mode, Cherny called it a "good catch" and said the team is "thinking through what we can do to improve this"1
.Cherny also advised developers to use secret scanners and said the team is considering building secret scanning into Claude Code itself in the future
3
. However, Apiiro's results suggest this would be a partial fix at best, since the two leading open-source tools missed 215 of the exposed credentials3
.This incident highlights growing concerns about corporate reliance on AI agents that can operate software and access sensitive systems. VentureBeat's October 2026 VB Pulse research survey on Agentic Security and Identity found that 24% of 101 enterprise AI and security leaders said their agents mostly operate using shared API keys or credentials associated with people or service accounts. Another 20% reported having no automated way to detect when an AI agent takes an unauthorized action
4
.The automation risks extend beyond what an AI agent might do while running. The records it leaves behind can expose valuable information long after a task is finished. Removing an exposed settings file from GitHub may not be enough, since previous versions can remain accessible through the repository's history or copies made by other developers
4
.Apiiro recommends that organizations search public repositories for .claude/settings.local.json and .claude/settings.json, review Git history for deleted copies, and rotate every credential the files may have contained
5
. Developers should reference credentials through environment variables, such as $DB_URL, rather than placing secrets directly in commands5
.GitGuardian recommends treating AI coding assistant configuration files as potential secret-bearing assets, scanning them alongside conventional environment files, and using environment variables rather than hardcoding credentials into commands
2
. For Docker users, removing the offending file from the GitHub repository doesn't help credentials already distributed through published images. Developers must rotate exposed credentials, remove sensitive configuration files from both Git and Docker build contexts, and check previously published images for lingering secrets2
.Summarized by
Navi
[1]
[3]
[4]
25 Feb 2026•Technology

31 Mar 2026•Technology

04 Jun 2026•Technology
