Apiiro identifies that Claude Code keeps secrets in settings.local.json and exposes credentials

Author: Published 6 min de lectura 28 reading

The images in this article were generated with artificial intelligence. How we publish

Security researchers warned this week that approved Claude Code commands - Anthropic's programming assistant - have left passwords and API keys in project files that have been made public in GitHub. The file in question, .claude / settings.local.json, you can literally save the authorized order and any secret included in it when a developer chooses the option "Yes, and don't ask again." Apiiro, the firm that reported the finding, found over a hundred thousand copies of the file in public repositories and counted over a thousand that contained at least one visible secret.

Confirmed facts: Apiiro reported 104,185 copies of the file in 103,617 public repositories and detected 1,122 files containing at least one secret, adding 1,379 different values that met secret criteria (known key formats or passwords adjacent to public addresses). Among these secrets were 379 database passwords, 43 SSH credentials for public servants, 42 tokens for platforms such as GitHub / GitLab / npm and 23 AWS keys. In several cases, high-impact credentials are mentioned: a database provider with a cloud administrator key and the password owner of a medical history database. Apiiro reproduces the command writing that includes secrets with the Opus 5.5 and Fable 5.1 models and found that Claude Code tries to add the file to the user's global git exclusion in the first writing (not to the .gitignore of the repository). In addition, in many repositories the commitments that modified the file list "Claude" as co-author, suggesting that the assistant sometimes made the commit.

Apiiro identifies that Claude Code keeps secrets in settings.local.json and exposes credentials
Image generated with IA.

What is technically happening: by default Claude Code asks before running most shell commands. If the user selects the setting to not ask again, the wizard writes a permit rule in .claude / settings.local.json within the project folder. That rule can be a pattern (e.g. npm test *) or an exact command chain. When the rule is an exact chain and the command includes a token or password - for example PGPASSWORD = mysql password -h server... - the literal value is stored in the JSON in clear text. Claude tries to avoid future commitments by ignoring the file at the user's git system level, but that exclusion does not travel with the repository: if the file was already compromised in a commit, it remains in the history of git and can be spread to distributed forks or packages.

Who is affected and how damage can occur: the main affected are development teams that use Claude Code and store repositories on public platforms or in services with shared forks and packages. The actual consequences vary according to the sensitivity of the credentials found: direct access to databases, SSH servers or cloud services can allow data exfiltration, data modification, malicious deployments or use of resources for illicit activities. Apiiro reports that many of the files with secrets were in the default branch and that in half of these cases were at least 217 days exposed, which increases the window for exploitation. The researchers do not claim that all the keys have been used, but they do confirm at least one case where the owner verified that the key was still active.

What is known with uncertainty: Apiiro does not claim that the secrets have been exploited massively; neither is it known how many of the keys are still valid beyond the confirmed case. Anthropic's corporate responsibility for correction or mitigation is also not clear in public: several user reports on this behavior were closed by an unanswered bot, according to the research team's summary; there is no public statement from Anthropic cited by the researchers in the report we have.

Why the automatic detectors are short: common secret scanning tools such as gitleaks and TruffleHog did not detect all the cases; Apiiro executed both on the files and observed that gitleaks marked 564 of the 1,122 problem files, TruffleHog 643, and 215 went unnoticed by both. The technical reason is simple: many detectors look for patterns of known key formats, and a password in a command chain (e.g. mysql -u user -pMiPassword) does not have the signature of a structured key, so it escapes format-based heuristics.

What concrete steps to take developers and security equipment: researchers and security practice recommend prioritizing the immediate rotation of credentials found before trying to clean up repositories (because old copies in history and forks keep the secret). Verified and practical recommendations to be implemented today:

1) Search and roll first. Search your organization by.claude / settings.local.jsonand.claude / settings.jsonin public and private repositories, and review the git story even when the file is no longer in the head of the branch. Change (root) any password, touch or key that has appeared in those files before deleting copies.

2) Clean the tracking and add your own rules. Rungit rm --cached .claude / settings.local.jsonto stop following the file and add it explicitly to.gitignorefrom the repository (the global exclusion Claude applies does not travel with the code). Also include an entry in the organization's .gitignore templates to avoid future accidental commitments.

3) Replace secrets with variables and secret manager. Do not put tokens or passwords in commands: use environment variables or references to secret managers (e.g. $DB _ URL) so that the approved rules save only the variable name. When you approve rules, you prefer patterns (Bash (npm run: *)) rather than verbatim chains with credentials.

4) Try agent folders like secret files. Add customer agent folders (e.g..,.cursor /,.gemini /) and agent memory files to pre-commit and CI secret checks, and to local exclusion lists. Include git history analysis in scans.

Apiiro identifies that Claude Code keeps secrets in settings.local.json and exposes credentials
Image generated with IA.

5) Improve the secret scan. Make sure your detection rules look for passwords inserted in commands (such as PGPASSWORD =, sshpass -p, myshql -p) as well as structured key patterns; and complete with manual scanning and review tools. Projects and equipment can find useful detection utilities such as gitleaks and TruffleHog to start the sweep, but it does not depend only on them: add your own heuristic rules.

Sources and additional reading: Apiiro's research report and blog present the count and criteria used (https: / / www.apiiro.com) and GitHub's documentation on secret scanning explains how to integrate detection into repositories (https: / / docs.github.com / en / code-security / secret-scanning). For scanning tools and their code, see the Gitleaks repository (https: / / github.com / zricethezav / gitleaks) and the TruffleHog repository (https: / / github.com / trufflesecurity / trufflehog).

In short, the problem is not just that a code assistant can save approved commands: that file can end up versed and replicated in public sites and packages, exposing secrets that the usual scanners do not always find. For development teams the practical rule is simple and urgent: do not allow secrets to travel in clear text in commands; rotate exposed credentials and improve automatic controls that seek not only key formats but also passwords embedded in shell lines.

Coverage

Related

More news on the same subject.