A permission shortcut with a plain-text memory
Claude Code, like most AI coding agents, asks for explicit permission before running a shell command. Developers who get tired of approving the same command repeatedly can click 'Yes, and don't ask again,' which saves an allow rule to a project-level configuration file, .claude/settings.local.json, so the same command runs without a prompt next time. GitGuardian researcher Guillaume Valadon found the mechanism behind that convenience: the allow rule stores the entire command string, not a sanitized reference to it.
If that command happened to include a credential, an API key passed in a curl header, a database password in a connection string, a cloud token used to authenticate a deploy script, the full string gets written to settings.local.json in plain text. Developers who then commit that file, often without realizing it holds anything sensitive, push the credential straight into their repository's history.
The scale, by the numbers
GitGuardian's scan found 31,088 distinct secrets inside settings.local.json files across 23,276 public GitHub repositories. Of those, 5,343 were still valid at the time of detection, meaning the credential had not been rotated or revoked and would have worked if used. Among the secrets whose validity GitGuardian could actually verify, 67 percent turned out to be working credentials rather than stale or already-rotated ones, a hit rate high enough to make this file type a genuinely efficient target for anyone scanning public GitHub.
Database connection strings made up the largest category of valid credentials, 2,280 distinct instances, followed by cloud provider tokens and AI service tokens. Monthly leak volume peaked at 12,535 in April 2026 and had fallen to 959 by October, a decline GitGuardian could not fully explain, though it's consistent with growing developer awareness of the issue over the course of the year.
Docker made it worse, independently
Beyond GitHub itself, GitGuardian found a second, related leak path through Docker Hub: 613 distinct secrets, 99 of them valid, spread across 543 image repositories and 7,625 tags. The cause is a common Docker build pattern, a COPY . . instruction that copies an entire project directory into the image. Docker does not honor .gitignore rules during that copy, so a settings.local.json file correctly excluded from Git history can still end up baked into a published container image unless a separate .dockerignore entry excludes it explicitly.
That is a distinct failure from the GitHub leak, requiring a second defensive step most teams don't think to take. Excluding a file from version control is the habit every developer has; excluding that same file from a Docker build context is a separate, less automatic habit, and this research shows plenty of teams are missing it.
What kinds of secrets, specifically
The exposed credential types read like a cross-section of modern infrastructure: database connection strings, cloud provider tokens, SSH passwords, Google API keys, and other service credentials, with database and cloud or AI tokens accounting for the largest valid categories. That spread reflects how Claude Code gets used in practice, running the same database queries, deploy scripts, and API calls a developer would run manually, just with a permission prompt attached, and now, for repeat commands, without one.
It also means the exposure isn't limited to toy projects or hobby repositories. A database connection string approved once and then auto-approved on every subsequent session is exactly the kind of production credential that ends up embedded in a config file a developer never thinks to treat as sensitive, because the file's job is permissions, not secrets.
A vendor response that stops short of a fix
Anthropic did not respond to CSO's request for comment on the research. GitGuardian reports that Claude Code lead Boris Cherny acknowledged the issue directly and said the company is looking into it, floating possible safeguards including built-in secret scanning on the permission file and an unspecified 'auto mode' that might handle repeated approvals differently. Neither of those is a shipped fix as of this research, which leaves the exposure live for any team currently using the Don't Ask Again option on commands that touch credentials.
For an enterprise rolling out Claude Code or any comparable AI coding agent at scale, this is a config management gap that didn't exist before AI coding tools arrived and now needs its own policy: treat .claude/settings.local.json, and the equivalent permission files from other AI coding agents, as a credential store by default, not a harmless preferences file.
What to actually do about it
GitGuardian's recommendations are the obvious ones, which doesn't make them less necessary. Rotate any credential that has ever appeared in a settings.local.json file pushed to a public or even private repository, since deleting the file from GitHub does not revoke a secret that was already published and possibly indexed. Add the file to both .gitignore and .dockerignore, not just one or the other, and audit previously published Docker images for leftover secrets baked in before that fix went in.
More structurally, extend whatever secret scanning your organization already runs on source code to cover AI coding assistant configuration files specifically, since they are not where most scanning tools or developer instincts currently look. And push developers toward environment variables over hardcoded credentials in the commands they run through Claude Code in the first place, which removes the problem at the source rather than cleaning it up after the fact.
A gap the entire AI coding category shares
Nothing about this failure mode is specific to one vendor's implementation choices in a way that makes it an outlier. Any AI coding agent that offers a persistent, auto-approve permission mechanism has to decide how to store the commands it remembers, and storing them verbatim is the simplest engineering choice, which is exactly why it is also the common one. Enterprises standardizing on one AI coding tool over another should ask each vendor directly whether approved commands are stored as literal strings or as sanitized patterns, since that single design decision is the difference between this research finding nothing and finding 31,000 secrets.
Until vendors across the category ship the kind of built-in scanning Cherny described as a possibility, the control has to live with the enterprise rolling the tool out: a written policy on what AI coding agent config files are, how they get excluded from both version control and container builds, and a recurring scan that treats them the same way you already treat .env files and cloud credential stores. The convenience feature isn't going away, so the governance around it has to catch up to match it.



