Trusting a Leading Agentic Harness Does Not Guarantee the Security of Your Application

Picking the most capable coding agent on the market is a reasonable decision. Assuming that decision also settles your security posture is not. This week's research on Claude Code shows why. One click on a permission prompt can write a production password into a file, and that file can end up in a public repository. The harness had a safeguard, and the safeguard ran on one laptop.
| At a glance | |
|---|---|
| The file | .claude/settings.local.json, written when a user picks Yes, and don't ask again |
| Public copies found | 104,185 in 103,617 repositories, per Apiiro |
| Copies holding a secret | 1,122, about 1.1%, holding 1,379 different secrets |
| Total across agent files, history and chat logs | 2,539 secrets in 1,994 repositories |
| Missed by both gitleaks and TruffleHog | 215 of the 1,122 files |
| Reported | Apiiro on 6 November 2026, covered by The Hacker News on 7 November |
How a click becomes a leaked password
By default, Claude Code asks before running most shell commands. Choose Yes, and don't ask again and it saves an allow rule in .claude/settings.local.json inside the project, per its permissions documentation. Matching commands then run without asking in later sessions.
The rule covers whatever the prompt offered. Sometimes that is a pattern such as npm test *. Sometimes it is one exact command, and then any password or token typed into that command is saved with it, in plain text. The researchers found saved commands with the secret still inside in public files, and reproduced the behavior with Opus 5.5 and Fable 5.1, the latest models.
The harness did try
This is the part worth sitting with. Claude Code does not ignore the risk. The first time it writes the file in a git repository, it adds the file to the user's global git excludes, per its settings documentation. On that computer, git then ignores the file in every repository.
That protection stays in one user's git settings on one machine. It does nothing for a file that was already committed. Claude Code never adds the file to the project's own .gitignore, so the protection does not travel with the project to a teammate, a CI runner or a fresh clone.
The agent also helped the file get committed. In 539 of the 1,105 repositories the researchers traced, a commit listing Claude as a co-author changed the file. Apiiro reads this as Claude often committing the file itself.
So a well funded vendor shipped a sensible mitigation, and it still leaked 1,379 secrets. The issue is not one careless vendor. A safeguard that lives inside one tool, on one machine, configured by one person, cannot be an organization's control.
What leaked, and why it matters
More than a third of the secrets open a database directly, including 379 database passwords. The rest include 43 SSH logins for public servers, 42 tokens for GitHub, GitLab and npm, and 23 AWS keys. The owners include 63 organizations, mostly software companies. The strongest cases include a database vendor's admin-level cloud key and the owner password of a medical records database.
Three numbers say this is not a cleanup job you can finish by deleting a file:
| Where the secret still lives | What Apiiro found |
|---|---|
| Default branch | Every file with a secret was still there as of 2 November. In half of those repositories, it had been there for at least 217 days. |
| Git history | 734 more secrets across 509 repositories exist only in older versions of the file. |
| Forks | 211 forks of 74 repositories carry the same secrets as the originals. |
Apiiro did not test whether these secrets still work. One company it notified confirmed its key had been live.
Your scanner probably missed it
Of the 1,122 files with a secret, gitleaks flagged 564 and TruffleHog flagged 643, run without their verification step. Neither flagged 215. Most misses are passwords typed inside commands. Scanners look for known key formats, and a password after PGPASSWORD=, sshpass -p or mysql -p looks like an ordinary word in an ordinary command line.
That gap is not new territory. Secrets live in more places than your repository, and an agent's config folder is now one of them. Apiiro notes the file can also travel inside an npm package, a Docker image, a zip archive or a synced folder.
It was reported, and closed
A bug report filed on 11 August 2025 said approved commands with API keys and tokens were stored word for word in settings.local.json. An automated bot closed it as "not planned" on 3 January, after 60 days without activity. Apiiro says the four related reports it cites were all closed by the same bot, and none got a reply from Anthropic.
The point is not to single out Anthropic. Of 16 coding agents whose documentation Apiiro compared, Claude Code is the only one confirmed to save the full approved command in a project file by default. The other 15 have their own defaults, and your teams probably run more than one of them. You do not control any vendor's roadmap or triage queue. You control what you check.
Why the fix cannot be another agent
The tempting answer is to ask the agent to be more careful, or to add an AI reviewer. Both put the control back inside a system that makes a judgment call each time, on one developer's machine, in one session. That is the same shape that failed here.
What this needs is boring and deterministic:
- The same rule in every repository. Whether a team uses Claude Code, Cursor or Gemini, the check for agent config files with secrets in them runs the same way, every time, without anyone opting in.
- History and forks, not just HEAD. A rule that only reads the default branch misses 734 secrets in this study alone.
- Organization templates, not personal settings. The harness protected one laptop. Best practice has to sit in the repository and in the pipeline, where every clone and every CI run inherits it.
- Evidence for every team. A security lead should be able to answer "which projects carry
.claude/settings.local.jsonin history" across the whole organization, not by asking each team.
Security has to start at the agent harness, because that is where the agent acts. But it cannot end there, because the harness is software someone else ships, with defaults someone else chose. The check that confirms your best practices hold has to sit outside the agent, and it has to be indifferent to which agent each team picked. That begins with knowing which AI agents you run.
What to do this week
Apiiro's guidance, in the order that limits damage:
- Find every copy. Search your GitHub organization for
.claude/settings.local.jsonand.claude/settings.json, including git history where the files are gone. - Rotate first. Change every password, token and key the files have ever held, before you clean up. Deleting the file leaves history and forks untouched.
- Stop tracking the local file. Run
git rm --cached .claude/settings.local.jsonand add it to the repository's own.gitignore. Add it to your organization's.gitignoretemplates too. - Clean the file on every laptop. Delete every rule that contains a secret, even where the file was never committed.
- Keep secrets out of commands. Reference them as variables from a secrets manager, such as
$DB_URL, so the saved rule holds the name and not the value. Approve patterns such asBash(npm run:*)instead of single commands. - Scan agent folders like
.envfiles. Treat.claude/,.cursor/,.gemini/,.specstory/and agent memory files as holding secrets, in pre-commit and CI scanning, including history. Make sure the scanner catches passwords inside commands, not only known key formats. Check credentials paired with a public server first, because those give access.
Try this next
Pick the three busiest repositories in your organization and look for .claude/settings.local.json in the full git history, not just the current tree. Then ask how you would know if a fourth team committed one tomorrow. If the honest answer is "we would find out when someone noticed", the agent you trust is not the gap. The missing control around it is.
References
- Research write-up on secrets in "don't ask again" files, Apiiro, 6 November 2026
- Claude Code's "Don't Ask Again" File Exposes Passwords and Keys in 1,122 Public Copies on GitHub, The Hacker News, 7 November 2026
- Claude Code permissions, Anthropic
- Claude Code settings, Anthropic
- anthropics/claude-code issue 5544, bug report filed 11 August 2025
