Skip to main content

Claude Code permissions template: an interactive starting point

In one sentence: This is a starting point for interactive approvals in Claude Code. It intercepts matching tool calls; actual file and network isolation also depends on the sandbox, credentials, and MCP boundaries. Check your permission mode before copying it.

Templateโ€‹

{
"permissions": {
"deny": [
"Read(.env)",
"Read(.env.*)",
"Read(secrets/**)",
"Bash(rm *)",
"Bash(sudo *)",
"Bash(dropdb *)"
],
"ask": [
"Edit",
"Write",
"Bash(git branch *)",
"Bash(git commit *)",
"Bash(git push *)",
"Bash(git reset *)",
"Bash(npm *)",
"Bash(pnpm *)",
"Bash(npx *)"
],
"allow": [
"Read",
"Glob",
"Grep",
"Bash(pwd)",
"Bash(git status)",
"Bash(git diff)"
]
}
}

How to use itโ€‹

Place it in the project's .claude/settings.json, or adapt it for personal settings using the current documentation. Matching deny rules take precedence over ask, then allow; permission modes, managed policies, and sandbox settings also affect the result.

  • Inspect what a command does. git branch can list branches, delete them, or reset their pointers, so this template asks for that whole family. Tests, lint, and builds can execute repository scripts, read credentials, or use the network. Review scripts and dependencies before deciding whether to pre-approve them for a task.
  • Deny rules have a scope. Bash(rm *) blocks matching forms, not every executable path, shell wrapper, or indirect subprocess. Read rules do not surround arbitrary scripts' file access either. A command deny list cannot replace OS isolation.
  • Restrict data and egress separately. Avoid mounting sensitive files or injecting credentials. Restrict egress in an environment that covers the relevant processes. Claude Code's shell sandbox excludes MCP, hooks, and built-in file/web tools; see sandbox isolation and network egress control.
  • Verify the boundary. With dummy files containing no real secrets, check ordinary reads, protected paths, branch deletion, and unapproved scripts. A configuration that parses is not enough evidence.

Runnable checkโ€‹

From the repository root:

node examples/permissions/demo.mjs

The source and run instructions create synthetic files and start real Node child processes with --permission. Assertions verify allowed reads and writes, denied unapproved access and child-process creation, and the final files. Use Node.js 22.13 or later in the 22.x line, or Node.js 24+. No dependency installation is required.

This exercise distinguishes a written rule from an enforced denial. It tests Node process permissions, not the Claude Code rules above. Node's documentation describes a seat belt for trusted code, with limitations involving malicious code, symbolic links, and existing file descriptors. It cannot replace an OS sandbox or network isolation.

Applicability boundariesโ€‹

When to use itโ€‹

  • Local collaboration where writes, version-control changes, and repository scripts retain interactive approval.
  • Teams that need an adaptable, verifiable starting point for permissions.

When not to use itโ€‹

  • As a complete policy for unattended execution or preventing exfiltration.
  • As a configuration to copy unchanged into another tool or permission mode.

What to replace before useโ€‹

  • Use your real sensitive paths, package manager, and commands; review existing allow rules.
  • Check which processes are covered by filesystem, environment, network, MCP, and hook controls.
  • Verify current rule syntax and modes with the dummy-data checks above.

Version notesโ€‹

Verified 2026-10-29

This illustrates approval rules and does not enumerate every dangerous action. Matching, mode precedence, and sandbox coverage evolve; use the installed version's documentation and observed results.

Further reading and sourcesโ€‹