
What does Claude Code's permission system actually store on disk?
If you let Claude Code click "don't ask again" on a database command, where does that approval go, and what happens if the command had a password baked into it? GitGuardian found 31,088 secrets sitting in public settings.local.json files for exactly this reason, and 5,343 of them were still valid and usable when scanned. So why was a safeguard that depends on one local Git setting ever the only thing standing between a typed password and a public repo?
The memory for these approvals lives in a file called .claude/settings.local.json, stored inside the project directory. This file holds an allow list of commands Claude Code is cleared to run without asking. Here's the technical problem: instead of storing an abstracted pattern, like "allow psql connections to db.example.com," Claude Code often stores the literal command string the developer approved, character for character.
That matters because plenty of real-world commands carry credentials inline. A database connection might look like PGPASSWORD='ExamplePassword123' psql -h db.example.com -U admin. Approve that exact command and the password doesn't get stripped out before saving. The full string, password included, gets written into settings.local.json in plain text. Same story with API calls that pass tokens as command-line arguments or set them as inline environment variables.
Anthropic's documentation says Claude Code tries to stop this file from being committed by adding an entry to the developer's global Git ignore configuration, not a per-repository .gitignore file. That's a meaningful architectural difference. A global ignore rule lives on one machine, tied to one user's Git setup. It doesn't travel with the repository. Clone the project onto a second machine, copy it to a CI runner, or turn a directory that already had the settings file into a Git repo after the fact, and that global ignore rule may simply not exist there. Nothing in the repository itself blocks the commit.
Security firm Apiiro also found that Claude Code often commits changes on its own, meaning the agent itself stages and checks in files with no human step in between where a developer might catch a credential sitting in a diff. Put those two things together, a file that stores raw secrets by default and a protection mechanism that only works if the right local Git configuration happens to be present, and leaking a password to a public repository stops requiring any unusual mistake. It just takes a normal workflow running on a machine where the global ignore entry isn't active. That's the core design flaw: the safeguard depends on a setting most developers never check.
Why did this become a real-world problem instead of a theoretical one?
Security firm GitGuardian scanned public GitHub repositories for exposed settings.local.json files and found 31,088 distinct secrets spread across 23,276 repositories. Of those, 5,343 secrets were still valid and usable at the time of scanning, meaning nobody had rotated or revoked the credentials after exposure. This wasn't a handful of isolated mistakes. It repeated across thousands of independent projects, which points to the file's default behavior as the cause, not individual developer carelessness.
The timeline tracks Claude Code's adoption curve closely. Leaks peaked at 12,535 occurrences in April 2026, then fell to 959 by October, likely as awareness spread and Anthropic and the community pushed fixes and warnings. That curve shapes how you should read the current risk: lower than its peak, but nowhere near zero, and anyone adopting Claude Code for the first time today starts from a baseline where the underlying storage behavior hasn't fundamentally changed.
Deleting the current settings.local.json file doesn't fully resolve exposure either. Apiiro's investigation found another 2,539 secrets across 1,994 repositories hiding in older file versions still sitting in Git history, in shared settings files meant for team-wide configuration, and in saved agent chat logs. A developer who notices the problem and removes the current file from their working directory can still have the same password sitting in a commit from three months earlier, fully visible to anyone who clones the repository and checks the log.
The exposure wasn't confined to GitHub, either. Apiiro reported finding secrets inside Docker Hub images too, since container images sometimes get built by copying an entire project directory, settings.local.json included, into the image layer. A password that never touched a public Git repository could still ship inside a container pushed to a public registry.
Anthropic has pointed to Claude Code's auto mode as a way to handle routine permission prompts using classifiers, instead of developers manually maintaining allow and deny lists. A commenter pushed back, noting that auto mode can still save sensitive commands into the same settings files. Anthropic acknowledged it was a fair point, with signs the team is still working through how to improve it, which tells you the fix is in progress, not finished.
So what do you actually do with this today? Treat settings.local.json as a file that may contain plaintext credentials, the same way you'd treat a .env file, and check it before every commit rather than trusting the global Git ignore to be configured correctly on every machine you work from. Rotate any credential you ever typed into a command Claude Code approved automatically. With 5,343 still-valid secrets sitting in public repositories, plenty of developers haven't done this yet. Before building a Docker image from a project directory that used Claude Code, confirm the .claude folder is excluded from the build context, not just from Git. The question was why a single local Git setting was ever allowed to be the only barrier between a typed password and a public repository. It shouldn't have been. Until Anthropic changes how the file stores commands by default, the only reliable fix is to stop treating "don't ask again" as anything other than a plaintext record of what you typed.