Home  ›  Insights  ›  Claude Code saved secrets
Field Note

Claude Code 2.1.323 stops new leaks. Rotate the old ones

Anthropic changed “don’t ask again” so Claude Code stops saving approvals that look like secrets. Every password it already wrote to a settings file, pushed, forked, or copied into an image still works. The decision is a rotation programme, not a version bump.

Red card: secret saved and pushed before 2.1.323Stamp: a don't ask again approvalSlate card: rotated, no longer validThis figure's model: six cards pinned before the fix, counts illustrative. Anthropic says 2.1.323 keeps secret-looking approvals for the session only (vendor, release notes). Taking a card off the board does not revoke it; rotating the credential does.

The claim

Choosing “Yes, and don’t ask again” on a Claude Code shell-command prompt saved an allow rule holding the full command text, including any inline password, connection string, or bearer token, to .claude/settings.local.json (independent, Cloud Security Alliance; CSO; Dark Reading). Apiiro published research on public copies of that file on 5 or 6 November 2026, and CSO reported separate GitGuardian research on 11 November.

Anthropic’s fix is Claude Code release v2.1.323, dated 12 November on its GitHub releases page. A “don’t ask again” rule that looks like it holds a secret, or would be saved to a git-tracked settings.local.json, now lasts for the session only. The release also fixed the file not being ignored globally on a new machine or when a folder later became a git repository (vendor, Anthropic release notes).

The claim we test: upgrading to 2.1.323 closes the leak.

The inputs

Neither study’s own write-up was readable to us. Every count below is as relayed by the outlet named, and the two studies used different scopes and methods, so their totals are not added.

What was countedFigureLabel
Public copies of settings.local.json Apiiro examined104,185 in 103,617 repositoriesindependent (Apiiro, via CSA and Dark Reading)
Copies holding at least one secret1,122, with 1,379 distinct secretsindependent (same)
Share of copies with a secret1,122 ÷ 104,185 = 1.08%our maths
Including git history, shared settings, and chat logs2,539 secrets in 1,994 repositories; 734 only in historyindependent (same)
Forks carrying the same secrets211 forks of 74 repositoriesindependent (same)
GitGuardian, public GitHub31,088 distinct secrets in 23,276 repositories; 5,343 valid when detectedindependent (GitGuardian, via CSO)
Share valid when detected5,343 ÷ 31,088 = 17.2%our maths
GitGuardian, Docker Hub613 distinct secrets, 99 valid, in 543 image repositoriesindependent (same)

Apiiro’s 1,379 included 379 database passwords, 43 SSH logins for public servers, 42 GitHub, GitLab, or npm tokens, and 23 AWS keys (independent, Apiiro via CSA). Apiiro did not test whether its secrets worked.

The result

The upgrade is necessary and not sufficient. It changes what Claude Code writes next. It changes nothing already written.

  • Files already pushed stay public. The rule is in the repository until someone removes it.
  • History keeps it after removal. 734 of Apiiro’s secrets existed only in git history (independent, via CSA).
  • Forks keep their own copies. 211 forks carried the same secrets (independent, via Dark Reading).
  • Images ignore .gitignore. GitGuardian traced its Docker Hub finds to COPY . copying the project directory (independent, via CSO).
  • The global ignore was one laptop deep. On first write Claude Code added the file to the user’s global git excludes, which protects that workstation and not teammates, CI, containers, or npm tarballs (independent, CSA; CSO).

Shipping the fix is Anthropic’s job. Revoking what already leaked is yours.

Where it breaks

  • “Looks like a secret” is not defined. The release notes do not say how the check decides. Low-entropy passwords in command syntax, such as PGPASSWORD=, sshpass -p, and mysql -p, are what conventional scanners miss: gitleaks flagged 564 and TruffleHog 643 of the 1,122 secret-bearing files, and neither flagged 215 (independent, via CSA and CSO).
  • The trend is not the risk. GitGuardian’s monthly leak occurrences fell from 12,535 in April 2026 to 959 in October (independent, via CSO), a 92.3% fall (our maths). Those are occurrences by month of leak, and a recent month may be undercounted until it is scanned. Old secrets do not expire with the trend.
  • Who pushed is unclear. In 539 of 1,105 traced repositories a commit listing Claude as co-author changed the file, 48.8% (our maths from Apiiro’s figures via CSA). The Cloud Security Alliance says this does not establish that Claude Code pushed every exposed credential.
  • It was known. GitHub issue #5544, filed 11 August 2025, reported verbatim plaintext storage of approved commands and was closed by an automated process as not planned on 3 January 2026 (independent, via CSA). Boris Cherny, head of Claude Code, said Claude Code has historically not scrubbed secrets and that Anthropic was looking at options (independent, via Dark Reading and Qodo). Anthropic did not respond to CSO.
  • The fair counterargument. About 1.1% of public copies held a secret, enterprise repositories are private, and the global ignore already applied. True for a clean private estate. Forks, images, packages, and contractor laptops are where copies go, so it is a reason to scan, not to skip.

Five steps this week

  1. Step 1. Set the floor. Make 2.1.323 the minimum Claude Code version through managed settings. Owner: developer platform owner.
  2. Step 2. Exclude .claude/ at repository level. Add it to the .gitignore, .dockerignore, and .npmignore templates, and run git rm --cached on tracked copies. Do not rely on each laptop’s global excludes. Owner: repository owners, with the platform team.
  3. Step 3. Scan where copies go. Full git history, container images, and internal package registries, with custom rules for command-line passwords and Authorization: Bearer headers. Salesforce teams should add patterns for SFDX auth URLs and org access tokens; no source we read names a Salesforce credential among the leaks, so this is a check, not a finding. Owner: application security lead.
  4. Step 4. Rotate before you clean. Treat every credential found as exposed: revoke and reissue it, then purge it from history. For Salesforce, that means the Connected App or External Client App tokens behind the auth URL. Owner: each credential owner, tracked by the CISO.
  5. Step 5. Stop typing secrets into approved commands. Move them to environment variables or a secrets manager, and narrow allow rules to patterns. Owner: engineering leads.

Missing

  • Apiiro’s and GitGuardian’s own write-ups. We read only the outlets that relayed them.
  • How 2.1.323 decides a rule looks like a secret, and whether low-entropy passwords trip it.
  • Whether any of Apiiro’s 1,379 secrets were valid.
  • Any Anthropic tool or guidance to find and purge rules saved before 2.1.323.
  • A Prestanda scan. We have not run Step 3 on any estate; it is a test design, not a result.

Frequently asked questions

Does upgrading to Claude Code 2.1.323 fix the leak?

It stops new secret-looking approvals being saved and repairs the global git ignore on new machines (Anthropic release notes). It does nothing for secrets already pushed, in git history, in forks, in container images, or in packages.

Where does Claude Code keep don't ask again approvals?

In .claude/settings.local.json in the project, as allow rules that held the full command text, including any inline password or token, per the Cloud Security Alliance and CSO.

Will our secret scanner find these?

Not reliably. In Apiiro's data, as relayed by the Cloud Security Alliance, gitleaks flagged 564 and TruffleHog 643 of 1,122 secret-bearing files, and neither flagged 215. Add rules for command-line passwords.

Should we rotate or just delete the file?

Rotate first. Deleting the file leaves the secret in git history, forks, and images, and the credential works until it is revoked.

Sources

Living page. Last updated 27 Nov 2026. We update this note when Anthropic documents its secret check or a purge tool, or when Apiiro or GitGuardian publish validity figures we can read at source. Rolling coding agents out across engineering? Talk to us.