# Claude Code credentials leaked in 1,122 public repos

> The file that stores approved commands contains passwords in plain text. Apiiro found 1,379 secrets in public copies of settings.local.json.
> By José Maldonado · Artificial Intelligence · 2026-11-10

When Claude Code asks whether it can run a command and the user answers "yes, and don't ask again," the assistant stores that authorization in a project file called \`.claude/settings.local.json\`. If the command carried a password inside it, the password is saved with it, in plain text and without warning. Apiiro researchers found 1,122 public copies of that file with at least one secret inside.

The work was published on November 5 and is signed by Shmulik Cohen and Matan Giladi. The numbers behind it are large: they reviewed 104,185 public copies of the file spread across 103,617 GitHub repositories, and around 1.1% contained real credentials. Together, those copies add up to 1,379 distinct secrets. The [Apiiro research on Claude Code credentials](https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html) describes the mechanism precisely: the saved rule covers only what the prompt offered, sometimes a pattern like \`npm test \*\` and sometimes an exact command. In the second case, any password or token typed on the line is written verbatim into the project.

The file is only uploaded if the repository is cloned on another machine or if a folder becomes a repository later, and in many cases Claude Code itself makes the commit without user intervention.

## What is inside those files?

More than a third of the secrets open a database directly: 379 database passwords, including one for production on Azure PostgreSQL. Then come 43 SSH accesses to public servers, some with the root password, and 42 GitHub, GitLab and npm tokens.

The list continues with 23 AWS keys, 122 Supabase service keys, 103 account tokens from the same provider and six private keys. The researchers also located a Square production token and credentials associated with an application that manages medical records. In total, the files belong to 63 organizations.

None of those secrets was tested. Apiiro did not attempt to log in or contact any host, so the work documents an exposure and not a consummated breach. One of the organizations notified confirmed that its key was still active when it received the notice, which is the closest thing to a confirmation of real damage.

## Protections that do not cover the case

Claude Code does something reasonable by default: the first time it writes that file in a repository, it adds \`\*\*/.claude/settings.local.json\` to the user's global git exclude file. The problem is where that protection lives, which is in one person's configuration on a specific machine.

It does not travel with the project, it does not cover an already committed file and it does not prevent another team member from uploading it from their own environment. Of the 1,105 repositories the researchers could trace, in 539 a commit with Claude as co-author had modified the file, a sign that the assistant touches it more often than the documentation suggests.

The trail does not disappear when the file is deleted either. Old versions stored in git history add another 734 secrets in 509 repositories that no longer have a current copy, and 211 forks of 74 repositories carry the same values. Of the 76,011 copies of the shared \`.claude/settings.json\` file, 298 contained secrets.

## The problem with scanners

It is not the first clash between agents and secrets: [VOLTA was already using Claude to appraise what it stole](https://observatorioblockchain.com/en/cybersecurity/volta-infostealer-claude-gemini-kimi-victimas/) and [OpenAI detected 948 flaws in Linux](https://observatorioblockchain.com/en/ai/openai-detecta-948-fallos-linux-tomar-control/) with the same type of automated review.

Half of this incident is about detection. Of the 1,122 files with secrets, gitleaks flagged 564 and TruffleHog flagged 643; 215 were seen by neither. The reason is that both look for known provider formats, and a password written after \`PGPASSWORD=\` or \`sshpass -p\` looks like just another word on the command line.

That gap explains why the finding matters beyond Claude Code. Any agent that stores full commands in a versionable file reproduces the pattern, and current scanners are not built to read commands as if they were credentials.

Of the 16 coding agents whose documentation Apiiro compared, Claude Code is the only one that stores the full command in a project file by default. That detail does not absolve the rest, but it marks where the design difference lies.

## Be careful about exposing your repository

The correct order is to rotate first and clean up afterwards. Change every password, token and key the file has ever stored, and only then rewrite the history or delete the copy, because the value is already compromised from the moment it was published.

The second step is to review the file locally even if it has never been uploaded. Any rule containing a secret must go, and any that are to be kept should point to variables (\`$DB\_URL\`) instead of literal values. Approving patterns like \`Bash(npm run:\*)\` instead of individual commands reduces the problem at its source.

The third is about process. If the team uses agents that commit on their own, it is worth adding the file to the project's \`.gitignore\` rather than relying on the global excludes, and reviewing commits that touch local configuration before pushing.

## The problem with working with agents

The conversation about security in coding assistants has focused on prompt injection and network permissions. This case points to a more domestic risk: the assistant does exactly what it is asked and stores the shortcut, with the secret inside, in a file the project treats as minor configuration.

It does not take a sophisticated attacker to turn an approved command into a leak. It is enough for someone to upload the folder, for a clone to reach another machine or for the agent itself to make the commit the user did not review.

At this point, it remains to be seen whether Anthropic changes the default behavior, and a public response to the earlier reports is still missing: the researchers cite four related notices, all closed automatically and none with a response from the company. There is also no figure for how many of the 63 organizations still have live credentials.

For anyone working with these assistants, this week's task fits in one command: search for \`settings.local.json\` in your own repositories, open the files and rotate whatever appears. It is cheaper than explaining a year from now why the production password was in a public repository.
