AImunk
NewsBy Daniel Okafor6 min read

Is your AI coding tool leaking your secrets?

Usually not by itself, but the files it writes can. A Claude Code approval file saved full commands, passwords included, and thousands ended up on public GitHub and Docker Hub. Check your repo history, rotate anything exposed, ignore agent folders, and update the tool.

Source: blog.gitguardian.com/claude-code-settings-local-json-secrets-docker-hub

The tool is probably not sending your keys anywhere by itself. The files it creates are the leak. The biggest leak of November came from a convenience button that saved full shell commands, passwords included, into a project file that was later pushed to GitHub or baked into a Docker image. Elsewhere, one agent put account email addresses where they did not belong, one desktop app wired itself into other agents on the same machine, and Windows was found keeping count of which coding agents you run.

Those are different problems that need different fixes. So it is worth taking them one at a time, then spending about ten minutes on your own repos.

The "don't ask again" file

Claude Code asks you to confirm before it runs a shell command. One of the answers is "Yes, and don't ask again". According to Anthropic's own settings documentation, that answer saves the approval as an allow rule in .claude/settings.local.json inside the project.

The catch is what gets saved: the command string itself. If the agent built a curl call with an API key in the header, or a psql call with PGPASSWORD= in front, the key went into the file as plain text.

Apiiro researchers Shmulik Cohen and Matan Giladi went looking for these files on public GitHub. iTWire's write-up of their study reports 104,185 public copies examined, 1,122 of which held secrets, with 1,379 distinct values. When they widened the search to git history, shared settings files and saved transcripts, they found 2,539 distinct secrets across 1,994 repositories. They did not test whether the credentials worked, so treat this as exposure, not proven breach. One company they contacted did confirm its key was live.

GitGuardian ran a bigger and different count. Its research post, dated 9 November, found 31,088 distinct secrets in settings.local.json files across 23,276 public repositories between January 2025 and 7 November 2026, with 5,343 still valid when detected. The two studies used different methods and time windows, so don't add them together or read one as a correction of the other.

For anyone running containers, two findings in the GitGuardian data stand out. First, public Docker Hub images held 613 distinct secrets from these files, 99 of them valid, because COPY . . ignores .gitignore. One valid Cloudflare token sat in 559 tags of a single image. Second, monthly leaks peaked at 12,535 in April 2026 and fell to 959 by October. The researcher says he doesn't know why.

Why do standard scanners miss this? The Postman engineering blog's summary of the Apiiro work notes that 215 of the leaked secrets got past two popular open-source scanners. A cloud key often has a fixed prefix that is easy to spot. A database password after a label has no recognisable format and looks like any other word.

The same Postman post adds a vendor's own data point, so weigh it as such. An inspector it ran on one engineer's laptop for three weeks saw 22 distinct secrets leave in agent traffic, and only 4 of them came from the project's .env. The exact number is not the point. Agents pull keys from more places than the one file you were watching.

What Anthropic says and has changed

The docs say Claude Code adds **/.claude/settings.local.json to your global git excludes the first time it writes the file. That protects one machine. The rule does not travel with the repo, so a new laptop, a teammate's clone or a hand-made file can still be committed.

CSO Online reported that Anthropic did not answer its request for comment. GitGuardian's post relays a Hacker News reply from Claude Code lead Boris Cherny: the team is investigating, the tool has not historically scrubbed secrets, and auto mode and built-in secret scanning are being prototyped.

The Claude Code changelog shows the concrete changes since. Version 2.1.323 changed "don't ask again" so that a rule that looks like it holds a secret, or would land in a git-tracked settings.local.json, lasts for the session only and is not saved. The same release fixed the global ignore not applying when a folder became a git repo later, or on a new machine. Version 2.1.327 tells Claude not to commit files that likely contain secrets. Those changes help from here on. They do nothing for a key that was pushed in the spring.

The email in the User-Agent

A different issue drew even more comments. In GitHub issue #107757, opened on 5 November, a user reported that Claude Code put their account email in the User-Agent header of web requests. Anthropic had been giving the model the account email as context, and the model sometimes used it as a contact string.

