AI agent permissions for beginners: approval modes, allow/deny rules and sandboxes
Your agent will ask before it does some things and not others. Those prompts are your main safety net, and the "allow everything" options are where real damage can happen.
This guide explains three controls: approval modes (when the agent asks you), allow/deny rules (what it may do without asking) and sandboxes (what it can reach at all). It's quoted from Anthropic, OpenAI, Cursor and VS Code docs, checked Oct 2026. Mode names change often, so each one below is marked "checked Oct 2026".
Not affiliated with or endorsed by Anthropic, OpenAI, Anysphere, GitHub or Microsoft. Check their current docs before relying on these details.
Step 1: Know what each tool asks about by default
Each tool starts out asking for some actions and not others.
- Claude Code: the default mode "Prompts for permission on first use of each tool". It's "Labeled Manual in the CLI, the VS Code and JetBrains extensions, and the desktop app" (checked Oct 2026). (source)
- Codex: "By default, the agent runs with network access turned off. Locally, Codex uses an OS-enforced sandbox that limits what it can touch (typically to the current workspace), plus an approval policy that controls when it must stop and ask you before acting." (source)
- Cursor: "By default, sensitive actions require your manual approval." Also, "Reading files and searching code don't require approval." (source)
- Copilot in VS Code: Manual permissions is the default (checked Oct 2026). It "Uses your tool, URL, and terminal approval settings. Actions that are not auto-approved require your confirmation." (source)
Watch one Cursor detail: "Agents can modify workspace files without approval, except for configuration files. Changes save immediately to disk. Always use version control so you can revert changes." (source) If you don't use git yet, start with git basics for AI coders.
Step 2: Use a read-only mode to explore
When you only want the agent to look around or plan, pick a mode that can't change your code.
- Claude Code: in plan mode (checked Oct 2026), "Claude reads files and runs read-only shell commands to explore but doesn't edit your source files". (source)
- Codex: "If you want to chat or plan without making changes, switch to read-only mode with the /permissions command." From the command line, OpenAI's example is
codex --sandbox read-only --ask-for-approval on-request(checked Oct 2026). (source)
Step 3: Loosen approvals one step at a time
Once you trust a task, you can let routine work run without a prompt for each step.
- Claude Code: acceptEdits mode (checked Oct 2026) "Automatically accepts file edits and common filesystem commands such as mkdir, touch, mv, and cp for paths in the working directory or additionalDirectories". (source)
- Codex: "In the Auto preset (for example, --sandbox workspace-write --ask-for-approval on-request), Codex can read files, make edits, and run commands in the working directory automatically." It still "asks for approval to edit files outside the workspace or to run commands that require network access" (checked Oct 2026). (source)
- Cursor: "By default, terminal commands need your approval." Run Modes let trusted commands run without a prompt, from a simple allowlist up to an Auto-review classifier. Cursor describes these as guardrails that can miss things, not a hard security boundary. (source)
- Copilot in VS Code: Assisted permissions (checked Oct 2026) "Uses an LLM judge to assess each tool call." VS Code warns: "The model-based risk assessment can make mistakes." (source)
Older tutorials may tell you to set Codex's approval policy to "untrusted". Don't follow them: "Codex and ChatGPT Work no longer support approval_policy = 'untrusted'." (source)
Step 4: Avoid the "allow everything" modes on your own machine
Every tool has a mode that skips the prompts. The docs warn about each one.
- Claude Code: "In bypassPermissions mode, Claude Code skips permission prompts, including for writes to protected paths such as .git and .claude." Anthropic says: "Only use this mode in isolated environments like containers or VMs where Claude Code can't cause damage." (source)
- Copilot in VS Code: Allow all "Runs all tool calls without confirmation." VS Code warns that "Allow all and Autopilot skip confirmation for potentially destructive actions, including file edits, terminal commands, and external tool calls," and says: "Use these options only when you trust the workspace and understand the security implications." (source)
You can also lock these modes off. In Claude Code, "To prevent bypassPermissions or auto mode from being used, set permissions.disableBypassPermissionsMode or permissions.disableAutoMode to 'disable' in any settings file." (source)
Step 5: Write allow and deny rules
Claude Code lets you list what's allowed, what needs a prompt, and what's blocked. The order matters: "Rules are evaluated in order: deny, then ask, then allow. The first match in that order determines the outcome, and rule specificity doesn't change the order." So "An allow rule can't carve an exception out of a deny rule." (source)
Know the limit, too: "a deny or ask rule covers the invocation Claude usually produces and isn't a security boundary around the program." (source) Rules help, but a sandbox (Step 6) is the stronger wall.
Protect secret files with rules as well:
- Copilot in VS Code: use
chat.tools.edits.autoApprove"with glob patterns (for example, '**/.env': false) to require manual approval for edits to sensitive files." (source) - Cursor: "Use .cursorignore to block agent access to specific files." (source)
For more on this, see how to keep secrets safe with AI coding tools.
Step 6: Turn on a sandbox, and know what it covers
A sandbox limits what commands can touch, even if you approve them.
- Claude Code: "The Bash sandbox is a boundary that the operating system enforces around the shell commands Claude runs on your machine. You set which files and network domains those commands can reach". But "The sandbox covers shell commands only. Claude's file tools, MCP servers, and hooks run outside it." It "runs on macOS, Linux, and WSL2. On native Windows, Claude Code runs commands unsandboxed." By default, sandboxed commands can read "Most of the machine, including credential files such as ~/.ssh and ~/.aws/credentials", so add those paths to the
sandbox.filesystem.denyReadsetting. This only covers shell commands, not Claude's Read tool. (source) - Cursor: "The sandbox runs terminal commands in a restricted environment that blocks unauthorized file access and network activity." Your Run Mode decides "when terminal commands enter the sandbox." (source)
- Copilot in VS Code: "Sandboxing is independent of the permission level. Allow all and Autopilot skip approval prompts, but an enabled sandbox still restricts terminal file system and network access." Note that "Outbound network access remains enabled by default" (the
chat.agent.sandbox.network.allowNetworksetting defaults to true). (approvals, security) - Codex: the sandbox is on by default and network access is off, as in Step 1. (source)
Step 7: Approve MCP tools and new projects with care
Cursor says: "All MCP connections need your approval. After you approve an MCP connection, each tool call still needs individual approval before running." (source)
For code you just downloaded, VS Code says: "Open untrusted projects in restricted mode. Until you've reviewed a project for malicious content, rely on the Workspace Trust boundary. Restricted mode disables agents in that workspace." (source)
An example setup
Here's a Claude Code settings file that turns off bypassPermissions mode, using the setting named in Step 4 (we haven't tried it ourselves). Check the permissions docs for the exact format before using it.
{
"permissions": {
"disableBypassPermissionsMode": "disable"
}
}
Next steps
- Get an undo button: git basics for AI coders
- Keep keys out of reach: how to keep secrets safe with AI coding tools
- Write a clear task: how to give an AI coding agent a clear task
Sources
All checked Oct 15, 2026:
- Claude Code permissions
- Claude Code sandboxing
- Codex approvals and security
- Cursor agent security
- Cursor terminal
- VS Code approvals
- VS Code security
Not affiliated with or endorsed by Anthropic, OpenAI, Anysphere, GitHub or Microsoft. Check their current docs before relying on these details.