An approved shell command can become a permanent permission rule in Claude Code—and carry a password or API token with it. Apiiro says that when a developer chooses “Yes, and don’t ask again,” Claude Code saves the command in a local settings file.
The file is named .claude/settings.local.json. If a command includes credentials, those details can be saved alongside the approval rule.
What Claude Code saves
The feature is meant to remember a developer’s approval to run a shell command, rather than ask for permission again. But the command itself may be recorded as written, including any embedded password, token or other sensitive information.
Apiiro found secrets including cloud API keys, production passwords, access tokens and npm tokens. The researchers also found credentials in shared settings files and agent chat transcripts stored in repositories.
Why the ignore rule can fail
Claude Code adds the local settings file to the developer’s global Git ignore list, which normally helps keep it out of commits. But that setting does not travel with a project: it is not added to the repository’s own .gitignore file.
That leaves gaps if a folder becomes a repository later, if the project is cloned on another machine, or if the file has already been committed. Apiiro also found cases where Claude Code itself committed the settings file.
The findings cover different sets of files
Apiiro identified 1,122 secrets in .claude/settings.local.json files and another 1,160 in Git history, shared settings and agent chat transcripts. Ars Technica reports that Apiiro found more than 100,000 cases where the local settings file had been uploaded to public GitHub repositories; only about 1,100 of those cases contained secrets, across 63 organizations.
GitGuardian reported a separate set of findings: 31,088 secrets in Claude Code settings files on public GitHub, including 5,343 that were still valid when detected. It also found 613 secrets in Docker Hub images.
Why scanners miss the credentials
Apiiro says generic secret scanners such as gitleaks and TruffleHog failed to catch all the exposed values, largely because credentials were embedded inside full shell commands. The researchers say the same pattern can turn up in transcripts, memory files and handoff notes.
Apiiro recommends inspecting the settings file, removing rules that contain secrets, and using `git rm --cached .claude/settings.local.json` to stop tracking it. Developers should add the file to the repository’s .gitignore, rotate any credentials it has contained, and reference secrets through environment variables instead of typing them into commands.
Why it matters
Developers using Claude Code can check whether its local settings file contains credentials before those details end up in a repository. If a credential was exposed, Apiiro recommends rotating it; removing the file from tracking does not by itself address credentials already exposed.
What it means for you
If your repository contains Claude Code’s local settings file, you cannot tell from these findings alone whether it includes a credential. Apiiro recommends checking the file and rotating any credentials it has contained.
Our take: A global ignore rule helps in the usual case, but it does not protect every copy of a project. The findings make checking the local settings file and repository history a practical part of handling credentials.