Osegi
Security·2 min read

Claude Code's settings.local.json put passwords on GitHub

Clicking "don't ask again" in Claude Code can write a password into a file that later lands on GitHub. Researchers found about 1,100 such files.

A developer's laptop showing a JSON settings file with a highlighted password line next to a GitHub repository page.
Image: Хабр

You approve a command once, click "Yes, and don't ask again", and move on. If that command contained a password, Claude Code has just copied it in plain text into .claude/settings.local.json. Security firm Apiiro found over a thousand of those files, secrets included, in public GitHub repositories.

What did the researchers find in settings.local.json?

Apiiro counted 104,185 copies of the file in 103,617 public repositories. Around 1.1%, or 1,122 copies, held at least one secret. Sixty-three organizations were affected, mostly software companies. In 539 of 1,105 repositories the team traced, a commit that changed the file listed Claude as co-author.

A caveat: the researchers did not check whether the secrets still worked, and they don't claim anyone abused them. One notified company did confirm its key was live. Apiiro also sells security tools, which is worth remembering when reading its estimate of the scale.

How do secrets end up in the file?

In manual mode, Claude Code asks before most shell commands. Choose "don't ask again" and the rule is saved in the repository's .claude/settings.local.json. Sometimes the rule is a pattern like npm test *. Sometimes it is the exact command, and if that command carried a token or connection string, so does the file.

The name suggests the file is private. Claude Code does add it to git's global excludes, but only on that one machine. It does not touch the project's .gitignore. On a new laptop, in CI, or in a folder that became a repository later, nothing protects it. And once a file is tracked by git, ignore rules no longer help.

Boris Cherny, who leads Claude Code, said on Hacker News that the file should stay local and that in these cases people created and committed it by hand. The co-author finding and Anthropic's own changelog sit awkwardly with that.

What should you do now?

Anthropic released Claude Code 2.1.323 on the evening of 12 November (22:12 UTC). It no longer saves such rules, and it fixes the missing excludes on new machines and late-created repositories.

Check your own repositories for .claude/settings.local.json, look for passwords or tokens in the saved commands, and rotate anything you find. Don't wipe the whole .claude/ folder, though. The shared .claude/settings.json is meant to be committed. Apiiro found secrets in 298 of 76,011 public copies of it too, mostly in allow rules.

Apps worth a look

SUMO: the number puzzle

Tap the right tiles, add them up, hit the target. Easy to learn, hard to master. Free, for all ages.

Tags:claude codeanthropicgithubapiirosecrets leaksettings.local.json

More from this day

See all →

More in: Security

See all →