Search your repos and git history for .claude/settings.local.json, rotate anything in it, then gitignore it

Claude Code's 'don't ask again' saved passwords and keys into a project file: secrets found in 1,122 public copies on GitHub · Security incident · Web · The Hacker News (Apiiro research) · Nov 6, 2026

What happened

Apiiro found that when a Claude Code user picks 'Yes, and don't ask again', the exact approved command can be saved word for word in .claude/settings.local.json, including any password or token typed into it. Searching public GitHub (1 to 3 Nov), it found 104,185 copies of the file, 1,122 of them holding at least one secret (1,379 distinct secrets), more than a third of them database access, including 379 database passwords. Claude Code adds the file to the user's global git excludes, but not to the project's own .gitignore, so the protection doesn't travel with the repo. Apiiro did not test the secrets; one notified company confirmed its key had been live. The Hacker News reported the research on 7 Nov.

How to prevent it

Never type secrets directly into commands an agent runs; reference them as environment variables. Approve command patterns rather than one-off commands that contain values. Add .claude/settings.local.json (and other agent folders like .cursor/) to every project's .gitignore and to your secret scanning, including git history.

Fix prompt for your own AI tool

Copy this into your own AI tool (Cursor, Lovable, Claude Code, Bolt…). It's general guidance written by us. Review what the AI suggests before applying it.

I use Claude Code. Help me check whether it has saved secrets into my project. 1) Tell me how to look for .claude/settings.local.json and .claude/settings.json in this repo and in its git history, including deleted versions. 2) Show me how to spot allow rules that contain a password, token, API key or connection string, without printing the values back to me. 3) Give me the steps to stop tracking the local file (git rm --cached .claude/settings.local.json) and add it to this project's own .gitignore. 4) Show me how to reference secrets as environment variables, such as $DATABASE_URL, so approved commands never contain the real value, and how to approve patterns instead of single commands. Remind me to rotate any secret the file ever held before I clean up history. Don't change anything until I've approved your plan. Never ask me to paste API keys, passwords or .env contents; tell me where to check them myself.

Why this keeps happening: leaked secrets & api keys

Secret keys placed in front-end code, mobile bundles or public repositories can be found by automated scanners and abused, often running up large bills on AI or cloud accounts before anyone notices.

A quick checklist before you ship

More on this: every leaked secrets & api keys story and our related guide.

Tools involved

Claude Code stories

Related stories

Source: original post on Web ↗. Summarised in our own words; numbers are as stated by the source. Browse all stories.

The Honest Build. Real stories, not hype.

Every week: real stories of what building with AI actually took, the one lesson worth keeping, and the security slip-ups to avoid. Free, unsubscribe anytime. Weekly, every Friday.