Claude Code settings files expose credentials on GitHub
An analysis found credentials in Claude Code configuration files published on GitHub. The risk involves saved command approvals and the subsequent inclusion of those files in public repositories.
Summary
Security company Apiiro has found passwords, keys and other credentials in Claude Code configuration files available in public GitHub repositories. The issue concerns how the tool saves permission to run commands: if a command contains a credential, that information can be recorded in a configuration file.
According to the analysis, cited by Ars Technica, more than 100,000 local Claude Code settings files were found in public repositories. An independent review of the findings reports that 1,122 of those files contained at least one credential identified by the researchers.
In practice
When Claude Code asks permission to run a command, users can approve it and choose not to be asked again. The tool saves that permission as a rule in `.claude/settings.local.json`. If the rule includes a command with a password or key written directly into it, that information may remain in the file.
Exposure occurs when the file is later included in a public repository. Current Claude Code documentation says that when the tool creates the file, it configures Git to ignore it globally; if the file is created manually, the user must ensure it is excluded. This protection should be checked in each environment and does not remove files that have already been published.
Context
Teams using Claude Code can check whether local configuration files are excluded from their repositories and whether they have already been included in repository history. They can also review shared configuration files and avoid writing credentials directly into commands.
If a credential has been exposed, removing it from the file is not enough: it should be revoked or replaced with the service that issued it. Repository history and other copies also need to be considered. The research also shows that automated detection tools can miss some cases, so they do not replace review.
Why it matters
- A seemingly local configuration file can contain credentials that provide access to external services.
- Accidental exposure involves several steps: saving a credential in a rule and subsequently making the file available.
- Checking exclusions, repository history and exposed credentials reduces risk for teams using coding agents.
