Claude Code settings files are writing secrets into public GitHub repos
Researchers at security firm Apiiro found thousands of secrets in public GitHub repositories, including database passwords, API tokens and root login credentials, coming from Claude Code's .claude/settings.local.json file. According to Ars Technica, the problem lies in the command approval mechanism: after a user chooses "Yes, and don't ask again", that rule is written into the local settings file, and sometimes what is stored is the full command text rather than a matching pattern, so any sensitive information in the command is written in too. Anthropic's documentation says the file is added to the developer's global .gitignore, which usually keeps it from becoming public; but if someone bypasses that or it does not take effect, the file gets committed along with the repository. While the file stays on the local machine the risk is limited; the leak happens after it is pushed to a public repository.
By default Claude Code asks the user before running most shell commands; when the user chooses "Yes, and don't ask again", that approval is written into the project's .claude/settings.local.json as an allow rule. Anthropic's documentation says the file is added to the global .gitignore, but a daily report on 7 November said Apiiro had already found 1,122 files containing such credentials in public GitHub repositories. Boris, an engineer on the Claude Code team, responded at the time that the file was supposed to stay local only, that the repositories involved were committed manually by users, and acknowledged that no secret cleanup had been done before.
Developers using Claude Code should immediately check whether their local .claude/settings.local.json records full commands containing passwords or tokens, and confirm that it is in fact excluded by .gitignore. Repositories that have already committed the file need their history cleaned and the affected secrets rotated, because deleting the latest commit does not erase the content from Git history.