Blog

Saved command approvals hold secrets

At a Claude Code permission prompt, the answer "Yes, and don't ask again" can save the whole command as a permission rule. A password in that command is now in a settings file, in plain text. Claude Code's changelog says that version 2.1.323, released on 2026-11-12, changed "don't ask again" so that an allow rule that looks like it holds a secret, or that would be saved to a settings.local.json that git tracks, lasts for the session only and is not saved. This post shows where the file is and the commands that list what it holds.

Published 2026-11-28. Updated 2026-11-28.

The approval is a file

Claude Code asks before it runs a shell command. One of the answers is "Yes, and don't ask again". Pick it, and Claude Code writes a rule into the permissions.allow list of .claude/settings.local.json in the project (Claude Code permissions). For a command prefix the rule is a pattern, like the first line below. For other commands it is the whole command, and a password in the command is then in the rule:

{ "permissions": { "allow": [ "Bash(npm run test *)", "Bash(sshpass -p 'Tr0ub4dor-Example-93' ssh -l deploy build.example.com uptime)", "Bash(mysql -h db.example.com -u app -pHunter2-Example-77 shop)" ] } }

Both passwords above are made up for this post. The file sits in the project directory.

As read on 2026-11-28, the Claude Code changelog entry for 2.1.323, released on 2026-11-12, reads: "Changed 'don't ask again' so an allow rule that looks like it holds a secret, or would be saved to a settings.local.json that git tracks, lasts for the session only and isn't saved". A rule an earlier version saved stays in the file until someone removes it.

Measured on Claude Code 2.1.332 on 2026-11-28: for the two commands above, "don't ask again" offered the prefixes sshpass * and mysql *, with no password in the rule, and a rule holding a password in a PGPASSWORD= assignment lasted for the session only.

The numbers

Apiiro's research, Coding Agents Are Leaking Your Secrets to GitHub, looked at the copies of this file that reached public GitHub repositories. As read on 2026-11-11, it counted 104,185 public copies of .claude/settings.local.json and found a real secret in 1,122 of them. It ran two secret scanners over the files, and 215 of those 1,122 were flagged by neither. The gap it names is a password inside a command. Ars Technica reported the findings on 2026-11-09.

You can check the file on your machine even if it was never committed.

More than one file holds allow rules

Claude Code keeps rules in more than one settings file, and other assistants keep allow rules in files of their own. A command saved or written there can hold a credential the same way, and skarn vet reads these files:

  • Claude Code: .claude/settings.local.json and .claude/settings.json in a project, and ~/.claude/settings.json.
  • VS Code Copilot Chat: the chat.tools.terminal.autoApprove setting, in user and workspace settings.
  • Codex CLI: the rules files under ~/.codex/rules/ and a project's .codex/rules/.
  • Gemini CLI: the policy files under ~/.gemini/policies/ and a project's .gemini/settings.json.
  • Cursor CLI: the permissions in ~/.cursor/cli-config.json and a project's .cursor/cli.json.

See it on your machine

You need Skarn 0.38.0 or later. skarn vet needs no license and no account. It opens each configuration file for reading and never writes one. In the project above it prints:

$ skarn vet Skarn vetted this machine's AI assistant configuration 1 config file(s), 3 setting(s) examined - read-only, no network HIGH vet-permission-plaintext-credential permission rule carries a plaintext credential ./.claude/settings.local.json -> permissions.allow[1] matches sshpass-password, preview T****93 HIGH vet-permission-plaintext-credential permission rule carries a plaintext credential ./.claude/settings.local.json -> permissions.allow[2] matches mysql-client-password, preview H****77 2 finding(s): 0 critical, 2 high, 0 medium, 0 low

Each finding names the file, the entry in the list and the kind of credential. The value is never printed: the preview keeps at most its first character and its last two.

A plain skarn vet reads your home configuration and the project you run it in. One option adds the projects Claude Code has recorded in its state files:

skarn vet --all-projects

The report then gives the project counts. Check them and read every coverage gap it lists. A gap can mean that Skarn could not read a configuration file or could scan only part of it. If more projects are recorded than Skarn's project limit, it reports one gap for the rest and leaves them out of the skipped count. A project Claude Code never recorded is read only when you run skarn vet inside it. By default, findings alone leave the exit status at 0; --fail-on-severity fails the run on findings at your threshold, and --fail-on-scan-error fails it on a coverage gap.

skarn assess scans your AI coding sessions and lists the same saved rules in its report, under Credentials in saved permission rules. That section stays outside the risk score, the finding counts and the exit code, so read it as well as the score:

skarn assess -o report.html

The detector behind the two findings above reads POSIX shell commands for a literal password of 8 or more bytes passed to sshpass, the MySQL and MariaDB clients, redis-cli, mongosh and mongo, docker login and podman login, sqlcmd and bcp, the OpenLDAP clients and the Samba clients. A provider key or token in a saved rule is reported when a rule in the bundled pack recognizes its format.

A run with no findings is not proof that no rule holds a credential. The detector stays silent on a PowerShell or cmd command, on a password under 8 bytes, and on a command it cannot read exactly, such as one inside ssh host ..., docker exec or bash -c. A saved credential goes unreported when neither a bundled rule nor this detector recognizes it.

Before the approval

skarn guard is a hook that sees a tool call before it runs. What follows is Claude Code; what a hook can decide differs by assistant, and the guard hook-event reference lists it. In audit mode, which needs no license, the guard reports the call and lets it go ahead, so Claude Code's own dialog can still offer to save the command. For the mysql command above, its message to the session begins:

skarn-guard (audit): would ask - mysql-client-password (H****77).

Enforce mode is for a team that has reviewed what audit reports and decided that such calls stop. It needs a paid tier. In enforce, in an interactive Claude Code session in default permission mode, the guard answers the call with an ask and the permission hook Skarn ships denies that request, so the approval is never given and no rule is saved (measured on Claude Code 2.1.325 with a password in a PGPASSWORD= assignment).

What Skarn does not do

Skarn reports the rule. It does not edit the settings file or rotate the credential. Those are yours to do: treat a credential found in a saved rule as exposed. Skarn does not read git history and does not tell you whether the file was committed. A git secret scanner covers that side.

Check your own machine

Install Skarn, then run skarn vet --all-projects.

Related: where each assistant saves approved commands, the leak in the connector setup, what leaks into AI coding sessions, measured, what Skarn is