Claude Code: settings.local.json exposes secrets on GitHub
Claude Code’s «Yes, and don’t ask again» rules store commands with their credentials: thousands of secrets in public GitHub repositories and Docker images.

Two independent studies, by Apiiro and by GitGuardian, point to the same problem: the local configuration file of Claude Code, Anthropic’s coding assistant, often ends up in public GitHub repositories and Docker images, taking database passwords, cloud tokens, API keys and SSH logins with it. It is not a code vulnerability in the strict sense, but a product behaviour that turns command approvals into a credential store.
What happened
Claude Code asks for permission before running certain shell commands. If the developer picks «Yes, and don’t ask again», the tool saves an allow rule in the project file .claude/settings.local.json. According to GitGuardian (quoted by CSO Online) and Ars Technica, the rule often contains the command as it is, including any credentials written on the command line: for example a curl call with the API key in an HTTP header, or a database connection with the password among the arguments.
According to Anthropic’s documentation, as reported by Ars Technica, the file is added to the developer’s global .gitignore. But that protection only applies on that machine: it does not exist at repository level, so the file can be committed from another clone, from a folder that later becomes a repository, or if it was already tracked. Apiiro adds, again according to Ars Technica, that in many cases Claude Code itself commits changes to the file without any user input.
The figures from the two studies
The numbers cannot be compared directly, because the two companies counted different things:
- Apiiro: according to Ars Technica, more than 100,000
settings.local.jsonfiles in public repositories, of which about 1,100, traced to 63 organisations, contained secrets (The Hacker News reports 1,122 copies). The DataBreaches.net summary instead reports 2,539 real secrets in 1,994 repositories; examples include a database vendor’s own admin-level cloud key, a production Azure Postgres password, a Square production token and the owner password of a medical-records database. - GitGuardian (researcher Guillaume Valadon, via CSO Online): 31,088 distinct secrets in 23,276 public repositories, 5,343 still valid when found. Where validity could be checked, 67% worked. Database credentials lead (2,280 valid ones), followed by cloud provider and AI platform tokens. Monthly leaks peaked in April 2026 (12,535) and fell to 959 in October, with no known explanation.
Docker Hub and the limits of scanners
GitGuardian also found the file in public Docker Hub images: 613 distinct secrets, 99 valid, across 543 image repositories and 7,625 tags. The cause is the Dockerfile COPY . . instruction: Docker does not read .gitignore, so the file lands in the image unless it is excluded in .dockerignore. One valid Cloudflare API token appeared in 559 tags; a database password in 643 tags across seven repositories.
Traditional scanners miss part of it: passwords in command-line arguments or environment variable assignments lack the recognisable format that provider-specific rules look for. According to Ars Technica, 215 of Apiiro’s roughly 1,100 secrets were not flagged by gitleaks and TruffleHog.
Anthropic’s position
According to Ars Technica, the issue was already described in a Claude Code bug report from August 2025; that and similar reports were closed without action after 60 days of inactivity. Boris Cherny of Anthropic, who leads Claude Code, wrote on Hacker News that the team is looking into how to prevent it and that these files should never be put under version control: in his view, the cases involve files created and committed by hand. He suggested auto mode, which decides permissions with classifiers; when another user pointed out that commands can still end up in the file in that mode too, he called it a good catch. Anthropic is also considering built-in secret scanning. So far the sources report no released fix.
Indicative MITRE ATT&CK mapping: T1552.001 (Unsecured Credentials: Credentials In Files), T1593.003 (Search Open Websites/Domains: Code Repositories), T1078 (Valid Accounts).
Impact for European and Italian companies
Anyone using Claude Code, directly or through development suppliers, may have production credentials in public without knowing it. Removing the file from the repository is not enough: the secret stays in the Git history, in forks and in images already published. If the credentials open personal data, as in the medical-records database cited by Apiiro, the exposure must be assessed as a possible breach under the GDPR; for NIS2 entities it falls under the security of development and the supply chain (Article 21).
What to do now
- Look for the file in every repository, private ones and history included:
git log --all -- .claude/settings.local.json, code search across the GitHub organisation, a check of forks. - Rotate every credential you find, without waiting to learn whether it was used: deleting the file does not make it safe.
- Exclude the file at project level: add
.claude/settings.local.jsonto the repository.gitignoreand to.dockerignore; if it is already tracked,git rm --cached. - Check published Docker images and rebuild them without the file.
- Clean up the rules saved in
settings.local.jsonand pass credentials through environment variables or a secrets manager, never written into the command. - Scan AI assistant configuration files too, in pre-commit and in the pipeline, with rules for passwords in arguments and variables (
-p,PGPASSWORD=,Authorization:).
How ARXDOME helps
ARX Sentry keeps the software inventory of every computer, so you know where Claude Code is installed, and shows logins, privileged and night-time logins to monitored servers in the SOC pages: useful to notice if an exposed credential is being used. ARX Horizon enriches every login with the country, network operator and reputation of the source address.
Last updated:


