Is Claude Code safe? What it can do on your Mac and how to limit it
Is Claude Code safe? For everyday work, yes, if you set a few limits yourself. It runs on your Mac and can reach whatever your user account can. Keep it out of bypassPermissions, the no-prompt mode behind the --dangerously-skip-permissions flag. Turn on the sandbox, deny reads of your secrets, start it inside a project folder and vet each extra tool server you connect.
An agent with shell access deserves a careful look. This page covers what Claude Code can reach on your Mac, what it sends to Anthropic and five settings that shrink the risk. Whether Claude Code is safe for you depends on three things: the mode you run in, what sits in the project folder and what the agent reads from outside. For the company behind it, see is Claude safe.
01What Claude Code can touch on your Mac
It runs locally, so an approved command can reach what your user account reaches. The permission system decides how much of that it does without asking.
Since v2.1.283, interactive terminal and VS Code sessions start in auto mode. There, a separate classifier model, a second AI model, reviews actions before they run. The docs say auto mode does not guarantee safety. What it blocks and allows is listed on the auto mode page.
The other starting point is manual mode, whose config value is default. It begins with read-only permissions and asks before edits, tests and commands. Press Shift+Tab to switch the mode of your session. The table shows manual mode.
| Area | In manual mode |
|---|---|
| Project files | Reads need no approval inside the working directory. File edits need approval. |
| Shell commands | Approval required, except a built-in set of read-only commands. |
| Outside the project folder | The folder boundary is only a permission prompt. An approved Bash command can write anywhere your user account can. |
| Network | Prompts and model outputs travel over the network, encrypted with TLS 1.2 or newer. |
| Extra tool servers | MCP servers, programs that give the agent extra tools, run outside the sandbox. |
| Sandbox | Off by default. |
02What the vendor promises and what it does not
Two questions sit under "can I trust it". Does the program behave as documented, and does the vendor deal with problems in the open?
Permission rules are enforced by Claude Code itself, not by the model. The sandbox is enforced by the operating system and holds regardless of what the model chose to run. It is built on the open-source @anthropic-ai/sandbox-runtime.
Anthropic publishes security advisories for Claude Code, and fixes reach auto-updating users automatically, while people who update by hand must do it themselves. The list is on Claude Code security. For its commercial products Anthropic lists ISO 27001:2022, ISO/IEC 42001:2023, SOC 2 Type I and II, and a HIPAA-ready configuration.
Anthropic reviews connectors against listing criteria but does not security-audit any MCP server. Treat each one like software you install from a stranger.
03Does Claude Code take your data?
It has to send some, because the model runs on Anthropic's servers. Here is what moves and what stays.
| Data | Where it goes | How long |
|---|---|---|
| Prompts and model outputs | Over the network, TLS 1.2 or newer. | See the training rules below. |
| Session transcripts | Stored on your Mac in plain text under ~/.claude/projects/. | 30 days by default. |
Transcripts you share with /feedback, /bug or /share | Shared by you on purpose. | Retained for 5 years. |
Training is a separate question. People on Free, Pro, Max and Ultra accounts can choose whether their data trains future models, and Claude Code use from those accounts counts when the setting is on. On commercial plans (Team, Enterprise, the API and third-party platforms), Anthropic does not train on code or prompts sent to Claude Code unless the customer opted in. Because transcripts sit in plain text, treat that folder like any other file that may hold what you pasted into a session.
04Is it safe to give Claude Code access to your files?
Safe enough in a project folder, riskier anywhere broader. When you start it in a folder you have not trusted, an interactive session shows the workspace trust dialog. If you start from your home directory, the trust you grant lasts for that session only, so the docs advise starting from a project subdirectory, where trust is saved per directory.
The sandbox, once on, limits writes to the working directory, the temp directory and directories you add. Reads are wider: the whole computer except denied directories, and credential files stay readable. Environment variables are inherited too, secrets included. So keep keys out of the folder and out of your shell environment while an agent runs.
05Can Claude Code delete your files?
Yes, a shell command it runs can. One public issue reports rm -rf deleting all user files in a home directory on 21 October 2025. Claude Code does not auto-approve recognized critical-path rm and rmdir removals in any mode, bypassPermissions included, though in bypassPermissions you can turn that prompt off.
Some edits can be rolled back. Claude Code tracks edits made by its file editing tools, and /rewind or /undo opens the rewind menu. A file changed only by a Bash command is not tracked, so use Git. Commit before a long session.
06Five settings that make it safer
Check your setup against these five and change what fails. Each one limits a different kind of damage: wrong edits, leaked secrets, a hostile repository or an untrusted tool server.
- Stay out of bypassPermissions. The
--dangerously-skip-permissionsflag is equivalent to--permission-mode bypassPermissions. The docs reserve it for isolated environments such as containers and VMs. You can disable the mode by settingpermissions.disableBypassPermissionsModeto"disable"in any settings file. The flag's abuse in the s1ngularity supply-chain attack is told on the skip permissions page. - Deny reads of your secrets. A deny rule such as
Read(./.env)matches reads of the.envfile, and deny rules block in every mode. Treat a rule as a strong guard against honest mistakes, not a wall against a prompt-injected agent. Prompt injection means hostile text that the agent reads and treats as instructions. A deny rule also does not match the same program called by path or insidesh -c. Rule syntax is on Claude Code permissions. - Turn on the sandbox. Run this inside Claude Code:
/sandboxYou can also set sandbox.enabled to true in settings. On macOS it uses Seatbelt, a built-in macOS feature that limits what a process can touch. It covers shell commands only, and the docs call it a risk reducer, not a complete isolation boundary. Details: Claude Code sandbox.
- Start from a project folder. Not from your home directory.
- Vet every MCP server. Verify that you trust each one before connecting it. A cloned repository cannot approve its own MCP servers.
07So, is Claude Code safe?
Is Claude Code safe? Yes, when you set the limits yourself. The vendor side is documented: local execution, an OS-enforced sandbox you have to switch on, public advisories and certifications listed for Anthropic's commercial products. What stays with you is which mode you run in and which secrets sit within reach.
Settings decide what Claude Code may do; they don't show what actually ran on your Mac. Artificial Immunity's free, open-source core watches Claude Code sessions, MCP servers and every program start, and reports what it finds without blocking anything.
Other tools get the same treatment: Cursor, Codex, Copilot. The broader setup guide is how to run Claude Code safely, and the agent-wide view is AI agent security. Start from the home page for the rest.
FAQ
Is Claude Code safe?
For everyday work, yes, if you keep it out of bypassPermissions, the no-prompt mode that the docs reserve for isolated environments. The remaining risk is that an approved Bash command can write anywhere your user account can.
Can I trust Claude Code?
Trust it for what the docs promise. The sandbox is enforced by the operating system whatever the model chose to run, and permission rules are enforced by Claude Code, not by the model. Do not extend that trust to MCP servers, because Anthropic does not security-audit them.
Does Claude Code take your data?
It sends all prompts and model outputs over the network. Free, Pro, Max and Ultra users choose whether that data trains future models. On commercial plans Anthropic does not train on it unless the customer opted in.
Is Claude Code secure?
Anthropic publishes security advisories, and fixes reach auto-updating users automatically. The sandbox is off by default, so secure here mostly means that you turn it on and keep permission prompts on.
Is it safe to give Claude Code access to my files?
Give it a project folder, not your home directory. If you start from your home directory, the trust you grant lasts for that session only, so the docs say to start from a project subdirectory instead.
Can Claude Code delete my files?
Yes, a shell command can. One public issue reports rm -rf deleting all files in a home directory on 21 October 2025. Claude Code does not auto-approve recognized critical-path rm and rmdir removals in any mode, bypassPermissions included, though in bypassPermissions you can turn that prompt off.
Is it safe to run Claude Code with the skip-permissions flag?
Only inside an isolated environment such as a container or VM. The flag is the same thing as the bypassPermissions mode.
Related guides
Sources
- Claude Code docs, security
- Claude Code docs, permission modes
- Claude Code docs, permissions
- Claude Code docs, sandboxing
- Claude Code docs, data usage
- Claude Code docs, MCP
- Claude Code docs, checkpointing
- Claude Code security advisories
- Claude Code issue 10077
- Anthropic help center, certifications
- Wiz, s1ngularity supply-chain attack
- Artificial Immunity