A reply on the issue the same day announced a built-in privacy mod that blocks this, on by default from version 2.1.317. The changelog shows the check was then changed in 2.1.321, 2.1.325 and 2.1.334, the last of which adds your git email too. An Anthropic statement quoted in the thread also said the email would be removed from model context entirely. In a 24 November comment on the issue, users said that removal had not shipped, and the issue was still open when checked on 2 December.

This is an identity leak, not a credential leak. It still matters if your account address is also your login name somewhere.

Postman wiring itself into your agents

GitHub issue #14370 now shows only that it has been deleted. Idlen's timeline records what it said. Postman desktop 12.33.4, on an automatic upgrade, installed Postman plugins into Claude Code and Codex, added a Codex startup hook, and pointed Codex at Postman's remote MCP server. The reporter did not claim any data was taken. The complaint was about consent, and about the installer marking its own hook as trusted.

Postman's reply on the issue said it bundles the plugins because users struggled to set them up separately, that each part can be removed in the app, and that it is reviewing the hook approval. Its head of product told a news site the opt-in would be made clearer for existing users.

Windows counting your agents

The fourth story is the least alarming once you read the source. Xusheng Li's analysis found a Windows 11 component that sets a bit when it sees processes such as claude.exe, codex.exe, copilot.exe or cursor.exe, plus common developer tools. He found no prompt text or source code in the event. It is marked as optional diagnostic data, and on his clean US install optional data was switched on by default. You can turn it off under Settings, Privacy & security, Diagnostics & feedback. If you want to see what actually leaves the machine, Microsoft's Diagnostic Data Viewer shows each event as the JSON that was sent.

What to do with this

Treat agent folders the way you treat .env files. That one habit covers most of the above.

Start with history, not just the working tree. In each repo, run git log --all --oneline -- .claude/ .cursor/ .gemini/, as the Postman post suggests. Any hit means the file was committed at some point, even if it is gone today. Then look inside the local file and your user-level settings for allow rules that contain tokens, passwords or connection strings.

If you find one, rotate first. GitGuardian and the Apiiro authors agree on this order. Deleting the file, or even rewriting history, does not reach forks, clones or images that already exist. Price every exposed key as if someone else already has a copy.

Then close the doors. Run git rm --cached .claude/settings.local.json, add the file to the repo's own .gitignore and to .dockerignore, and delete the secret-bearing rules through /permissions or by editing the file. Prefer narrow pattern rules like Bash(npm run test *) over exact commands with values baked in. Keep secrets in a secret manager or the environment, not typed into the command. The settings docs also show deny rules such as Read(./.env) if you would rather the agent never reads those files.

Finally, update Claude Code to a current version, and check ~/.claude/settings.json, ~/.claude/plugins/installed_plugins.json and ~/.codex/config.toml for anything you don't remember installing.

As I see it, the failure here was a default that saved too much, meeting a git add . habit that commits too much. Neither side is new. What is new is that an agent now writes config files in your repo on your behalf, so those files deserve the same suspicion as anything else that can hold a key.

AI helped draft this from the source linked below, and a person checked it against that source before publishing.

Report

10 replies

Rachel LeviNovice

The article ends by sharing the blame between a default and a habit. I am less generous, and I would like to ask why.

A confirmation button saved the full command, secret included, as plain text in the project folder. Who decided that the thing to store was the whole command and not a pattern? The article relays the team lead saying the tool has not historically scrubbed secrets. Why not, when its job is to run commands that contain them?

Users have committed too much for as long as version control has existed. Anyone designing a tool that writes files into a repository knows that. So is this a user habit meeting a default, or a default designed without the user's known habits in mind? As someone who leads application security, I know which of those I would write up as the root cause.

Report

