←Back to Knowledge

An AI coding tool setting can save passwords into project files; researchers found secrets in 1,122 public copies. Three questions for your developer.

Date
Reading
6 min read
Written by
Nick Li
Tags
#Risk#AI#Engineering

More and more small companies in Hong Kong have their website, booking system or internal tools built by a freelancer or a small agency. More and more of that work is now done with AI coding tools. In HKPC's latest SME Index, 55% of the SMEs surveyed said they use or plan to use AI tools in their daily operations within a year.

On 5 November, researchers at the security company Apiiro showed one way this can go wrong. A convenience button in Claude Code, one of the most popular AI coding tools, can save passwords and API keys into a small file inside the project. When that file is uploaded to a public GitHub repository, anyone can read them.

You don't need to understand the code to protect your business. You need to ask the right questions.

What happened

Claude Code asks before it runs a command on the developer's computer. One of the answers is "Yes, and don't ask again". According to Anthropic's own documentation, that choice saves the approval as a rule in a file called .claude/settings.local.json in the project. The rule is often the command exactly as it was typed. If the command contained a password, for example to log in to a database, the password is now in that file.

The file is meant to stay on the developer's computer, and Claude Code tries to keep it there: it adds the file to an ignore list on that developer's own machine. According to Apiiro, that doesn't cover a folder that becomes a project later, a copy on another computer, or a file that was already uploaded once. Nothing in the project itself marks the file as private. In 539 of the 1,105 projects Apiiro traced, the commit that changed the file was co-authored by Claude itself.

Apiiro looked at 104,185 public copies of the file on GitHub. 1,122 of them, about 1.1%, contained at least one secret, as reported by iTWire. When the researchers also searched older versions of projects, shared settings files and saved AI chat transcripts, the count rose to 2,539 secrets in 1,994 projects, owned by 63 organisations. They included database passwords, server logins and cloud keys, according to GBHackers.

Two details matter. Apiiro did not test whether the passwords still worked; at least one company it contacted confirmed that its exposed key was live. And standard scanning tools missed a lot: Gitleaks flagged 564 of the 1,122 files, TruffleHog 643, and 215 got past both.

The problem isn't new. Users have reported it on GitHub since August 2025, in at least four issues. None got a reply from Anthropic, Apiiro says, and three were closed automatically. As of version 2.1.319, Claude Code's changelog shows no change to this behaviour, and Anthropic had not publicly commented at the time of reporting.

Three questions to ask your developer

  1. "Do you use AI coding tools on our project, and is the code on GitHub public or private?" Using AI tools is fine. What matters is knowing which ones, and where the code is kept. A public repository is visible to everyone.

  2. "Have you checked the project for saved passwords, including old versions?" Ask specifically about .claude/settings.local.json and similar settings files. Deleting a file today doesn't remove it from the project's history.

  3. "If anything was exposed, have those passwords and keys been changed?" This is the step that actually protects you. A password that has been changed is useless to whoever found the old one.

A good developer will be glad you asked, and should answer within a day.

For your developer: a five-minute check

In the project folder, run:

git ls-files .claude/                                   # tracked in the project now?
git log --all --oneline -- .claude/settings.local.json  # ever committed, on any branch?
git check-ignore -v .claude/settings.local.json         # ignored by this project?

If the second command prints anything, the file was committed at some point: read it with git log --all -p -- .claude/settings.local.json and look for passwords, tokens or keys. To keep it out from now on:

echo ".claude/settings.local.json" >> .gitignore
git rm --cached .claude/settings.local.json   # only if it is tracked
git commit -m "Stop tracking local Claude Code settings"

Even if the file was never committed, open it on every computer that works on the project and delete any rule that contains a password or key. A secret scanner such as Gitleaks or TruffleHog run over the whole history helps too, but as the numbers above show, it won't catch everything. Read the file yourself.

If a password was exposed

  • Change it first. GitHub's own guidance says the first step is to revoke or rotate the secret. Removing the file comes after.

  • Don't rely on deleting it. Old versions can stay reachable through copies (forks) and cached pages, even after the history is rewritten.

  • Check what that password could reach. If it opened a database with customer details, look at its access logs for the period it was exposed.

  • Know your obligations. If personal data may have been accessed, see the Privacy Commissioner's data breach guidance. Notifying the PCPD is currently voluntary in Hong Kong, but it's often the right thing to do. HKCERT can also help.

GitHub scans public repositories for many known key formats for free. Plain passwords inside a command, the most common case here, are much harder to spot automatically.

What about other AI tools?

Other tools save approvals differently. OpenAI's Codex CLI and GitHub Copilot CLI keep them in the user's home folder by default, outside the project, while Cursor has a project file that teams can choose to share. Apiiro compared 16 AI coding tools and found Claude Code is the only one confirmed to save the full approved command into a project file by default. Still, any settings file can leak if a secret is typed into it.

The habit matters more than the tool. GitGuardian's State of Secrets Sprawl 2026 found that commits made with Claude Code's help leaked secrets at 3.2%, against a 1.5% baseline, and the report puts this down to people's decisions under time pressure rather than to the tool itself. The fix is simple: keep passwords in a password manager or the server's settings and refer to them by name, such as $DB_PASSWORD, so a saved rule records the name, not the password.

If you're thinking about using AI in your business more broadly, we covered the basics in AI for small business: where to start.

AI coding tools save time. Make sure they aren't also saving your passwords.

If you'd like someone to check your project or talk to your developer with you, let's talk.

Further reading