Guide

Where AI coding assistants save approved commands

Claude Code, VS Code Copilot Chat, Codex CLI, Gemini CLI and Cursor CLI can each save a command you approve as a rule in a file on your machine, and skarn vet, in Skarn 0.38.0 or later, reads those files in your home directory and in the project you run it in, and lists each rule that holds a credential it recognizes. What the file holds differs: a Claude Code, Codex CLI or VS Code rule can hold the whole command, a password in it included, and the Gemini CLI and Cursor CLI approvals measured saved only the command name. If a rule looks like it holds a secret, or would be saved to a settings.local.json that git tracks, Claude Code's changelog says that version 2.1.323, released on 2026-11-12, keeps it for the session only. A rule an earlier version saved stays in the file until someone removes it.

Last updated 2026-11-28.

The saved-approval file, per assistant

Each row is the file a standing approval at the prompt is saved to. Paths are the defaults, written as they resolve on macOS and Linux. The last column says where each fact comes from: the vendor's documentation, published research linked in the cell, or a measurement, which means approving a command that carried a made-up credential in the named release and then reading the file. A measurement covers only the commands approved, and another release can save a different form.

AssistantFileScopeWhat is storedSource
Claude Code .claude/settings.local.json at the root of the git repository; in a worktree, the file at the main checkout. Outside a git repository, on Windows and in the other cases the settings page lists, the file is in the session's working directory. One project, for you alone. Claude Code keeps the file out of git when it creates it. In the Claude Code extension for VS Code, the approval card can save to the project's shared .claude/settings.json instead. An entry in permissions.allow. For a command prefix it is a pattern such as Bash(npm run test *). A rule can also hold one exact command, and a password in the text of a rule is then in the file in plain text. Since version 2.1.323, released on 2026-11-12, a 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. A rule an earlier version saved stays in the file until someone removes it. A compound command is saved as one rule for each subcommand that needs approval. Documented: permissions, settings. The 2.1.323 change: changelog. Saved rules that hold a whole command and its password: Apiiro's research.
VS Code Copilot Chat The chat.tools.terminal.autoApprove setting in the user settings file: ~/Library/Application Support/Code/User/settings.json on macOS, ~/.config/Code/User/settings.json on Linux User. The deprecated Local harness can also save a rule to Workspace settings, the .vscode/settings.json of the workspace. An approval saved on a remote host stays on that host. A terminal command rule for the exact command or a suggested prefix. An entry of the setting pairs a command prefix, or a regular expression between slashes, with a decision. Documented: approvals, settings
Codex CLI ~/.codex/rules/default.rules User A prefix_rule call. In two approvals on codex-cli 0.172.0, each call held the whole command, the credential included: one token by token, the other as the shell command line that ran it. File documented: rules. Stored form measured.
Gemini CLI ~/.gemini/policies/auto-saved.toml User A [[rule]] table. In two approvals on Gemini CLI 0.71.1, its commandPrefix held only the command name. Directory documented: policy engine. Setting documented: configuration. File name and stored form measured.
Cursor CLI ~/.cursor/cli-config.json User An entry in permissions.allow. In the one approval measured, a curl command with a bearer header on cursor-agent 2026.11.22, the entry was Shell(curl), without the header. File and entry forms documented: permissions. What an approval writes measured.

Gemini CLI offers its permanent choice, worded "Allow this command for all future sessions" in the shell prompt of release 0.71.1, only when security.enablePermanentToolApproval is true, and the setting is false by default. The Gemini CLI and Cursor CLI approvals measured saved no argument; an entry written by hand can hold one. So can the files a team writes and commits: a project's .claude/settings.json, .vscode/settings.json, .codex/rules/ and .cursor/cli.json.

Read each file by hand

In each file, look for a whole command line where you expect a command name: a password after an option, an assignment such as PGPASSWORD=, a bearer header, a URL with a password in it.

Claude Code

In a session, /permissions lists every rule and the settings file it comes from. Outside one, run the first command at the root of the repository's main checkout to print the file, and the second to find the other copies under your home directory:

cat .claude/settings.local.json find ~ -path '*/.claude/settings.local.json'

VS Code Copilot Chat

