Claude Code, Codex, Cursor and Copilot Security Controls Compared

- Share:





3366 Members
Short answer: the built-in coding agent security controls in Claude Code, Codex, Cursor and GitHub Copilot bound what one agent can do in one tool. You get four kinds of control: a sandbox around shell commands, a permission or approval mode that decides when the tool asks you, a network allowlist or firewall, and managed settings an admin can push. Turn them all on. Then be honest about what they are. They are per-tool guardrails. None of them gives a fleet of agents a delegated identity, a deny-by-default policy outside the model, a human approval path for headless jobs, or one decision log you can export to your SIEM.
That gap stays academic while one developer runs one agent. It becomes very real in an agentic software factory, where Claude Code runs in a terminal, Cursor runs in the IDE, Codex runs in CI and a Copilot cloud agent opens pull requests, all on the same repo, often on the same change. Each vendor's settings file tightens its own client. None of them is the policy layer for the factory.
Scope: settings and flags documented in each vendor's official docs at publication time, cited inline. This is a comparison, not a configuration walkthrough.
Setting names are the vendors' own. A cell that says "not verified" means we found no equivalent in the docs cited, not that the product lacks one.
| Control | Claude Code | Codex | Cursor | GitHub Copilot cloud agent |
|---|---|---|---|---|
| Sandbox | Bash sandbox, off by default (sandbox.enabled). Covers Bash, PowerShell, Monitor and child processes. Not on native Windows. |
OS-enforced. Modes: read-only, workspace-write, danger-full-access. |
Sandbox for supported shell commands, paired with Run Modes. Configured in sandbox.json. |
Runs in a GitHub Actions runner or cloud sandbox. |
| Approval mode | default (Manual), acceptEdits, plan, auto, dontAsk, bypassPermissions. |
approval_policy: on-request or never. Reviewer: user or auto_review. |
Run Modes: Auto-review, Allowlist, Run Everything. | Org and repo Copilot policies. No per-session mode found. |
| Fully open mode | bypassPermissions / --dangerously-skip-permissions. Deny rules still apply. |
danger-full-access + never, or --yolo. |
Run Everything: no sandbox, no classifier. | Firewall set to Disabled. |
| Rules | permissions.allow, ask, deny. Deny, then ask, then allow. |
Command rules and permission profiles. | permissions.json. |
Firewall allowlists. Content exclusion (not a security boundary). |
| Network | Proxy with network.allowedDomains (starts empty) and deniedDomains. Not WebFetch. |
Off in workspace-write unless enabled. Domain rules need the network proxy feature. |
Team allowed destinations, blocklist, Cloud Agent list. | Firewall on by default, recommended allowlist. Bash tool and built-in Playwright MCP only. |
| Managed settings | managed-settings.json, MDM or server-managed. Above all other levels. |
Requirements and defaults via Admin Console, requirements.toml or MDM. |
Team settings over member and project config. Enterprise MCP allowlist. | Org and enterprise policy. Enterprise managed-settings.json MCP allow/deny lists. |
| Decision log | Not verified. DISABLE_TELEMETRY is operational telemetry, not an authorization log. |
Optional OpenTelemetry events exist, including codex.tool_decision, but they are not a shared decision log. |
Not verified. | Blocked firewall requests are annotated on the PR, but this is not a shared decision log. |
The rest of the article explains each row, with sources.
A coding agent sandbox is a host boundary. It limits which files a command can touch and whether the process can reach the network. It does not decide whether the agent should hold a GitHub token, a cloud role or an MCP grant in the first place.
Claude Code sandbox. Off by default. You turn it on with /sandbox or sandbox.enabled: true. It is built on the open source @anthropic-ai/sandbox-runtime package and applies to Bash, PowerShell and Monitor commands and the processes they start. Writes default to the working directory and paths you add. Reads default to most of the machine, and Anthropic says so plainly: that includes ~/.ssh and ~/.aws/credentials unless you tighten sandbox.filesystem.denyRead. Network has no direct route out. Connections go through a local proxy that checks hosts against network.allowedDomains, which starts empty, and network.deniedDomains.
The sandbox wraps shell commands, and only shell commands. Read, Edit, Write, WebFetch and WebSearch follow permission rules instead, so a denyRead entry does not stop the Read tool and allowedDomains does not limit WebFetch. Command hooks and local MCP servers run with your full access. On native Windows, Claude Code runs commands unsandboxed; use WSL2.
Two keys make the sandbox a requirement instead of a suggestion. sandbox.failIfUnavailable: true makes Claude Code exit at startup instead of quietly running unsandboxed when the platform or dependency check fails. allowUnsandboxedCommands: false removes the retry-outside-the-sandbox path.
Codex sandbox. Codex treats sandbox and approval as two separate layers on the ChatGPT desktop app, the Codex CLI and the IDE extension. read-only is for inspection. workspace-write is the default low-friction local mode: read, edit inside the workspace, run routine commands, network off until you opt in. danger-full-access removes the filesystem and network boundary. Enforcement is platform-native: Seatbelt on macOS, bubblewrap or a helper on Linux and WSL2, and a native sandbox on Windows in PowerShell.
Cursor sandbox. Sandboxing sits on top of Run Modes and applies to supported shell commands. A sandboxed command can work in the project, is blocked from arbitrary network destinations and cannot write outside approved paths. Cursor also protects paths such as .git/config, .git/hooks and .vscode. sandbox.json sets what a sandboxed command can reach. If a command fails a restriction, the agent can ask to rerun it outside the sandbox, and in Auto-review that rerun goes to the classifier.
Copilot cloud agent. There is no local desktop sandbox to configure. The boundary is the environment the agent already runs in, a GitHub Actions runner or a cloud sandbox, and the firewall inside it is the main network control (more below).
Sandboxes answer "what can this command reach." Approval modes answer "when does the tool stop and ask a human." Different questions. Mixing them up is how teams end up with a fully sandboxed agent that nobody is actually reviewing.
Claude Code permissions are a mode plus a rule list. The modes are default (Manual, with manual accepted as a CLI alias), acceptEdits, plan, auto, dontAsk and bypassPermissions.
auto, a separate classifier model reviews actions before they run instead of you. Anthropic's own wording: it "reduces permission prompts but does not guarantee safety."auto is the built-in starting mode for interactive terminal and VS Code sessions on every plan and provider. Headless claude -p and Agent SDK sessions still start in Manual. Worth knowing before you assume your developers are approving every command.dontAsk auto-denies anything that would have prompted. It is aimed at CI and restricted environments where you pre-define what Claude may do.bypassPermissions (also --dangerously-skip-permissions) is, per Anthropic, for isolated containers or VMs only. Admins can block it with permissions.disableBypassPermissionsMode: "disable".Rules live in permissions.allow, permissions.ask and permissions.deny, evaluated deny, then ask, then allow. Specificity does not change the order, so a broad deny like Bash(aws *) beats a narrow allow like Bash(aws s3 ls). A bare tool name in deny (Bash) removes the tool from Claude's context entirely. A scoped rule (Bash(rm *)) leaves the tool visible and blocks matching calls. Deny rules block in every mode, including bypassPermissions. Allow rules have no effect there.
Claude Code also supports hooks, which run before the permission decision and are the natural attachment point for an external policy check. That is a separate topic from this comparison. For how hooks and --dangerously-skip-permissions fit into a factory, see the FAQ on the Software Factory Security page.
Codex approval mode is approval_policy (approvals and security). With on-request, work inside the sandbox proceeds and Codex asks when it needs to leave that boundary or use the network. never turns prompts off. The older untrusted value is retired; OpenAI documents a migration to sandbox_mode = "read-only" plus approval_policy = "on-request". The low-risk local preset is --sandbox workspace-write --ask-for-approval on-request.
Codex also lets you swap who answers the prompt: approvals_reviewer = "auto_review" sends eligible approval requests to an Auto-review classifier (Auto-review). It is a classifier answering an approval request, not policy and not a permission grant. It does not widen the sandbox. Auto-review only applies when approvals are interactive, so with approval_policy = "never" there is nothing for it to review. OpenAI also says Auto-review "is not a deterministic security guarantee."
Cursor Run Modes are Auto-review, Allowlist and Run Everything (Run Modes). Auto-review runs allowlisted calls immediately, sandboxes other shell commands when it can and sends the rest to a classifier on Cursor's backend. permissions.json steers which calls Auto-review runs or reviews. Cursor is explicit that Auto-review is not a security boundary: the classifier can allow a call you would have blocked, and the reverse. Allowlist is deterministic: only listed actions skip approval. Run Everything skips both the sandbox and the classifier. Team admins can restrict which modes members may pick. Cloud Agents do not use Run Modes at all; they run on a dedicated machine and do not prompt per action.
Copilot cloud agent. The docs cited here describe no per-session approval mode. Autonomy comes with the hosted agent. Organization and enterprise Copilot policies decide whether the feature and MCP are on, and the firewall decides where it can connect.
Notice the pattern. Three of four vendors now ship a model that reviews the agent's actions: Claude Code auto, Codex auto_review, Cursor Auto-review. That is useful for prompt fatigue. It is not policy. A classifier is a model reviewing a model, not a versioned authorization rule you can test and enforce consistently across tools.
Prompt injection usually ends in a network call: "upload this," "install from that host." Network policy is how that call fails even when the model was fooled.
Claude Code starts the sandbox proxy with an empty allowlist, so a sandboxed command has no approved destination until you add one. The hole to remember: WebFetch and other in-process tools do not use that list. They follow permission rules.
Codex keeps command networking off in workspace-write until you set [sandbox_workspace_write] network_access = true. Turning network on is not the same as enforcing destinations. Domain allow and deny rules apply only with [features.network_proxy] enabled = true. OpenAI also notes that a full sandbox escalation is different from a narrow network grant and can bypass the command proxy if policy and an approval allow it.
Cursor lets enterprise admins set sandbox allowed destinations, a blocklist that always wins, and a separate allowlist for Cloud Agents. The catch: if a member can still approve full network access for a command, that approval skips the team lists. Restricting the available Run Modes is how you close it.
The Copilot coding agent firewall is the most operationally familiar of the four. It is on by default with a recommended allowlist for package registries and the like. Organization owners set Enabled, Disabled or Let repositories decide; repository admins can add custom rules unless the org turns that off. When a request is blocked, a warning with the blocked address and the command lands in the pull request body or a comment. Disabling it, in GitHub's words, "will allow Copilot to connect to any host."
The scope caveat matters in a factory that wires up MCP. The firewall applies to processes the agent starts through its Bash tool and, in cloud sandboxes, the built-in Playwright MCP server. It does not apply directly to other MCP servers or to processes in Copilot setup steps. GitHub also says it "should not be considered a comprehensive security solution."
For MCP authentication itself, including tokens, OAuth and what to check when an agent connects a server, use the MCP auth checklist rather than a vendor sandbox setting.
All four products have an admin path. That is the difference between "I configured my laptop" and a baseline you can defend in a review.
Claude Code managed settings sit above user, project, local and --settings values. Deliver them as a file (/Library/Application Support/ClaudeCode/managed-settings.json on macOS, /etc/claude-code/managed-settings.json on Linux and WSL, C:\Program Files\ClaudeCode\managed-settings.json on Windows), through MDM, or as server-managed settings from the admin console. allowManagedPermissionRulesOnly makes managed settings the only source of permission rules, so local files and --allowedTools stop counting. Anthropic-hosted cloud sessions do not read a device's file or MDM profile, so their policy has to come from server-managed settings.
Codex managed configuration splits requirements (users cannot override) from defaults (they can). allowed_sandbox_modes and allowed_approval_policies that omit danger-full-access and never block --yolo and its long form, --dangerously-bypass-approvals-and-sandbox. Admins set this under Agent security in the Admin Console, or push requirements.toml through MDM.
Cursor security at team scope starts with team settings, which take precedence over permissions.json and member choices, including which Run Modes exist and sandbox networking. Enterprise MCP policy is a separate allowlist of commands and URLs, with optional per-server tool and network limits. Privacy Mode is on by default for Enterprise teams and can be enforced. It is a data-handling control, not command policy.
GitHub has Copilot policy at organization and enterprise scope, content exclusion (which GitHub says "is not a filesystem security boundary"), and an enterprise MCP allowlist in managed-settings.json with allowedMcpServers and deniedMcpServers. Built-in default servers are always allowed, deny wins, and if an allowlist exists anything off it is blocked. A malformed list is treated as an empty allowlist, which blocks everything except the defaults, so non-default servers are blocked. One scope note: Copilot MCP server policy does not control the GitHub MCP server inside third-party hosts such as Cursor or Claude, per the org policy docs.
If you do nothing else this quarter, do this. Every item is a documented setting cited above.
Claude Code
sandbox.enabled: true, sandbox.failIfUnavailable: true, sandbox.allowUnsandboxedCommands: false.~/.ssh, ~/.aws and similar paths to sandbox.filesystem.denyRead, and matching Read(...) deny rules, since the sandbox does not cover the Read tool.permissions.disableBypassPermissionsMode: "disable" and allowManagedPermissionRulesOnly: true, with your deny rules in the managed file.auto is acceptable as the interactive default on current versions.Codex
allowed_sandbox_modes without danger-full-access, allowed_approval_policies without never.network_access off by default; if you turn it on, also enable the network proxy feature and set domain rules.codex.tool_decision events, and allow the route to your collector.Cursor
Copilot cloud agent
allowedMcpServers / deniedMcpServers, since the firewall does not cover other MCP servers.That is a solid per-tool floor. Here is what happens when the tools meet on one change.
A developer asks Claude Code, in a local terminal on a recent version, to bump a dependency and fix the breakage. The session starts in auto, so a classifier, not the developer, approves the shell commands. The sandbox is on, registry.npmjs.org is in allowedDomains, and the install works. A WebFetch call to a changelog page goes through permission rules, not the sandbox proxy. Nothing in the docs cited here gives you an exportable, per-action record of which calls the classifier allowed.
The developer opens the branch in Cursor and asks for a test fix. Auto-review runs an allowlisted test command, sandboxes another, and sends a third to Cursor's backend classifier. Again, no SIEM-exportable decision log that we could verify. The member could also have approved full network access for one command, skipping the team lists.
The developer assigns the remaining work to the Copilot cloud agent. It pushes commits and opens a pull request. The firewall blocks one host, and the pull request gets a warning with the blocked address and the command. That is the only verified machine-written security signal in this chain from the docs cited here, and it covers one blocked call in one tool.
Now ask the questions an auditor (or your incident channel at 2am) will ask. Which agent ran npm install? Who delegated it? Was that action allowed by policy or by a classifier's judgment? What else did the Cursor session touch? The git history shows commits. Each tool shows a slice. Nothing ties the three slices to one delegation, one policy and one log. Add a Codex job in CI and you get a fourth slice, this time with OpenTelemetry events, in a different shape from the other three.
That is not a vendor failing. Each tool did what its docs say. It is a missing layer.
Software factory security is the practice of governing the AI coding agents that write, test and ship code: each agent gets a delegated identity, actions are denied by default, every call is checked against policy outside the model, humans approve risky steps, and every decision is logged.
Native controls cover the first mile of that list, inside one vendor. Here is what is still on you.
Cross-agent identity. Each tool authenticates a user or a seat. The factory needs a distinct identity per agent, bound to the human who delegated the work. Otherwise every log says "the developer did it." Revoking that human should cut off every agent acting for them on its next call, across every tool. A deny rule in one IDE's settings does not do that for a CLI, a CI job or a cloud agent.
Delegated, human-capped permissions. Agents get useful fast when they inherit the developer's shell, tokens and MCP sessions. Inheriting them is the anti-pattern. Least privilege means the agent starts with nothing and gets a time-boxed grant scoped to the task, never more than the delegating human has. Vendor allowlists narrow tools and hosts for one client. They do not issue a grant that follows the agent from tool to tool.
Policy outside the model. Guardrails in a prompt are suggestions. Policy outside the model is a guarantee. Claude Code auto, Codex auto_review and Cursor Auto-review are all models in the loop. Useful, and still not a policy decision you can version, test and enforce the same way at the process, tool, API, app and data layers. Claude Code managed settings, Cursor team controls, Codex managed configuration and the Copilot coding agent firewall are worth turning on. They govern one tool each.
Human approval that a factory can run. A desktop tool can prompt the person at the keyboard. A factory needs human approvals for risky steps that work for headless jobs, not only prompts in a desktop session.
One decision log. Who delegated, which agent, which tool, which resource, allow, deny or approval, who approved, why and when. Per-vendor telemetry and PR comments do not add up to that record, as the worked example shows.
The software factory security blueprint walks through that model end to end. Permit.io's Coding Agents Gateway is the endpoint control for the agent process, so the check does not live only inside one vendor's settings file.
Keep the native controls. Then put identity, policy, approval workflows and the decision log where they apply to every agent in the factory, not just one vendor's client.
Bash, PowerShell and Monitor commands and the processes they start, once sandbox.enabled is true. It is off by default. Read, Edit, Write, WebFetch, WebSearch, command hooks and local MCP servers run outside it. Source: Claude Code sandboxing.
For interactive terminal and VS Code sessions on v2.1.283 or later, yes, on every plan and provider. claude -p and Agent SDK sessions start in Manual. Admins can set permissions.defaultMode or disable modes in managed settings. Source: permission modes.
sandbox_mode is the technical boundary (read-only, workspace-write, danger-full-access). approval_policy is when Codex asks (on-request or never). The usual local pairing is workspace-write with on-request. Source: Codex sandbox.
No, and Cursor's docs say so. It is a convenience mode with a classifier that can be wrong in either direction. Use restricted Run Modes, sandbox.json and team network lists for enforcement. Source: Cursor Run Modes.
Internet access from the Copilot cloud agent (and Copilot code review) inside its Actions runner or cloud sandbox: processes started through the Bash tool and, in cloud sandboxes, the built-in Playwright MCP server. Not other MCP servers, not setup-step processes. Source: customizing the firewall.
Because they are per-tool. A factory running Claude Code, Cursor, Codex and a Copilot cloud agent side by side still needs one delegated identity per agent, a policy check outside any model, human approval for headless jobs and one decision log. Native controls are the floor inside each product, not that shared layer.

Co-Founder & VP of R&D at Permit.io