Get the free coreGet core

--dangerously-skip-permissions: what it does and how to keep your Mac safe

Updated 6 min readSection 01 / Agent permissions
SHORT ANSWER

--dangerously-skip-permissions is the same as starting Claude Code with --permission-mode bypassPermissions. It removes the approval prompt, and checks on protected paths are skipped too; only a few actions that no mode auto-approves still apply. Anthropic's docs reserve this mode for isolated environments such as containers, VMs and dev containers without internet access. On your main Mac, a wrong command runs with the rights of your user account. If you only want fewer prompts, use allow rules or auto mode instead.

risk-check · 2 stepsClaude CodeCursorCodexGemini CLI / Asks before each actionAuto-accepts editsSkips all permissions, on my main MacInside a sandbox, container or VM
1Which agent
2How it runs
LOWAsks before each action: You see each command before it runs. Read the prompt before you press y, and keep the project in git.
MEDIUMAuto-accepts edits: File edits go through without a question. Commit before you start so you can roll back, and keep secrets out of the project folder.
HIGHSkips all permissions, on my main Mac: Nothing asks you before a command runs. Run it only in a container or VM with no secrets, not on your main Mac.
LOWInside a sandbox, container or VM: Low if nothing secret is inside. Check that your keys, ~/.ssh and cloud credentials are not mounted into the container or VM.
Get the free coreQuiet until it matters. You decide.

01What the flag turns off

Claude Code has a start mode that decides how much it asks. Which one you get depends on the version: since v2.1.283 interactive terminal and VS Code sessions start in auto mode. Manual mode, whose config value is default, asks before Bash commands except a built-in set of read-only ones. Each prompt is a moment where you see the command before it runs.

The flag skips that moment. What replaces the prompt is "Nothing. Protected path checks are also skipped; the actions no mode auto-approves still apply". Protected paths include the .git and .claude folders, so writes there go through without a question. An approved command can write anywhere your user account can, so with no approval step that is the working rule for everything Claude runs.

The flag only works if you pass it at launch: you cannot switch into this mode from a session that started without it. The first interactive start shows a warning dialog that asks you to accept responsibility. The CLI also refuses the flag when it runs as root, the all-powerful system account.

Two things still hold with the flag on:

Instructions in your prompt or CLAUDE.md are not on this list. Permission rules are enforced by Claude Code itself, not by the model.

02What can go wrong on your main Mac

Public cases show the pattern.

What happenedWhereWhat it shows
Claude Code ran a recursive delete that removed all user files in a home directory; the reporter saw it run and interrupted it too lateGitHub issue #10077, October 2025One command is enough to do the damage
A Cursor user running YOLO mode reported the agent ended up "deleting everything on my computer, including itself"Cursor forumThe same failure in another tool with prompts off
The s1ngularity malware prompted AI command-line tools already installed on the machine with --dangerously-skip-permissions, --yolo and --trust-all-toolsWiz researchAttackers know the flag names

The s1ngularity case shows how. It was a supply-chain attack, meaning a poisoned package that arrives through a tool you trust. Its payload ran on Linux and macOS and searched for wallets, keystores, .env files and SSH keys. It did not need to break anything: it asked your own agent to look for files, using the flags that skip the approval step. It succeeded in hundreds of cases, although the AI providers' guardrails at times interceded.

A malicious repository once had a way to switch bypass mode on for you. An advisory, CVE-2026-33068 (a public number for a security hole), describes a repo whose committed .claude/settings.json set permissions.defaultMode to bypassPermissions and silently skipped the trust dialog. That was an older version. The current docs say that bypassPermissions set in project .claude/settings.json or settings.local.json does not take effect and the session starts in Manual mode. Keep Claude Code updated anyway. The full advisory list is on the Claude Code security page.

03When --dangerously-skip-permissions is reasonable

The docs give one answer: isolated containers, VMs and dev containers without internet access. A dev container is a Docker container your editor opens your project in. Claude's commands execute inside it rather than on your Mac, while edits to project files appear in your local repository. Anthropic says the flag is acceptable there because the container runs Claude Code as a non-root user and confines command execution to the container.

A good setup has three properties:

  1. No secrets inside. Do not mount ~/.ssh or cloud credential files into the container. Use repository-scoped or short-lived tokens.
  2. A limit on outgoing traffic. The docs say to pair the flag with network egress restrictions, meaning rules about which servers the container may contact, to limit what a bypassed session can reach. The reference container ships an init-firewall.sh script that allows outbound traffic only to listed destinations.
  3. Trusted code. Use dev containers only with repositories you trust, and monitor what Claude does.

