SecurityBrief Asia - Technology news for CISOs & cybersecurity decision-makers
Asia
'Don't ask again': the AI coding-agent habit that leaked developers' passwords, and the fix that followed

'Don't ask again': the AI coding-agent habit that leaked developers' passwords, and the fix that followed

Tue, 24th Nov 2026 (Today)
Shmulik Cohen
SHMULIK COHEN AI Security Researcher Apiiro

Every AI coding agent asks permission before it runs a shell command. Every developer, sooner or later, gets tired of being asked. Claude Code offers a way out: "Yes, and don't ask again." Click it, and the tool saves the approved command so it won't prompt you for it next time.

The problem is what it saves. It stores the exact command string, in a file called .claude/settings.local.json inside the project folder. If the command was psql with a password, or curl with a bearer token, or sshpass with a root password, that secret is now part of a permission rule in a project file. Project files get committed.

We wanted to know how often that happens, so we downloaded every public copy of the file on GitHub. There were 104,185 of them, in 103,617 repositories, and 1,122 held a real secret. Once we added git history, the shared settings file teams commit on purpose, and agent chat transcripts, the count rose to 2,539 distinct secrets in 1,994 repositories. Among them were 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. One company confirmed its key had been live.

Nobody meant to publish a key

The file is supposed to stay local. Claude Code adds it to the developer's global git-ignore list when it creates it, which covers the common case. It does not cover a folder that becomes a repository later, a clone on a second machine, or a file someone already committed. The rule never goes into the project's own .gitignore, so the protection does not travel with the code. Often the agent commits the file itself. In more than half the repositories we traced, a commit co-authored by the agent had changed it. The developer approved a command, the agent recorded it, and the agent shipped the record.

Once public, these files stay public. In the median affected repository the file had been exposed for 217 days, and in 118 repositories for more than a year. Deleting it is not enough. Earlier versions in git history held hundreds more secrets, and forks carry their own copies.

Your scanner probably misses a fifth of them

We ran gitleaks and TruffleHog, two of the most widely used open-source secret scanners, across all 104,185 files. Of the 1,122 with a real secret, about one in five were flagged by neither. The reason is structural. Scanners are tuned to key formats, a provider prefix followed by a long random string. A password typed after PGPASSWORD=, sshpass -p or mysql -p is just a word on a command line. Agents create exactly that kind of record. They log what was run, not what was a credential. The same blind spot applies to agent chat transcripts, memory files and handoff notes.

What has changed since

GitGuardian asked the same question at a larger scale, across everything ever pushed to public GitHub plus public Docker images, and checked which secrets still worked. In Claude Code's settings.local.json alone it counted 31,088 distinct secrets across 23,276 repositories, 5,343 of them still valid when found, with hundreds more inside published Docker images. Two separate studies reached the same place. This is a category of exposure, not a handful of unlucky repositories. There is better news in the same data. Monthly leaks into these files have fallen by more than 90 percent from their April peak, which suggests the warnings are landing.

The tool changed as well. In mid-November Anthropic shipped an update to Claude Code. When you choose "don't ask again," an allow rule that looks like it holds a secret, or that would be saved to a settings file git is already tracking, now lasts for the session only and is never written to disk. The same release closed the gap where the ignore rule did not apply to a folder that became a repository later. That shuts the most common path for one tool.

If you have ever clicked "don't ask again," open the file, delete any rule that contains a secret, and rotate the credentials it held. Removing the file does not clear git history, forks or clones. Reference secrets as environment variables instead of typing them into commands, so the rule your agent remembers reads $DB_URL and not the password behind it.

Why this keeps happening

The fix is the right move, and it closes one door. The behavior was never a defect in a single product. Coding agents are built to remember what they did so they can do it again with less friction, and every piece of that memory is a file: a settings file, a transcript, a memory note, a handoff. Files end up in repositories, packages and backups. The same password a scanner misses in one agent's config will sit, unflagged, in the next agent's log. Treat agent folders the way you already treat .env files, as secret-bearing, on laptops as much as in repositories. Scan them in pre-commit and in CI, including history, with tooling that catches passwords inside commands and not only provider key formats. As agents take on more of the work, the records they keep become a new place for secrets to leak, and they deserve the same scrutiny we already give to .env files and CI logs.