1,379 secrets in public Claude Code settings files

Apiiro found 1,122 public copies of Claude Code's local settings file holding 1,379 distinct secrets, saved by the don't ask again option. How it happens, why secret scanners miss many of them, and what to rotate on AWS.

Antivenom5 min read

When Claude Code asks to run a shell command and you choose "Yes, and don't ask again", it saves an allow rule in .claude/settings.local.json. If the command had a password in it, the rule has the password in it. Research from Apiiro, reported by The Hacker News on November 7, 2026, found 104,185 copies of that file in public GitHub repositories. 1,122 of them held at least one secret, 1,379 distinct secrets in total.

The file is meant to stay on one developer's machine. In more than a thousand cases it didn't.

What Apiiro found

The numbers below come from Apiiro's research as reported by The Hacker News and summarised in a Cloud Security Alliance research note, which links Apiiro's original post:

  • 104,185 copies of .claude/settings.local.json across 103,617 public repositories.
  • 1,122 copies (about 1.1%) held at least one secret, 1,379 distinct secrets in all.
  • 379 database passwords, 43 SSH logins for public servers, 42 GitHub, GitLab and npm tokens, and 23 AWS keys. More than a third of the secrets gave direct database access.
  • Every file with a secret was still on its repository's default branch. In half of those repositories, it had been there for at least 217 days.
  • Counting git history, shared .claude/settings.json files and saved agent transcripts, the total rises to 2,539 secrets across 1,994 repositories.

Diagram: how a secret typed into a command becomes a public leak. A developer approves a command with "don't ask again", the full command is saved as an allow rule, the file gets committed and pushed, and secret scanners miss many of the results. Apiiro's counts are shown at each stage.

Two caveats. Apiiro did not test whether the secrets still worked, so the number of live credentials is unknown, although one company Apiiro notified confirmed its exposed key had been live. And in 539 of 1,105 traced repositories, a commit that listed Claude as co-author changed the file. The CSA note is careful to say this does not prove Claude Code pushed every exposed credential.

How the secret gets into the file

Claude Code's documentation describes the behavior: when you choose "Yes, and don't ask again" for a Bash command, Claude Code saves that approval as an allow rule in .claude/settings.local.json. The rule is the command. If you ran a database client with the password inline, or exported a token in the same line, the approved command and the secret are now one string in a JSON file.

Per the CSA summary, Apiiro reproduced this in current releases and compared 16 coding agents. Claude Code was the only one confirmed to save the full approved command in a project file by default.

Why it reached GitHub

The documentation says that the first time Claude Code writes the file in a git repository that does not already ignore it, it adds **/.claude/settings.local.json to the user's global git excludes file. If you created the file by hand, you have to add it to .gitignore yourself.

That guard has gaps, which The Hacker News and the CSA note both describe. It lives in one person's global git config, not in the project. It does not protect a file that was already committed. It does nothing for teammates, CI runners, fresh clones, containers or published packages. The CSA note cites Check Point research that found the file in 428 of about 46,500 npm packages, with credentials in 33 of those files across 30 packages.

According to The Hacker News, an August 2025 bug report about plain-text credentials in these rules was closed by an automated bot as "not planned", and the researchers say none of the related reports got a reply from Anthropic.

Why scanners missed them

Of the 1,122 files with a secret, gitleaks flagged 564 and TruffleHog flagged 643. Neither tool flagged 215. The CSA note says most of the misses were passwords in command syntax, such as PGPASSWORD=, sshpass -p or mysql -p.

Secret scanners are tuned for keys with recognizable shapes. A database password inside a command line has no shape. It looks like any other argument.

What it means on AWS

Twenty-three AWS keys is a small number in this dataset. The reported categories do not say where the databases and servers behind the other secrets run, so the AWS share of them is unknown. The pattern matters more than the count: a developer working on infrastructure types a credential once, approves the command forever, and the credential ends up wherever the settings file goes.

Two AWS features remove the thing that leaks:

  • IAM database authentication for MariaDB, MySQL and PostgreSQL on RDS replaces the password with a token that lives for 15 minutes.
  • Short-lived credentials from IAM Identity Center replace static access keys on developer machines, so a key in a saved command expires on its own.

For keys that did leak, CloudTrail Event history lets you filter management events by AWS access key for the last 90 days. It does not show data events, so use a trail or event data store for S3 object reads.

What to do this week

  • Rotate first. Treat every credential that has appeared in one of these files, including in git history, as compromised. Deleting the file or rewriting history does not remove copies in forks, clones or mirrors.
  • Search your own repositories. Look for .claude/settings.local.json and .claude/settings.json in every repository, fork and archive, across full history, and in published npm packages.
  • Untrack and ignore it at the project level. Remove the file from git tracking, add it to the repository's own .gitignore, .npmignore and .dockerignore, and confirm with git check-ignore -v.
  • Clean local allow rules. Remove any allow rule that contains a literal secret. Prefer narrow pattern rules over approving fully specified commands.
  • Keep secrets out of commands. Pass credentials through environment variables loaded from a secrets manager, or use IAM database authentication where your engine supports it.
  • Add custom scanner rules. Teach your secret scanner about passwords in command syntax, and include .claude/ and other agent folders in scope.
  • Check AWS key usage. For any AWS key that appeared, deactivate it, then review CloudTrail for what it did while it was public.

The short version

The convenience feature worked as written. It saved what the developer approved, and the developer approved a command with a secret in it. Agent configuration is code now, and it needs the same review, ignore rules and scanning as code.

Antivenom is built for the step after the leak. Our AI red team runs only against your own systems, with your permission, and checks what a found credential actually unlocks in your AWS accounts. The AI blue team rotates and narrows it, and the red team retests to prove the old credential no longer works. For why rotation is the real bottleneck, read the leaked secrets rotation gap.

← All posts
  • Claude Code
  • Apiiro
  • settings.local.json
  • leaked secrets
  • secret scanning
  • AI coding agents
  • AI security
  • AWS security

The arms race has started

Evolve as fast as the attacker.

Antivenom is opening to a small group of security and platform teams first. Join the waitlist to get early access.