Coding agents are saving real passwords in files that end up on GitHub
A study of public repos found real secrets in Claude Code's saved-approval files. Cursor and Gemini keep similar files, and one git command shows whether yours leaked.
The short version
- Apiiro checked 104,185 public copies of Claude Code's local settings file; 1,122 held a real secret.
- Counting git history, shared settings and chat transcripts: 2,539 secrets across 1,994 repositories.
- Two open-source secret scanners both missed 215 of the leaked files.
- Cursor, Gemini and SpecStory folders keep similar records, so the risk is not limited to one tool.
- One git log command shows whether agent folders were ever committed to your repo.
Why it matters
Clicking 'don't approve again' feels harmless, but it can turn a one-off password into a permanent line in a file. Anyone who lets an agent touch real databases or paid APIs should check their repos, and replace any key that may have been exposed.
How a password ends up in a file
As dev.to reported, in a post first published on the Postman blog, the leak is not caused by anyone being careless on purpose. You ask your coding agent to query a database or call an API. It finds the credential in your project's config, builds a sensible command with that credential inside, and asks permission to run it.
You approve it permanently so the prompts stop. The agent then records that exact command, secret included, as an 'allow rule' in a settings file. In Claude Code that file is .claude/settings.local.json.
The file is meant to stay on your own machine. But nothing in the repository enforces that, and a broad git add will sweep it into a commit without asking.
What the researchers found
Security firm Apiiro searched public GitHub repositories for that one file. Of 104,185 public copies, 1,122 contained a real secret.
The count grew once Apiiro looked beyond the current files. Adding git history, shared settings files and saved agent chat transcripts brought the total to 2,539 secrets spread across 1,994 repositories.
The pattern is not specific to Claude Code. Agent tools generally keep records of approved commands, conversations, memory notes and generated scripts. Apiiro's advice therefore covers the .claude/, .cursor/, .gemini/ and .specstory/ folders, and says to treat them with the same care as a .env file, the usual home for project secrets.
Why scanners did not catch it
Secret scanners usually hunt for text that matches the format of known keys. A database password typed after PGPASSWORD= has no special shape, so it looks like any other word.
The researchers ran two popular open-source scanners over the leaked files. In 215 cases, both tools let the secret through.
That is a practical warning: a clean scan of your repo does not prove an agent's notes are clean.
Check your own repo today
If a key may have been exposed, replace it first. Git history and forks keep old copies, so deleting the file later does not undo the leak. Then clean up.
- To see whether agent folders were ever committed: git log --all --oneline -- .claude/ .cursor/ .gemini/
- To stop tracking the local settings file: git rm --cached .claude/settings.local.json
- To keep it out of future commits: echo ".claude/settings.local.json" >> .gitignore
Then open your allow rules and delete any that contain a real secret. Where you can, approve a broad pattern such as Bash(npm run:*) rather than one exact command with values baked in.
The vendor's fix, and its limits
The post comes from Postman, which sells a tool called Passport, so read this part as a product pitch with a sound idea behind it. Rather than relying on people to handle secrets perfectly all day, the idea is to change what the agent can see.
With Passport, project config holds a placeholder reference to a secret, and the real value stays in the secret store you already use. The command the agent builds, and the allow rule it saves, carry only the reference. Postman says that reference is tied to your identity and does not work from someone else's machine, so a leaked file would be untidy rather than an emergency.
There are limits. Passport handles HTTP API calls only. Database passwords and SSH logins need other approaches, and the post points to credentials that expire quickly and to SSH certificates. It also offers Lens, bundled with the free Passport CLI Community Edition, to show what your agent sends over a day of work.
The lesson beyond one tool
The post's conclusion is not to abandon coding agents. It is to assume that anything an agent can read may eventually end up somewhere public, whichever company built the agent.
That fits the simple habits already worth having: keep real keys out of project folders where you can, and give agents credentials with limits attached. If a key was ever pasted into a chat or committed, treat it as exposed.
What to watch
- Whether Cursor, Google and other agent makers stop saving raw secrets in approval files by default.
- Whether secret scanners add detection for passwords inside saved agent commands.
- How well reference-style secrets hold up for databases and SSH, which the post says its tool does not cover.
Try it
In a repo where you use an AI coding agent, run: git log --all --oneline -- .claude/ .cursor/ .gemini/. If anything appears, open those files and look for passwords or tokens.
Sources and links
Liked it? Say why
Add a line for other readers.
No account needed. We never show your email. Comments with links, ads or abuse are held and not shown. Your comment shows after a quick check.
Listen to the AI Wire headlines
Listen to the AI WireListen to our daily AI shows every morning: on your commute, in the shower, wherever you are
Listen to the daily showsWritten by the SI Agent News Desk from the reporting above.Written with AI from the source above. Every number is checked against the source. Spot a mistake? Corrections.