Run Preferences: Open User Settings (JSON) from the Command Palette and search for chat.tools.terminal.autoApprove. To list the terminal approvals saved with Always Allow on your machine, focus a session on the local Agent Host and run Chat: Manage Tool Approval. A profile's settings file is under User/profiles/.

Codex CLI

Codex CLI loads every .rules file in the directory, and a trusted project's .codex/rules/ too:

cat ~/.codex/rules/*.rules

Gemini CLI

Gemini CLI loads every .toml file in the directory:

cat ~/.gemini/policies/*.toml

Cursor CLI

The home file also holds account fields, so print the permissions alone. A project's .cursor/cli.json holds the same lists:

jq .permissions ~/.cursor/cli-config.json

List the credentials with skarn vet

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. A plain run reads the files under your home directory 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 run below uses a scratch home directory, /tmp/claude/home, with one project and six configuration files. Five of them hold one made-up password each. The Codex CLI rule is in a saved form from the table. The Claude Code rule, the VS Code entry, the Gemini CLI policy file deploy.toml and the Cursor CLI entry are written by hand.

$ skarn vet --all-projects Skarn vetted this machine's AI assistant configuration 6 config file(s), 9 setting(s) examined - read-only, no network 1 project(s) vetted, 0 recorded path(s) skipped because they are not existing absolute directories HIGH vet-permission-plaintext-credential permission rule carries a plaintext credential ./.claude/settings.local.json -> permissions.allow[1] matches mysql-client-password, preview H****77 HIGH vet-permission-plaintext-credential permission rule carries a plaintext credential /tmp/claude/home/.cursor/cli-config.json -> permissions.allow[1] matches mongo-shell-password, preview M****66 HIGH vet-permission-plaintext-credential permission rule carries a plaintext credential /tmp/claude/home/Library/Application Support/Code/User/settings.json -> chat.tools.terminal.autoApprove[1] matches redis-cli-password, preview W****41 HIGH vet-permission-plaintext-credential permission rule carries a plaintext credential /tmp/claude/home/.gemini/policies/deploy.toml -> rule[0].commandPrefix[0] matches docker-login-password, preview Q****58 HIGH vet-permission-plaintext-credential permission rule carries a plaintext credential /tmp/claude/home/.codex/rules/default.rules -> prefix_rule[0] matches sshpass-password, preview T****93 5 finding(s): 0 critical, 5 high, 0 medium, 0 low

Each finding names the file, the entry and the kind of credential. The preview keeps at most the first character and the last two of the value.

--all-projects follows Claude Code's record of projects. A project's .vscode/settings.json, .codex/rules/ or .cursor/cli.json is read when Claude Code has recorded that project, or when you run skarn vet inside it. A run reads project files at the working directory, at the top of its git repository and, in a linked worktree, at the main checkout. It does not search the folders below those, so to read a nested workspace's files, run skarn vet from the directory that holds its .vscode, .codex or .cursor folder. Check the project counts the report gives and read every coverage gap it lists. 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.

What a run with no findings does not prove

A run with no findings is not proof that no rule holds a credential. Skarn checks each rule against its bundled rules and its command-line password detector. That 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 Codex CLI rule saved as a shell command line, the second form in the table, can be such a command: in one comparison on Skarn 0.38.0, a mysql password in a rule stored as /bin/zsh -lc followed by the command line went unreported, and the same command stored token by token was reported. A saved credential goes unreported when neither the bundled rules nor the detector recognize it.

For VS Code, Skarn reads the user and profile settings files of the stable build on this machine and the .vscode/settings.json of the projects it visits. It does not read a multi-root workspace's .code-workspace file, another build of the editor, a portable installation, an editor started with the user-data-dir switch, or settings kept on a remote host. For Gemini CLI, it reads the user policy directory, and not a workspace or system one or a path named in settings.policyPaths.

Skarn reports the rule. It does not edit the file or rotate the credential. Treat a credential found in a saved rule as exposed. Skarn does not read git history and does not tell you whether a file was committed.

Check your own machine

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

See also: how a Claude Code approval saves a password, where AI coding assistants store your prompts on disk, how to scan those sessions for secrets, all guides