Guides / Claude Code permissions
Claude Code's "don't ask again": what is safe to approve
Every “Yes, and don't ask again” is saved as a rule that outlives the session. Here is what each approval really allows, which commands a small team can safely let run, and a settings file you can commit today.
What “don't ask again” actually does
When Claude Code wants to run a shell command, it asks first and offers Yes, Yes, and don't ask again for a pattern such as npm test *, and No. Choosing the middle option is more permanent than it looks:
- For shell commands, it saves a rule. The rule is written to
.claude/settings.local.jsonat the root of the repository and applies to every future session in that repository, including its subfolders and worktrees. - One approval can save several rules. A command chained with
&&saves one rule per part, up to five. - For file edits, it lasts only until the session ends. Nothing is written to disk.
- The rule is a pattern, not the exact command.
git push *covers every push, to every branch and remote.
Over a few weeks, these approvals quietly add up to a list of things Claude Code may do without asking. Most teams have never read that list.
November 2026: secrets found in these files on GitHub
Because a saved rule is the command itself, any password or token typed into an approved command is written into .claude/settings.local.json in plain text. In November 2026 the security firm Apiiro searched public GitHub for these files. As summarised by the Cloud Security Alliance on 8 November 2026:
- 104,185 copies of
.claude/settings.local.jsonwere public, across 103,617 repositories. - 1,122 of them held at least one real secret, 1,379 distinct secrets in all, including 379 database passwords, 43 SSH logins and 23 AWS keys.
- 734 more secrets were in older commits, and conventional scanners missed 215 of the files, mostly because the password sat inside command syntax.
Claude Code keeps this file out of git when it creates it, by adding it to your global git excludes. The leaks come from files created by hand, machines where that exclude was never set, and files committed before. Apiiro did not test whether the leaked credentials still worked; treat any you find as live.
The habit that prevents it: never put a password or token inside a command you approve. Keep it in an environment variable or a vault, so the saved rule only contains the variable's name.
Which commands are safe to always allow
My rule of thumb for a small team: always allow what only reads or checks, ask for anything that changes what other people see, and deny what touches secrets or production.
| Decision | Examples | Why |
|---|---|---|
| Allow | npm run test *, npm run lint *, npm run build, git status, git diff *, git log * | Read or check only. The worst case is a wasted minute. |
| Ask | git commit *, git push *, npm install *, npx *, database migrations, curl *, docker * | Changes shared code, installs packages from the internet, or sends data out. Worth two seconds of your attention each time. |
| Deny | Read(./.env), Read(./.env.*), Read(./secrets/**), rm -rf *, deploy and production commands | Secrets and irreversible actions. These should never happen without a person doing them deliberately. |
The permission modes, in plain words
Press Shift+Tab during a session to cycle between the first three. The others are set at start-up or in settings.
| Mode | What it does | For a small team |
|---|---|---|
| Default (Manual) | Asks before most edits, shell commands and network requests. | The right default. |
| Accept edits | Accepts file edits and simple file commands in the project without asking. | Fine for focused work, if you review the diff before committing. |
| Plan | Reads and explores, but does not edit source files. | Use it on unfamiliar or sensitive code. |
| Auto | A background check approves or blocks actions instead of asking you. | Only with deny rules and the sandbox in place. |
| Don't ask | Refuses anything that would have needed approval; pre-approved actions still run. | Useful for scripted, unattended runs. |
| Bypass permissions | Skips prompts entirely, including writes to .git and .claude. | Only inside a disposable container or virtual machine, as the documentation itself advises. |
One shared settings file for the team
Commit .claude/settings.json so everyone works under the same rules. Deny rules are checked first, then ask, then allow, and the first match wins, so a narrow allow can never override a broad deny.
{
"permissions": {
"allow": [
"Bash(npm run test *)",
"Bash(npm run lint *)",
"Bash(git status)",
"Bash(git diff *)"
],
"ask": [
"Bash(git commit *)",
"Bash(git push *)",
"Bash(npm install *)",
"Bash(npx *)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Bash(rm -rf *)"
]
}
}
- Where each file sits in the order: organization-managed settings come first, then
.claude/settings.local.json(yours, this project), then.claude/settings.json(the team's), then~/.claude/settings.json(yours, every project). Allow, ask and deny lists are merged across files. - Keep personal approvals out of git. When Claude Code creates
settings.local.jsonit adds it to your global git ignore list. If you created the file by hand, add it to.gitignoreyourself. - Shell rules are reminders, not walls. They match the command text:
Bash(git push *)does not catchgit -C . push. For real enforcement use the sandbox (/sandbox, macOS and Linux) or a hook that blocks the action. - Block with a hook when it matters. A
PreToolUsehook that exits with code 2 stops the action and tells Claude why, for example any push tomain.
A five-minute audit you can do today
- Run
/permissionsin Claude Code. It lists every rule and the file it came from. - Remove any broad allow rule:
git push *,curl *,npx *,rm *, anything withsudo. - Open
.claude/settings.local.jsonand check it does not contain a key or token pasted inside a saved command. - Run
git check-ignore .claude/settings.local.json. If it prints nothing, the file is not ignored: add it to.gitignore. Then rungit log --all --oneline -- .claude/settings.local.json: any output means it was committed at some point, and every secret ever in it should be rotated. - Add the deny rules above to
.claude/settings.json, commit it, and turn on/sandbox.
If something already slipped out, follow what to do in the first hour after a key reaches GitHub.
Sources
Checked on 5 December 2026. Product menus change; the documentation below is the reference.
How I help
I set up Claude Code for small teams so it is fast and safe: shared rules, a sandbox, secret scanning and a review of what was already approved.
- Same day: rotation of every exposed key, a check of the provider logs, and the history clean-up.
- Launch review: one week, $2,500 fixed. The code and full git history scanned for secrets, access checked on the server, and a ranked fix list.
- Team setup: a shared Claude Code settings file, secret scanning before every push, and keys moved into a vault.
Done by a Claude Certified Architect and Certified Lovable Expert. Everything stays in your accounts.
Questions
Where is a "don't ask again" approval saved?
For shell commands, in .claude/settings.local.json at the root of the repository, and it applies to future sessions in that repository. For file edits, it lasts only until the session ends and is not saved.
Can "don't ask again" save my passwords?
Yes, if the password is inside the command you approve: the saved rule is the command text. In November 2026 Apiiro found 1,379 secrets in 1,122 public copies of .claude/settings.local.json on GitHub. Keep secrets in environment variables or a vault, and check the file was never committed.
How do I undo an approval?
Run /permissions and remove the rule, or delete the line from .claude/settings.local.json. Changes apply from the next action.
Is accept-edits mode safe?
For focused work, yes, if you read the diff before committing. It accepts file edits and simple file commands in the project without asking; it does not approve pushes or other shell commands.
Do deny rules still work when prompts are bypassed?
Yes. Claude Code's documentation notes that deny rules hold even in bypass-permissions mode, which is why secret files belong in deny rather than relying on prompts.
Does the sandbox work on Windows?
The sandbox runs on macOS and on Linux or WSL2. On native Windows, shell commands run without it, so deny rules and hooks matter more there.
Start with a conversation
Thirty minutes, no charge. Tell me what you have built and where it stopped. If I am not the right person, I will say so and point you somewhere better.
Calendar not loading? Open the booking page or email me.