Hosting and security
What your AI coding tool remembers can end up in git
Apiiro found secrets in 1,122 public Claude Code settings files. Put the local file in your repository's .gitignore and scan agent folders for secrets too.

Researchers at Apiiro identified 104,185 copies of Claude Code's local settings file in public GitHub repositories, of which 1,122 contained at least one secret. Ars Technica and The Hacker News reported on the matter this month. My advice is to address two things this week: add .claude/settings.local.json to the .gitignore of every repository, and ensure your secret scanning covers AI agent folders as wél.
How the password gets into the file
Claude Code requests permission before executing a shell command. If you opt for "Yes, and don't ask again", Claude Code stores that as an allow rule in .claude/settings.local.json. Subsequent sessions execute any command matching the rule without further prompting.
At times the rule is a pattern. Often, however, it is the literal command – including any password or token contained within it. Consider a psql command carrying the database password, or a curl call with an API key in the header.
On a single developer's laptop this is not a significant problem. It becomes one the moment the file enters git.
Why it ends up in git anyway
Claude Code's documentation states that the tool adds **/.claude/settings.local.json to your global git excludes the first time it writes the file. If you create the file manually, you must add it to .gitignore yourself.
Global excludes belong to one machine and one user. Clone the repository on another laptop, in a container or on a CI runner, and the exclusion does not apply there. Ars Technica also references a folder that only becomes a repository at a later stage.
This aligns with how a remote team operates. A developer works on a managed laptop, starts a dev container, runs a session in the cloud. Each environment has its own git config, and the repository is the sole thing they share.
According to The Hacker News, in 539 of the 1,105 repositories Apiiro traced, a commit listing Claude as co-author modified the file. The tool, in other words, sometimes commits it itself.
What Apiiro found
The figures originate from Apiiro's research, as summarised by The Hacker News:
- 1,122 files with at least one secret, containing 1,379 distinct secrets, across 63 organisations
- 379 database passwords, 43 SSH logins, 42 GitHub, GitLab or npm tokens and 23 AWS keys
- 211 forks of 74 repositories carrying the same secrets
- 298 of 76,011 copies of the shared
.claude/settings.jsonwith secrets in them
The scanners did not catch everything. Of the 1,122 files, gitleaks flagged 564 and TruffleHog 643. Neither flagged 215 of them.
A fork retains what you remove from your own repository. Deleting a file does not remove it from your git history either.
The problem is not new. According to Ars Technica, it was reported in a Claude Code bug report as early as August 2025. Boris Cherny of the Claude Code team wrote on Hacker News that the team is looking into what it can do. He recommended using secret scanners.
Other agents keep files too
Apiiro compared the documentation of 16 agents. Claude Code is the only one confirmed to save the full approved command in a project file by default. The research also identifies folders such as .cursor/, .gemini/ and .specstory/ as locations where secrets may appear.
I would therefore treat those folders like a .env file, regardless of which tool your team uses.
Where I would start
Start by searching. Look across your GitHub organisation for settings.local.json and settings.json in .claude/ folders, and examine the git history as wél. If you find a secret, rotate it first and clean up afterwards. A password that has been on GitHub is no longer secret, even after you rewrite the history.
Then remove the file from git with git rm --cached .claude/settings.local.json and add it to the repository's .gitignore. Add it to the default .gitignore you use for new repositories too. That places the rule in the code, so it applies on every machine where someone checks out the repository.
Add the agent folders to your pre-commit hook and your CI scan, including the git history. Test whether your scanner recognises a password inside a command. Going by the figures above, you cannot take that for granted.
Agree as a team on how you approve commands. Approve a pattern, such as Bash(npm run test *), rather than one exact command containing a password. Let a command read its secret from a variable or a secrets manager, so the password never appears in the text of the command. Boris wrote more on handling secrets in managing secrets and API keys safely.
Additionally, put deny rules in the shared .claude/settings.json, so the tool does not read your .env files. Milos described those agreements in AI coding tools in a remote team. Add them to the checklist for a new developer, alongside the rest of the first two weeks.
Sources
Frequently asked questions
How does a password end up in Claude Code's settings?
When you choose 'Yes, and don't ask again' for a command, Claude Code saves an allow rule in .claude/settings.local.json. If that rule covers one exact command, any password or token in that command is stored there in plain text.
Isn't .claude/settings.local.json ignored by git already?
Claude Code adds the file to the developer's global git excludes the first time it writes it. That only applies on that one machine. If you create the file by hand or work on another machine, it needs to be in the repository's .gitignore.
What should you do if such a file with a secret is on GitHub?
First rotate every password and token the file has ever held, including in older versions. Then remove the file from git with git rm --cached, add it to .gitignore and delete the rules that contain secrets.
About the author

Bas Leijder Havenstroom
Managing director
Together with Erik Schoorl, Bas founded ESBL, one of the two companies behind Brainpower Group. He is managing director of ESBL B.V. and the first point of contact for clients.
More from Bas