I would write it up the other way round.

  1. git add . and COPY . . are not agent inventions. The article itself says neither side of this failure is new, and that the Docker images leaked because that copy command ignores .gitignore. That is a build habit, not an agent flaw.
  2. No default survives a workflow that publishes everything in the folder. Fix this one file and the next tool's file will leak the same way.
  3. The lasting fix in the article is the old one: keep secrets in a secret manager or the environment, not typed into a command. If the secret is never in the command, there is nothing for any tool to save.

Blaming the vendor feels good and changes nothing on your own machines.

Your third point assumes the user is the one typing the command. In the case the article describes, the agent built it. The person clicked "yes" on something they may not have read to the end. How is that a user habit?

And consider the scanners. The article says 215 of the leaked secrets got past two popular open-source scanners. If the standard safety net misses them, on what basis do we expect an ordinary developer to catch them by eye?

I agree the secret manager is the right end state. What I will not accept is that the party who wrote the file format carries the smaller share.

You are both right about different days.

  1. Before the leak, rachell is right. A tool that writes into the repo should assume the repo gets published. The article says a later version makes risky rules last for the session only. That should have been the first design, not the fix.
  2. After the leak, isha-arora is right. Nothing the vendor ships reaches a key that's already out. Rotate first, as the article says, then clean up.
  3. The Docker line should worry people most. A valid token sitting in 559 tags of a single image means a pipeline made the same mistake over and over.

I run deployments for a living. Check the image builds before the repos.

Reply to Rachel Levi
Girish KamathSeeker

12,535 leaks in April 2026, 959 by October. Those are the article's monthly figures, and I think they're the most cheerful numbers in a gloomy piece.

The researcher says he doesn't know why it fell, so I won't claim the fixes did it. But look at the rest of the timeline. An issue was opened on 5 November and a reply announcing a block came the same day. The changelog shows the "don't ask again" behaviour has been changed since. That's a tool being fixed in public, quickly, because real use exposed the problem.

Private testing rarely finds what thousands of real repos find. Shipping and then fixing fast is how this kind of flaw gets found at all. I wouldn't call it careless.

Report

"Fixed in public" means other people's keys were the test. The article's own line: those changes do nothing for a key that was pushed in the spring.

Point taken, and I take part of it back. I wrote as if a fast fix closes the matter, and it doesn't. The article says deleting the file, or even rewriting history, doesn't reach copies that already exist. For the people whose keys went out, quick patches are no comfort.

Fast fixing is still good. It's no excuse, though. A tool that handles commands with secrets in them should have been tested for exactly this before release. I still think some flaws only show up in real use. This wasn't one of them.

Nobody has argued the vendor's side yet, so I will, even though I wrote the article. A tool that asks before every command gets tiring, and tired people look for a way to stop being asked. Saving the approval was an attempt to make the careful path the easy one.

That explains the feature. It does not explain storing the full string. ksubramanian's point is in the piece and I agree with it: a fix going forward does nothing for what is already published. girish-kamath has moved to about where I am. Some of this could only be learned in the open, but a plain-text secret in a project file could have been caught on a whiteboard.

Reply to Girish Kamath
Rachel LeviNovice

A related risk surfaced this week, on the model side instead of the tool side. A scan of public Hugging Face repositories found GGUF models whose chat template inserts a fake system directive telling an agent with shell access to download and run a script: Malspark write-up. If your agent runs a local community model and has a shell, the model file is part of your attack surface.

Report
Reply to Rachel Levi
Lucas FerreiraSeeker

A fresh example of the same problem, from a GitHub issue discussed this week.

  1. The issue says a quickstart skill for coding agents sent the user's one-sentence project idea to a remote server, in a step marked in a code comment as telemetry, without telling the user.
  2. A reply from the project side on 28 November said the prompts are not used for telemetry, are sent only to generate a custom quickstart, and that the comment wording was wrong.
  3. The reporter then wrote that a later commit removed the telemetry labels and lets the user approve or decline. Two points were still open: scripts fetched at run time that are not pinned, and an unclear retention period.

Fixed fast, which is good. The lesson stays: a skill is code that runs with your agent's access. Read it before you install it.

Report
Reply to Lucas Ferreira