A container is not a safe room. Claude can still modify any file in the mounted project folder, and those changes appear on your Mac. The container also does not prevent a malicious project from exfiltrating, which means sending out, anything reachable inside it, including the Claude Code credentials in ~/.claude. Commit before you start, so Git can bring files back.

Setup steps are not repeated here. They live in Claude Code devcontainer, and Docker specifics are in Claude Code in Docker.

04The flag, auto mode and the sandbox side by side

You may not need the flag at all. This table is the one place on the site that sets the options next to each other.

OptionWhat reviews each actionWhere it fits
Manual modeYouReviewing every action yourself, sensitive work
Auto modeA separate classifier, a second model that judges each proposed actionReduces prompts but does not guarantee safety
SandboxThe operating system; on macOS the built-in Seatbelt framework, a macOS feature that limits what a process can touchShell commands only; file tools, MCP servers and hooks run outside it
bypassPermissions (the flag)NothingIsolated containers and VMs only

Auto mode even blocks launching an agent loop started with this flag. What else it blocks and allows is listed once, on the Claude Code auto mode page. The sandbox is off by default. When it is on, Claude can retry a failed command outside it through an escape hatch called dangerouslyDisableSandbox. More: Claude Code sandbox and Claude Code permissions.

05The same flag in Codex

Codex has its own version: --dangerously-bypass-approvals-and-sandbox, with the alias --yolo. OpenAI's docs say to avoid it unless you are inside a dedicated sandbox VM. If Codex keeps asking and you only want fewer prompts, its workspace-write mode lets the agent edit inside the project and run routine local commands there. See Codex full auto.

06If something already went wrong

Stop the session first. Then work out what changed and what could have leaked.

  1. Files Claude edited. Run /rewind (or /undo) to open the rewind menu. A file changed only by Bash commands is not tracked, so use Git for it.
  2. Files in Git. Run git status and git diff to see the damage. git restore brings paths in the working tree back from a restore source.
  3. Files outside Git. On APFS disks, Time Machine keeps hourly local snapshots for up to 24 hours, even if your backup disk is not attached.
  4. Keys. Check which .env files and tokens the session could read. Rotate any key you cannot rule out, from a trusted system.

07Should you use the flag on your own Mac

No. Use --dangerously-skip-permissions inside a container or VM that holds no secrets and has a limit on outgoing traffic. Do not use it on the Mac where your SSH keys, cloud credentials and browser sessions live. If the goal is fewer clicks, allow rules, auto mode and the sandbox cut prompts, each with the limits listed above. Section overview: AI agent permissions. The slang around the flag is explained in Claude Code YOLO mode.

Whatever mode you choose, it helps to know what actually ran on the Mac. Artificial Immunity's free, open-source core watches Claude Code, Cursor, Codex, MCP servers and every program start, and reports what it finds without blocking anything.

FAQ

Is Claude Code dangerous with this flag?

It can be. With the flag on, Claude Code runs commands without asking, and an approved command can write anywhere your user account can. A container with no secrets limits the damage to the project folder and whatever is reachable inside it.

Why does Claude Code keep asking for permission?

In manual mode (config value default) it asks before Bash commands, except a built-in set of read-only ones. Allow rules cut the prompts without turning everything off.

What is the difference between auto mode and dangerously skip permissions?

Auto mode puts a separate classifier model in front of actions and blocks launching an agent loop started with this flag. The flag takes the prompt away and puts nothing in its place.

Do deny rules still work with the flag?

Yes. Deny rules block in every mode, including bypassPermissions, while allow rules have no effect there.

How do I enable it in the Claude desktop app?

The desktop app reads the same settings files as the CLI and applies the permission mode to new local sessions. You cannot switch into bypass mode from a session that started without it.

Is there a way to bypass Codex approvals?

Yes. Codex has --dangerously-bypass-approvals-and-sandbox, alias --yolo, and OpenAI's docs say to avoid it outside a dedicated sandbox VM.

Can a company stop developers from using the flag?

Yes. Admins can set permissions.disableBypassPermissionsMode to disable in managed settings.

Sources

  1. Claude Code docs: permission modes
  2. Claude Code docs: permissions
  3. Claude Code docs: sandboxing
  4. Claude Code docs: development containers
  5. Claude Code docs: hooks guide
  6. Claude Code docs: checkpointing
  7. Claude Code issue #10077
  8. Wiz: s1ngularity supply-chain attack
  9. OpenAI Codex docs: approvals and security
  10. Git: git-restore
  11. Artificial Immunity
Running with the flag on? Artificial Immunity watches the Mac where your agents work.Get the free core