Claude Code permissions settings
A settings file Claude Code itself enforces for a Vite, React and Supabase app. It blocks reading your secret files and a short list of commands that destroy work, asks you before anything that deploys or touches the database, and lets build and test through.
None. It is a file you read, fill in and keep; it runs nothing.
What it is
settings.json is a list of rules that Claude Code itself enforces. They are not instructions to Claude: Claude Code checks every action against them before it runs, so a blocked action stays blocked even if Claude decides it is a good idea.
This one is written for a Vite, React and Supabase app of the kind Lovable, Bolt and v0 produce. It does three things:
- Blocks reading your secret files and running a short list of commands that destroy work.
- Asks you first before anything that deploys, pushes or touches the database.
- Lets through build, lint and test, so you aren’t asked about those every time.
The file is strict JSON: a stray comma or a // comment breaks it.
What each part does
Rules are checked in this order: deny, then ask, then allow. The first match wins, so nothing in allow can undo a deny.
deny: never, whatever you or Claude say. Opening any .env file, key files and Supabase’s local link details (that’s where secret keys live, and anything Claude reads is sent to the model), with an exception so .env.example, which lists setting names with no values, can still be read. Your computer’s own login keys in ~/.ssh and ~/.aws. Deleting a folder and everything in it (rm -rf and its spellings). Running a command as the computer’s administrator (sudo). Overwriting saved history on GitHub (git push --force and its spellings). Throwing away unsaved changes (git reset --hard, git clean). Wiping the database or sending database changes to the live project (supabase db reset, supabase db push, dropdb): you run those yourself, on purpose.
ask: Claude Code stops and you say yes or no. Deleting any file, git push (if your host rebuilds the site on every push, a push is a deploy), any other Supabase or database command, deploying with npm run deploy, Vercel, Netlify or Wrangler, and editing the files that define your tables and who may read them (supabase/migrations/).
allow: runs without asking. npm run build, npm run lint, npm test, npm run test and npx tsc --noEmit. You don’t need rules for looking around: Claude Code already lets Claude list and read files in your project.
How we tested it
We put the file in a small made-up app with fake keys and asked Claude Code to try a list of actions one by one, in four runs: the mode where it asks before each command (Manual), “accept edits”, Manual again with ways round the rules, and auto mode. On Claude Code 2.1.319, 8 November 2026:
- Every action the rules block was blocked: reading
.envand printing it withcatorhead, a force push,rm -rf,supabase db push, and a.envin a nested folder. - Build, lint and test ran without a question, an ordinary file edit went through, and an edit to a migration file stopped to ask.
- Two ways round the rules that worked in October are now stopped. Deleting with the full path (
/bin/rm -rf) is now caught by therm -rfrule. In auto mode, a one-line Node script that read.envwas stopped by Claude Code’s own auto-mode checker (not by a rule; it decides case by case).
What it doesn’t do
We tested these. Don’t skip this part.
- It matches the words of a command, not what the command does. In auto mode,
command grep -rstill printed lines from both.envfiles, andgit -C . push --forcematched no rule (the auto-mode checker stopped it this time). - A blocked folder isn’t hidden from search. Plain
grep -rprinted a line from a file insecrets/, a folder the rules block from reading. - What protects you in those cases is the question, not the rule. In Manual mode, the ways round the rules stopped and waited for an answer. In auto mode nobody asks you; a second model decides.
npm run buildruns whatever your package.json says build is. If that script changes, the rule lets the new one run.- It doesn’t check your app. It won’t notice a secret key already in your code or a table with no row-level security.
- It doesn’t stop you. If you approve a prompt, it happens.
- Not every rule was exercised. The rules for
sudo, key files,~/.ssh,~/.aws,git reset --hard,git clean,supabase db reset,dropdband the deploy tools were not tried, and the test ran on Linux in one-off runs, not in an interactive session.
So this file removes the most likely accidents. It isn’t a wall. If you want one, Claude Code has a sandbox that restricts files and network at the operating-system level; we haven’t tested it here.
How to adapt it
- Your scripts have other names (
npm run typecheck,pnpm build): add them toallow, spelled exactly as you type them. - You want to be asked about every command: press Shift+Tab in Claude Code until it says Manual. Given the results above, that’s the mode that keeps you in the loop for an app with real users’ data.
- A rule gets in your way: move it from
denytoask. Don’t delete it. - Personal exceptions go in
.claude/settings.local.json, which stays on your computer. Adenyin this file still beats anallowthere. - Put the file in git so it travels with the project. Pair it with the CLAUDE.md for an exported app: that one tells Claude what you want, this one holds when Claude gets it wrong.
Sources: Configure permissions and Settings files and precedence, Claude Code docs.
The file
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"deny": [
"Read(.env)",
"Read(.env.*)",
"Read(!.env.example)",
"Read(*.pem)",
"Read(*.key)",
"Read(secrets/**)",
"Read(supabase/.temp/**)",
"Read(~/.ssh/**)",
"Read(~/.aws/**)",
"Bash(rm -rf *)",
"Bash(rm -fr *)",
"Bash(rm -r *)",
"Bash(rm -R *)",
"Bash(sudo *)",
"Bash(git push --force*)",
"Bash(git push -f*)",
"Bash(git push * --force*)",
"Bash(git push * -f*)",
"Bash(git reset --hard*)",
"Bash(git clean *)",
"Bash(supabase db reset*)",
"Bash(supabase db push*)",
"Bash(npx supabase db reset*)",
"Bash(npx supabase db push*)",
"Bash(dropdb *)"
],
"ask": [
"Bash(rm *)",
"Bash(git push*)",
"Bash(supabase *)",
"Bash(npx supabase *)",
"Bash(psql *)",
"Bash(npm run deploy*)",
"Bash(vercel *)",
"Bash(npx vercel *)",
"Bash(netlify *)",
"Bash(npx netlify *)",
"Bash(wrangler *)",
"Bash(npx wrangler *)",
"Edit(supabase/migrations/**)"
],
"allow": [
"Bash(npm run build)",
"Bash(npm run lint)",
"Bash(npm run test *)",
"Bash(npm test *)",
"Bash(npx tsc --noEmit)"
]
}
}
Test status
VERIFIED ON 2.1.319
2.1.319
8 NOV 2026
Changelog
- 1.0Retested on Claude Code 2.1.319 (4 runs): every rule that held before still holds, and two ways round the rules found in October are now stopped. Published under this name. 8 Nov.
- 1.0First version, tested on Claude Code 2.1.290 on macOS (4 runs). 6 Oct.