Clicked 'Don't Ask Again' in Claude Code? Rotate every secret first, then clean up
GitGuardian found 31,088 secrets in Claude Code's settings files on public GitHub, and 5,343 still worked when checked. If you ever clicked 'Yes, and don't ask again' on a command carrying a password, that password may be public right now. Here is the rotate-first checklist to run today. Source: https://blog.gitguardian.com/claude-code-settings-local-json-secrets-docker-hub/
Why it matters
Deleting the file fixes nothing. Git history, forks and Docker Hub images keep copies, and GitGuardian's check found 17 percent of the secrets still valid at detection, which it calls a floor, since detectors without a checker are never counted as valid. The only order that works is rotate first, then delete the rules, then lock the file out of every place it can travel.
Who it's for
Anyone who has used Claude Code on a project that ever touched a real password, token or connection string. If you only ever used it on toy projects, you can skip the rotation, but still do step 4.
How to try it
- 1. List every credential the file ever held: open .claude/settings.local.json and read every allow rule, then check git log for older versions of the file.
- 2. Rotate each one before you touch anything else: new database passwords, new API keys, new tokens. Assume every value in the file is public.
- 3. Remove the file from git tracking with git rm --cached .claude/settings.local.json, then add .claude/ to the repo .gitignore and .dockerignore.
- 4. Open the file, or run /permissions in Claude Code, and delete every rule containing a secret.
- 5. Stop putting secrets in commands: reference them as $VAR_NAME instead, so the saved rule stores the name, not the value. Prefer a narrow prefix such as Bash(curl -H "X-N8N-API-KEY: $N8N_API_KEY" https://n8n.example.internal:*) over Bash(curl:*), which approves any curl, including one written by a prompt injection.
Source: https://blog.gitguardian.com/claude-code-settings-local-json-secrets-docker-hub/
Written by Sarah Mitchell from the original post. Checked Checked 14 Nov 2026. Features, plans and availability can change, so confirm on the source before you rely on it.
securitysecretsgitguardian
More Claude tricks
- One URL and one key for all your MCP servers: ngrok's MCP Gateway is live · Dec 2
- OpenCode 2.4.2 cuts about 700 tokens per request and tunes GPT-6.2 · Nov 26
- OpenCode 2.4 gives your coding agent a browser, automations, and video generation · Nov 24
- Claude Code 2.1.330 draws your charts with easel and lets scheduled tasks run 30 days · Nov 21