What it is about
Explains to controllers, finance-ops staff and accountants who script their close with Claude Code why an ERP or payment API key typed into a command can stay on disk after one click on “Yes, and don't ask again”, and how that file leaves the laptop through git or a Docker image. Gives a table of every agent file that can hold a finance credential, the order of the clean-up (rotate first), a shared settings file with deny and ask rules, and a free read-only audit script with a checklist and prompts.
What it offers, according to the source
GitGuardian says it found 31,088 distinct secrets in public copies of .claude/settings.local.json on GitHub between January 2025 and 7 November 2026, 5,343 of them valid when detected, and 613 more in public Docker Hub images (99 valid). Apiiro, as reported by Ars Technica, found about 1,100 files with real secrets among more than 100,000 public copies. Claude Code 2.1.323 (12 November 2026) keeps secret-looking approvals for the session only, but does not clean existing files, history or images. In our test on a fictitious repository, the audit script reported 8 HIGH findings before the fixes, 1 after them (the key still in git history) and 0 once rotation was declared.
Mind the evidence. Described by the project’s own documentation or README. It says what the project claims to do and how it is used, not that it works in your case: we have not tested it.
What has really been tested
On 2 December 2026 we read the GitGuardian, Sysdig, Ars Technica and Marek Bruns articles, Claude Code's settings and permissions documentation and the changelog on GitHub, and dated version 2.1.323 from the commit that added it. We wrote claude_settings_secret_audit.py and ran its self-test, which builds a fictitious git repository with invented Xero, Stripe, Holded, Odoo and Postgres credentials, a Dockerfile and a committed settings.local.json, then applies the fixes. We also ran it on 111 git repositories on our own working machine: no literal secret was flagged and 107 lacked the repository-level ignore line, including this site's repository, which we fixed. We have not run Claude Code's permission prompt ourselves, have not tested the session-only behaviour of 2.1.323 and have no figures on how many finance teams are affected.
How to apply it
Update Claude Code, run the audit script over the folder with your finance scripts and read the report. Rotate every credential it finds at the provider before deleting anything, check each provider's activity log, then delete the rules, untrack the file, add it to the repository's .gitignore and .claude/ to .dockerignore, and commit a shared settings.json with deny rules for .env and bank exports. Keep tokens in environment variables and approve commands that reference $VARIABLES, never values. Re-run the audit before every push or image build.
- Update Claude Code (claude update) and check that the version is 2.1.323 or later.
- Run claude_settings_secret_audit.py over the folder that holds your finance repositories and keep the report.
- For each HIGH finding, rotate the credential at the ERP, bank or payment provider first and check its activity log back to the first commit.
- Delete the rules that held secrets with /permissions, untrack settings.local.json and add it to the repository's own .gitignore.
- Add .claude/, CLAUDE.md and .mcp.json to .dockerignore, rebuild any image built from the folder and delete the old tags.
- Commit a shared .claude/settings.json with deny rules for .env, secrets and bank exports and ask rules for curl and database clients.
- Re-run the audit until it reports 0 HIGH, using --history-rotated only after rotation is confirmed.
One click, one line of JSON
A controller asks Claude Code to pull last month’s trial balance from Xero, or the Stripe balance transactions behind a payout. The agent writes a curl command with the bearer token or the Stripe key inside it and asks for permission. You choose “Yes, and don’t ask again” because you will run it every month. Claude Code then writes an allow rule into .claude/settings.local.json, and according to Claude Code’s permissions documentation that rule applies to every future session in the repository.
When the rule is the exact command, the key travels with it. That file is meant to stay on your laptop. It leaves through three doors: a git add . on a machine where it is not ignored, a file that was already tracked, or a Docker image built with COPY . ..
For a finance team that has started to script its close, this is not a developer problem. The values in those commands are the ones that open the ledger, the payment provider and the bank.
Who counted what
Three security firms published numbers in November, and they measure different things:
- Apiiro searched public GitHub from 1 to 3 November. Ars Technica reports more than 100,000 copies of the file, about 1,100 of them holding secrets from 63 organisations, and 215 that two popular scanners, gitleaks and TruffleHog, did not flag.
- GitGuardian counted every version ever pushed from January 2025 to 7 November 2026: 31,088 distinct secrets in
settings.local.jsonacross 23,276 repositories, 5,343 of them working when detected. It also found 6,155 distinct secrets inCLAUDE.mdfiles. Of the 417 organisations it could match by e-mail domain, 11 were in finance and insurance; GitGuardian warns that this sample is biased. - On 25 November GitGuardian followed up on Docker Hub: 613 distinct secrets from these files in public images, 99 valid. The same post cites Stony Brook University research in which every AWS key planted in a honeypot image in the first round was used within 15 minutes.
- Sysdig, the same day, described one organisation’s agent sessions over a month: 61% of tool calls ran without a person approving them.
None of these figures says how many accounting or finance repositories are affected. They say the mechanism is real and common.
What Anthropic changed, and what stays your job
The changelog for Claude Code 2.1.323, committed on 12 November 2026, says a “don’t ask again” rule that looks like it holds a secret, or that would be saved to a settings.local.json git already tracks, now lasts for the session only. The same release fixes the file not being ignored globally when a folder became a repository later or on a new machine. Ars Technica quotes Boris Cherny, who leads Claude Code at Anthropic, saying the team was looking into the problem and considering built-in secret scanning.
What the update does not do: clean rules already saved, rewrite git history, reach forks or other clones, or delete images already pushed. Anthropic does not describe how it decides that a rule “looks like” a secret, and a password with no recognisable format may not.
Where a finance credential can sit
| File | Who should have it | How it gets out | What to do |
|---|---|---|---|
.claude/settings.local.json |
You, on one machine | Commit on another machine or an old clone; COPY . . into an image |
Repo .gitignore and .dockerignore; rules with $VARIABLES only |
.claude/settings.json |
The team, committed on purpose | It is committed: any literal value in env or a rule is public to everyone with the repo |
No secrets at all; deny and ask rules live here |
CLAUDE.md |
The team | Committed with the code | Describe where credentials live, never paste them |
.mcp.json |
The team or you | Committed with MCP server definitions | Reference environment variables in env blocks |
.claude/.credentials.json, .codex/auth.json |
Nobody: they belong in your home folder | A whole home directory committed | Remove, sign out and sign in again |
.env |
You | Copied into images if .dockerignore misses it |
Deny Read(./.env) for the agent; keep it out of git and images |
Run the audit
- Update Claude Code with
claude updateand check the version is 2.1.323 or later. - Download the kit and run the script over the folder with your finance repositories. It needs Python 3.9 and git, reads only, and masks every value it finds.
- Read the report. HIGH means a literal secret in an agent file, a tracked
settings.local.json, a past version with secrets in git history, or a Dockerfile whose context includes.claude/. - Rotate before you clean. For every HIGH, create a new key at the provider (the Xero or Intuit app, Stripe, Holded, Odoo, the database), revoke the old one and read the provider’s activity log back to the first commit that touched the file.
- Clean: delete the rules with
/permissions,git rm --cachedthe local file, add the ignore lines and rebuild any image. - Re-run until it reports 0 HIGH. Use
--history-rotatedonly once the owner of each integration has confirmed the rotation.
Copy and adapt
Prerequisites: Python 3.9 or later, git, and a copy of the folder you want to check. Download the kit from /downloads/: claude_settings_secret_audit.py, sample reports, a shared settings template, ignore snippets, a checklist and three prompts. Everything is an Agents Finance template under MIT-0, based on Claude Code’s documentation and the research above, not published by Anthropic or by the researchers.
python3 claude_settings_secret_audit.py --selftest # fictitious repo, no real data
python3 claude_settings_secret_audit.py ~/finance-scripts # every git repo below this folder
python3 claude_settings_secret_audit.py . --history-rotated # after rotation is confirmed
# writes claude_settings_audit.md and .csv; exit code 1 if any HIGH
Besides generic tokens, the script looks for formats a finance repository is likely to hold: Stripe live keys, bearer tokens next to api.xero.com or intuit.com, Holded’s key: header, Odoo and NetSuite secrets, OAuth client secrets, database URIs with passwords and PGPASSWORD=-style prefixes.
Shared project policy, to commit as .claude/settings.json. Claude Code evaluates deny, then ask, then allow, and an ask rule wins over a narrower allow rule, so if you later allow one exact API call, remove the broad curl ask:
{
"permissions": {
"deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)", "Read(./exports/bank/**)", "Bash(git push *)"],
"ask": ["Bash(curl *)", "Bash(psql *)", "WebFetch"],
"allow": ["Bash(python3 scripts/close_checks.py *)"]
}
}
Lines for the repository’s own ignore files:
# .gitignore
**/.claude/settings.local.json
.env
.env.*
# .dockerignore
.git
.env
.env.*
.claude/
CLAUDE.md
.mcp.json
And the habit that fixes the cause: let the command carry the variable name, so an approved rule stores the name and not the value.
export XERO_ACCESS_TOKEN=... # from your secrets manager, not typed into the prompt
curl -s -H "Authorization: Bearer $XERO_ACCESS_TOKEN" -H "xero-tenant-id: $XERO_TENANT_ID" \
"https://api.xero.com/api.xro/2.0/Reports/TrialBalance?date=2026-11-30"
GitGuardian notes that the value can still reach the session transcript if the shell prints it, so do not echo tokens.
What our test found
The self-test builds a repository called month-end-scripts with invented credentials: a Xero bearer token, a Stripe live-format key, a Holded key and a Postgres password in four approved commands, an Odoo key in the shared settings, a broad Bash(curl *) rule, a Dockerfile with COPY . . and the local file committed by mistake. A QuickBooks rule that uses $QBO_ACCESS_TOKEN is correctly left alone.
- Before the fixes: 8 HIGH and 2 MEDIUM, NO-GO.
- After removing the values, untracking the file and adding both ignore files: 1 HIGH, because the four values are still in git history.
- After declaring rotation with
--history-rotated: 0 HIGH, 1 MEDIUM that stays as a reminder.
On 111 repositories on our own working machine, mostly copies of this site’s code and open-source projects, it flagged no literal secret and found 107 without the repository-level ignore line. This site’s repository was one of them; the line is now in its .gitignore.
Limits
The patterns catch common formats, not every password. A clean report does not prove a repository never held a secret elsewhere, such as in session transcripts, shell history or a pushed image. The script reads only local copies: forks, other people’s clones and registries need their own check, and your git host’s secret scanning should stay on.
Newsletter
Subscribe to the newsletter to get the next template: a quarterly credential register for every ERP, bank and payment integration your AI agents use, with owner, expiry and rotation date.
Frequently asked questions
Why does Claude Code save API keys in settings.local.json?
When Claude Code asks before a shell command and you choose “Yes, and don't ask again”, it saves an allow rule in .claude/settings.local.json at the root of the repository. When the rule is the exact command, any token or password typed into it is saved too, in plain text. Since version 2.1.323 (12 November 2026), the changelog says a rule that looks like it holds a secret, or would go into a settings.local.json that git tracks, lasts for the session only.
Is .claude/settings.local.json ignored by git?
Only on the machine where Claude Code created it: the documentation says Claude Code keeps it out of git when it creates the file, and that you must add it to .gitignore yourself if you create it by hand. The rule goes into your global git excludes, not the repository's .gitignore, so a clone on another machine, a colleague or an already-tracked file can still commit it. Add **/.claude/settings.local.json to the repository's own .gitignore.
If I delete the file, is the key safe?
No. Git history, forks, other clones and Docker images built from the folder keep copies. GitGuardian and the other researchers all say to rotate every credential the file ever held first, at the provider, and only then clean up the file and history.
Does .gitignore keep the file out of a Docker image?
No. A COPY . . instruction copies the working tree, not what git tracks, so an ignored file still ships unless .dockerignore excludes it. GitGuardian found secrets from these files in public Docker Hub images. Add .claude/ to .dockerignore and rebuild.
Sources
- GitGuardian blog — Claude Code settings.local.json Secrets: GitHub, Docker Hub (Guillaume Valadon, 9 November 2026, updated 11 November) (opens in a new tab) (primary)
- GitGuardian blog — Claude Code settings.local.json Secrets Hit Docker Hub (25 November 2026) (opens in a new tab)
- Sysdig — How “don’t ask again” in Claude Code leaks secrets on GitHub (Crystal Morin, 25 November 2026) (opens in a new tab)
- Ars Technica — Claude Code is accidentally exposing secrets all over GitHub (9 November 2026, on Apiiro's research) (opens in a new tab)
- Marek Bruns — Claude Code settings.local.json: find and rotate secrets (25 November 2026) (opens in a new tab)
- Claude Code documentation — Settings files and precedence (opens in a new tab)
- Claude Code documentation — Configure permissions (opens in a new tab)
- GitHub — anthropics/claude-code CHANGELOG.md, version 2.1.323 (commit 89eb88e, 12 November 2026) (opens in a new tab)
We wrote this entry in our own words from the sources above and checked that the links worked on December 2, 2026. Is anything incorrect? Tell us.
Share this entry
This entry is part of the guide: AI agents for accounting