Your coding agent leaked the key. It was only following orders.
We’ve all done it. Your coding agent asks, for the fourteenth time today, whether it can run a command you’ve already approved thirteen times, and you click the button that makes the question go away. It’s one of the small joys of working with agents, right up there with watching a test suite go green on the first try.
It turns out that button has a very good memory. Earlier this month, security firm Apiiro went looking through public GitHub repositories for one of the files where an agent keeps the commands you’ve approved, Claude Code’s .claude/settings.local.json. Out of 104,185 public copies, 1,122 held a real secret, and once you add git history, shared settings files, and saved agent chat transcripts, the count reached 2,539 secrets across 1,994 repositories.
The list included database passwords, cloud keys, API tokens, and SSH root logins, among them a production Azure Postgres password, a Square production token, and the owner password of a medical-records database. One company Apiiro contacted confirmed that its key had been live. The Hacker News reported that half of these files had been sitting on default branches for more than 200 days, and that forks carried copies of the same secrets, so deleting the original file didn’t make them go away. It’s careful research, too: Apiiro traced files across more than 100,000 repositories, checked git history and forks, benchmarked the scanners teams rely on, and contacted affected companies.
How a password ends up in a settings file
Nobody sets out to commit their database password. What happens is much more ordinary. You ask the agent to check something in the database or call an API, it reads the credential it needs from your project’s config, and it proposes a perfectly reasonable command with that credential filled in. You approve it for good, and the agent dutifully saves the exact command as an allow rule (illustrative values):
{
"permissions": {
"allow": [
"Bash(PGPASSWORD=EXAMPLE-ONLY psql -h db.example.com -U app)",
"Bash(curl -H \"Authorization: Bearer sk-live-EXAMPLE-ONLY\" https://api.example.com/v1/orders)"
]
}
}
The file is meant to stay on your laptop, but nothing in the repository says so, and a broad git add doesn’t ask. Secret scanners also have a hard time with this, because a password sitting after PGPASSWORD= looks like any other word to a tool that searches for known key formats. When the researchers ran two popular open-source scanners over the leaked files, 215 of them got past both.
This study happened to look at one agent’s settings file, and the team behind it has said it’s working on secret scanning. But the pattern isn’t about one tool. Every agent harness writes things down: approved commands, chat transcripts, memory files, generated scripts. That’s why Apiiro’s advice to security teams covers .claude/, .cursor/, .gemini/, and .specstory/ directories alike, and suggests treating all of them the way you’d treat a .env file. When a Postman engineer ran Passport’s Lens traffic inspector on their own laptop for three weeks, it found 22 distinct secrets going out, and only four of them came from the project’s .env.
An agent is very good at taking what you give it and putting it to work. If you give it a working key, that key ends up in whatever it builds, and you can’t count on every one of those places staying private.
Give the agent something not worth stealing
Apiiro’s recommendations are sound: rotate first, ignore the local file, keep secrets out of commands, approve patterns instead of exact strings, and scan agent folders. But taken together, they ask thousands of developers to handle credentials perfectly, many times a day, and this research shows how well that holds up at scale. A sturdier fix is changing what the agent holds in the first place, which is the idea behind Passport from Postman.
With Passport, your project’s config holds a secret reference, something like {{vault:<secret-reference-id>}}, instead of the real key. The real secret stays in the store you already run, such as HashiCorp Vault, AWS Secrets Manager, or Google Cloud Secret Manager. When a call goes out, a Passport Proxy in your own cloud checks who’s calling and whether they’ve been granted that API, and only then swaps in the real value. The security model says the resolved secret never passes through Passport Cloud and never shows up in logs.
So when the agent builds a command from that config, the command carries the reference, and so does the allow rule it saves (illustrative values, using passport request:
{ "permissions": { "allow": [ "Bash(passport request \"https://api.example.com/v1/orders\" -H \"Authorization: Bearer {{vault:<secret-reference-id>}}\")" ] } }
If that file ends up on GitHub, in a fork, or inside an npm package, whoever finds it gets a reference that’s bound to your identity and doesn’t work from their machine. You’d still tidy it up, but it’s no longer an incident, and since no password was ever in the command, there’s nothing for a scanner to miss.
It also helps with the question this kind of study can’t answer, which is whether a leaked key was ever used. Access in Passport is granted per API with an expiration, an Admin can revoke one person’s or one agent’s access at any time on the Governance page, and every call through the proxy is logged against the caller’s identity. Postman runs Passport internally, and reports going from 278 API keys scattered across laptops, CI configs, and manifests to zero production credentials on developer machines.
To be fair about the limits, Passport brokers HTTP API calls, so the database passwords and SSH logins that made up a big share of Apiiro’s findings need their own fixes, like short-lived database credentials and SSH certificates. And a key that has already leaked needs rotating no matter what you move to next.
If your agent has been keeping notes
Rotate first, then clean up, because git history and forks keep copies. To see whether agent files have ever been committed in a repo and to stop tracking the local settings file:
git log --all --oneline -- .claude/ .cursor/ .gemini/
git rm --cached .claude/settings.local.json
echo ".claude/settings.local.json" >> .gitignore
While you’re in there, delete any allow rules that contain a real secret, and prefer patterns like Bash(npm run:*) over single commands.
If you’d like to know what your agent is sending before you change anything, the free Passport CLI Community Edition includes Lens. Run it around your agent for a day and see which keys show up. None of this is a reason to stop using coding agents. It’s a reason to assume that anything an agent can see can eventually leak, whoever built the agent, and to plan around that. Then you can keep clicking “don’t ask again” with a clear conscience, because the thing it remembers won’t be a password.
Resources
- Apiiro: Coding agents leaking secrets to GitHub via “Don’t ask again”
- The Hacker News: Claude Code’s “Don’t ask again” file exposes passwords and keys in 1,122 public copies on GitHub
- Welcome to Passport
- Passport security model
- What Passport found in 3 weeks of AI agent traffic

What do you think about this topic? Tell us in a comment below.