Different Layers of Protection
| Sandboxing | CC Safety Net | |
|---|---|---|
| Enforcement | OS-level (Seatbelt/bubblewrap) | Application-level (PreToolUse hook) |
| Approach | Containment — restricts filesystem + network | Command analysis — blocks destructive operations |
| Filesystem | Writes restricted (default: cwd); reads are broad | Only destructive operations blocked |
| Network | Domain-based proxy filtering | None |
| Git awareness | None | Explicit rules for destructive git operations |
| Bypass resistance | High — OS enforces boundaries | Lower — analyzes command strings only |
Why Sandboxing Isn’t Enough
Sandboxing restricts where you can write, but it doesn’t understand whether an operation is destructive within those boundaries. The following commands are all permitted by the sandbox because they operate inside the current working directory:Whether these commands are auto-run or require confirmation depends on your sandbox mode (auto-allow vs regular permissions), and network access still depends on your allowed-domain policy. Claude Code can also retry a command outside the sandbox via
dangerouslyDisableSandbox (with user permission); you can prevent this by setting allowUnsandboxedCommands: false.| Command | Sandboxing | CC Safety Net |
|---|---|---|
git reset --hard | Allowed (within cwd) | Blocked |
git checkout -- . | Allowed (within cwd) | Blocked |
git stash clear | Allowed (within cwd) | Blocked |
git push --force | Allowed (if remote domain allowed) | Blocked |
rm -rf . | Allowed (within cwd) | Blocked |
Sandboxing sees
git reset --hard as a safe operation — it only modifies files within the current directory. But your AI agent just discarded all of your uncommitted work.When Sandboxing Is the Better Choice
Sandboxing is the right tool when your primary concern is:- Prompt injection attacks — reduces exfiltration risk by restricting outbound network domains
- Malicious dependencies — limits filesystem writes and network access from untrusted packages
- Untrusted code execution — OS-level containment is fundamentally stronger than pattern matching
- Network control — CC Safety Net has no network protection at all
