Skip to content
Theme
OnDevice Tools

SoftwareDeveloper Tools

Claude Code secrets: update stops new leaks, old GitHub files remain

Anthropic has released Claude Code version 2.1.323 to stop permanent approval rules from saving possible secrets. Developers should still check GitHub repositories and rotate any exposed credentials.

Illustration of a laptop screen showing a GitHub repository with a Claude Code settings file and a security warning

Key takeaways

  • Anthropic released Claude Code version 2.1.323 on 12 November 2026 to stop permanent approval rules from saving possible secrets.
  • GitGuardian found 31,088 distinct secrets in .claude/settings.local.json files on GitHub across 23,276 repositories.
  • Developers should rotate exposed credentials before removing files from repository history.
  • GitHub code search and local Git history checks can reveal current and past leaks.
In this article
  1. What changed in Claude Code
  2. How passwords reached GitHub
  3. How to check repositories
  4. Rotate credentials before cleanup
  5. Safer habits for coding agents

What changed in Claude Code

According to Notebookcheck, Claude Code secrets remain a risk even after Anthropic released version 2.1.323 on 12 November 2026. The update changes how the coding agent handles permanent command approvals. A rule that appears to contain a secret, or that would be written to a settings.local.json file tracked by Git, now lasts only for the current session and is not saved.

The release also addresses a gap where the local settings file was not ignored globally when a folder later became a Git repository or moved to a new machine. The update does not delete secrets already stored in the file or already pushed to GitHub. Anthropic has not explained how Claude Code decides that an approval rule looks like a secret. Developers can check their installed version with claude --version and install the latest release with claude update.

How passwords reached GitHub

Illustration: code, key, GitHub logo, Claude logo and the labels Anthropic, Apiiro, Claude Code

Claude Code asks for permission before running shell commands. If a developer chooses the permanent approval option, the tool saves the full command as a rule in .claude/settings.local.json. When that command includes a database password, API key, SSH login or other token, the secret is stored in plain text.

Anthropic documentation says the file is intended to stay out of source control. Claude Code adds it to global Git excludes on the developer's machine, rather than the project's .gitignore file. Notebookcheck notes that this protection remains on the original machine. It may fail on a new computer, in continuous integration systems that automate builds and tests, or for colleagues who clone the project.

GitGuardian analysis published on 9 November 2026, as reported by Notebookcheck, identified 31,088 separate secrets across GitHub files since January 2025. The secrets were spread across 23,276 repositories, and 5,343 were still valid when detected. Leaks peaked in April 2026 at 12,535 in one month and fell to 959 in October 2026. The files also appeared inside images on Docker Hub.

How to check repositories

GitHub code search is the fastest starting point, according to Notebookcheck. A search for the path .claude/settings.local.json, limited to a user or organisation, can list repositories that contain the file. The same check should be run for .claude/settings.json, because The Hacker News reports that Apiiro found 298 shared files with secrets.

That search reflects only the present condition of a repository. Apiiro says 734 secrets survived only in older commits after the file was removed. To inspect history, developers can open each repository locally and use Git's log command with the all and full-history options for the settings file. If commits appear, older versions should be reviewed manually.

Automated scanners can help, but they are not enough. Gitleaks and TruffleHog can scan repository history, and gitleaks git . checks the full history. Apiiro found that the two scanners overlooked 215 of 1,122 files containing genuine secrets, mainly passwords placed inside normal command lines. TruffleHog can be set to show only verified results, which excludes those passwords.

GitHub offers free scanning of public repositories for recognised key formats, including branch history. For personal accounts, GitHub turns on push protection by default to block known keys before upload. Ordinary passwords are detected only through AI, and protection for them remains in public preview, according to GitHub documentation. A lack of alerts is not proof that no secret escaped.

Rotate credentials before cleanup

GitHub advises that a secret exposed publicly must be considered compromised. The first step is replacement, not deletion. Developers should issue a fresh database password, API key or SSH key, then revoke the previous credential. GitGuardian, cited by Notebookcheck, recommends rotating every credential that the file contained before cleanup.

Cleaning the repository comes second. Removing the file alone is insufficient, because the secret may persist in older commits, forks, which are copies of repositories, and copies already obtained by others. The Hacker News reports that 211 forks across 74 repositories contained the same secrets.

GitHub suggests git-filter-repo for removing the file from history, then a force push to rewrite remote history. The method does not affect forks, and older commits can remain accessible through their hashes for some time. GitHub Support may assist with cached views.

After that, git rm --cached can stop tracking the file, .gitignore can exclude it, and git check-ignore -v can confirm the rule. Projects that publish npm packages or Docker images should also list the file in .npmignore and .dockerignore.

Safer habits for coding agents

The wider lesson is that passwords should not sit inside commands run by an agent. Notebookcheck recommends keeping credentials in environment variables, which store values outside code, or a password manager for command lines. When approving commands, a narrow pattern such as npm run test is safer than a full command line.

The issue is not limited to Claude Code. Codex stores rules in the user layer at ~/.codex/rules/default.rules, according to its documentation. Cursor offers a project-level permissions file and advises teams to commit it, ensuring all members use the same rules. Notebookcheck cautions that the next push publishes the file.

For teams, the incident is a reminder to review agent-generated files before committing them. A settings file meant to stay local can become a public credential store if it is tracked, forked or copied. The safest approach is to keep secrets out of command history, rotate exposed credentials quickly, and verify repository history as well as current files.

Sources

  1. Claude Code: How to check your GitHub repos for leaked passwordsNotebookcheck

Tags

Spotted a mistake? See our corrections policy. Read how News by OnDevice works in our editorial policy.