The takeaway
An agent's permission rules, transcripts and memory files are a secret store by accident. Rotate anything that touched them, reference secrets as environment variables, and add agent config folders to gitignore templates and secret scanning.
Why it matters for builders
If your agents run in CI or n8n and persist permissions, transcripts or memory files, treat those paths as secret-bearing: approve command patterns instead of literal commands, reference $VARS, extend gitignore templates and scanner rules to .claude/, .cursor/ and .specstory/, and rotate first rather than deleting files.
Claude Code's Permission Files Are Leaking Real Secrets
Ask an AI coding agent to debug a staging login and the command it proposes will contain your database password. That is not a bug in the model's judgement, it is the only way the command can work. The damage starts after approval: choose "Yes, and don't ask again" and the agent writes that exact command, credential included, into .claude/settings.local.json in the project folder. Nothing marks the file as private, so it ships with the rest of the code.
Researchers at Apiiro, Shmulik Cohen and Matan Giladi, counted how often this already happened. Their findings, published on 5 November and picked up by Ars Technica this week, describe a failure that is boring, mechanical and still live in thousands of repositories.
What the census found
Apiiro scanned the whole of public GitHub and found 104,185 copies of .claude/settings.local.json across 103,617 repositories. Of those, 1,122 files, about 1.1%, contained a real secret: a key in a known provider format, or a password or token sitting next to a public host. Together they hold 1,379 distinct credentials, split into 636 provider keys and 743 passwords or tokens.

The composition is the part that should worry a security team, because it is not a scatter of low-value test keys:
- 379 database passwords and 122 Supabase service-role keys, which bypass row-level security entirely.
- 103 Supabase account tokens, each one able to control every project in an account.
- 43 SSH logins, including root passwords typed inside
sshpasscommands. - 42 GitHub, GitLab and npm tokens, 23 AWS keys and 6 private keys.
The scale holds up at organization level too: 63 organizations carried a real secret in a public allowlist. Among them a database vendor that exposed its own cloud API key with manage access and no expiry claim, a B2B startup's production Azure Postgres password, a software agency's Square production token, and an IT services firm whose password for a medical-records database owner role was public.
These are not fresh accidents. On 2 November 2026 every file sat on a default branch, and in the median repository it had been committed 217 days earlier. 211 forks of 74 repositories carry the same secrets forward, so deleting the file does not clean history, forks, or clones.
Why the approval layer became a secret store
The mechanism is a design mismatch. Claude Code asks before running a shell command several times per session. The "don't ask again" option is a convenience feature aimed at reducing prompt fatigue, and it stores the approved command as a permission rule. Sometimes the rule becomes a pattern, but often the literal command line gets written out, including the PGPASSWORD= prefix, the bearer header in a curl call, or the password in a mysql -p invocation.
Anthropic's documentation says the local settings file is added to the developer's global gitignore when Claude Code creates it, and Boris Cherny, who leads Claude Code, told Hacker News over the weekend that the exposed copies came from files "manually created and checked in". Apiiro's data complicates that explanation in one specific way: in 539 of the 1,105 repositories it traced with a real secret, a commit co-authored by Claude changed the file. Claude Code's commit instructions tell the model never to commit .env or credentials.json, but its own settings file is not on that list.

There is also a volume effect that punishes long-running projects. One in ten files larger than 8 KB held a real secret, against fewer than one in 500 files under 500 bytes. The longer a developer keeps clicking "don't ask again", the more literal commands accumulate, and the more likely one of them carries something that authenticates.
The leak is not confined to one filename. 298 of 76,011 committed shared .claude/settings.json files held secrets, as did 120 chat transcripts in 87 repositories, 33 handoff notes, nine repositories with agent memory files and nine with VS Code Copilot auto-approve settings. Counting history, shared settings and transcripts, the total reaches 2,539 distinct secrets in 1,994 repositories.
What secret scanners cannot see
The most consequential finding for security pipelines is that the standard tools miss a fifth of it. Apiiro ran gitleaks and TruffleHog across all 104,185 files: gitleaks flagged 564 of the 1,122 files with a real secret, TruffleHog 643, and 215 were flagged by neither.

The gap is structural, not a bug in either scanner. Secret scanners are trained on key shapes: a provider prefix, a long random string, an obvious token format. A password typed after PGPASSWORD= or inside a bearer header is just an ordinary word in an ordinary command line. Both tools mostly let it through, and the same blind spot applies to every file where an agent logs what it ran: transcripts, memory files, handoff notes.
That is why exposure surfaces multiply faster than detection rules: one repository can now hold a .claude/ folder, .specstory transcripts and an agent-written memory file, each carrying credentials as prose rather than as a key format.
The Anthropic response and what builders should do now
Anthropic was notified before publication. On 7 November Cherny responded that Claude Code "has not done secret scrubbing" and that the team is "looking into what we can do to prevent this", with prototypes for auto mode and basic secret scanning. He conceded "good catch" when a reader noted auto mode can also save a sensitive command. The behaviour has been reported in GitHub issues since August 2025, some closed automatically as inactive.
For teams running agents in production, stop treating agent configuration as developer preference and start treating it as secret-bearing infrastructure:
- Reference variables, never values. Make the approved command read
$DB_URL, so the rule records the variable name and not the credential. - Approve patterns, not literals. Rules like
Bash(npm run:*)are reusable; a fully spelled-out command with a password is a permanent liability. - Treat
.claude/,.cursor/,.gemini/,.specstory/and agent memory files as.env. Add them to organization-level gitignore templates and to pre-commit and CI scanning, including history. - Tune scanners for passwords inside commands, not just provider key formats, and triage credentials paired with public hosts first, because those grant access.
- Rotate first, clean second. Removing a file does not revoke a credential, and forks and history keep serving it.
The deeper lesson is about what an agent's memory is. Permission rules, transcripts and memory files record intent, and intent often includes the password someone typed at 2am to make a migration run. Any system that persists an agent's actions is a secret store by accident, and needs the same rotation and scanning discipline as the secrets it copies.
What to watch
Whether Anthropic ships secret scanning at the point of approval, which would close the loop before a rule reaches disk. Whether GitHub extends push protection to agent configuration paths, catching the leak at the platform layer regardless of client behaviour. And whether Cursor, Gemini CLI and other agent vendors audit their own permission files, because Apiiro's sample shows the pattern follows the habit, not the vendor.
The Automation Brief
Read 5 AI stories instead of 50.
The essential moves in AI agents, models, automation and infrastructure — filtered for builders and operators, with the part that actually matters.
No noise. Unsubscribe anytime.
Editorial notes
Stefan Trbojevic
n8n Lab Editorial
9 November 2026
9 November 2026
Sources
AI disclosure: AI assisted with research and drafting. Factual claims are reviewed by an editor.



