Skip to content
$ shellfirm

shellfirm sandbox

Turn on an AI agent's own OS sandbox and deny it the credential files shellfirm protects.

shellfirm sandbox writes deny rules into the OS sandbox of Claude Code or Codex CLI: sandboxed commands, and every process they start, cannot read SSH and GPG keys, cloud and registry credentials, token files and keychains, nor write shell startup files, SSH and git config, autostart entries, AI-agent settings and shellfirm's own configuration. Existing settings are kept and merged; nothing is weakened.

Output
Usage: shellfirm sandbox [OPTIONS] [agent]

Arguments

ArgumentDescription
[agent]claude-code or codex. gemini-cli and copilot-cli (also gemini and copilot, as in connect) and every other agent connect knows (Cursor, Qwen Code, Windsurf, Cline, OpenCode, Zed) are accepted and print why they are not supported (exit 2)
AgentWhat is written
claude-codesettings.json sandbox: enabled, filesystem.denyRead, filesystem.denyWrite. --scope user (~/.claude/settings.json, or $CLAUDE_CONFIG_DIR/settings.json; default), project (.claude/settings.json, shared), local (.claude/settings.local.json; keep it out of git)
codex~/.codex/config.toml: a shellfirm permission profile extending the built-in one (or your own selected profile gets the entries), "deny" for credential paths and "read" for protected ones. User scope only

Options

OptionDescription
--config-dir <DIR>Use the shellfirm configuration in DIR (settings, custom checks, audit log)
--listShow which agents are supported and the paths that would be denied
--scope <scope>Claude Code: user (default), project (shared .claude/settings.json) or local (.claude/settings.local.json)
--dry-runShow what would change without writing anything
--removeRemove the entries shellfirm added (only those; other settings are kept). Alias --uninstall
-h, --helpPrint help

What shellfirm adds is recorded in sandbox.json in its configuration directory, so --remove takes out exactly that. Change the path lists with sandbox.deny_read, sandbox.deny_write and sandbox.exclude in settings.yaml: a re-run also takes out entries an exclude now leaves out, .. is resolved, a relative path is skipped with a warning, and /, your home directory or a directory above it, an empty entry and an unexpanded $VAR are refused. Settings of yours that re-open a denied path (an allowRead / allowWrite entry in any Claude Code scope, a weaker Codex entry on or inside a denied path) are reported by the command and by status / doctor; shellfirm does not change them. At --scope project / local, a settings file or directory that is a symlink out of the project is refused. Every change writes a backup first; the newest 3 of each file are kept.

Examples

shellfirm sandbox --list                        # supported agents and the path lists
shellfirm sandbox claude-code --dry-run         # show the change, write nothing
shellfirm sandbox claude-code                   # ~/.claude/settings.json
shellfirm sandbox claude-code --scope project   # .claude/settings.json (shared with the team)
shellfirm sandbox codex                         # ~/.codex/config.toml ($CODEX_HOME)
shellfirm sandbox claude-code --remove          # take out exactly what shellfirm added

shellfirm sandbox --list (trimmed):

Output
AI agents `shellfirm sandbox` can configure:

  claude-code  Claude Code (supported)
      settings.json `sandbox`: enabled, filesystem.denyRead, filesystem.denyWrite (scopes: user ~/.claude/settings.json, project .claude/settings.json, local .claude/settings.local.json). The sandbox covers Bash commands and everything they start; macOS uses Seatbelt, Linux/WSL2 need bubblewrap and socat; native Windows has no sandbox.

  codex        Codex CLI (supported)
      ~/.codex/config.toml (or $CODEX_HOME): a permission profile ([permissions.<name>.filesystem], "deny" = no access, "read" = read-only) selected with default_permissions; user scope only. A `--sandbox` / `--dangerously-bypass-approvals-and-sandbox` flag on the codex command line replaces the profile for that run.

  gemini-cli   Gemini CLI
      not supported: its sandbox is switched on per run (--sandbox, GEMINI_SANDBOX) and the macOS Seatbelt profile is chosen with the SEATBELT_PROFILE environment variable; there is no settings key for deny-read paths, so it would need a hand-written .sb profile.

  copilot-cli  GitHub Copilot CLI
      not supported: it has tool permissions (--allow-tool / --deny-tool, trusted folders) but no OS sandbox with file deny rules that shellfirm could configure.

Paths sandboxed commands may not read (39):
  ~/.ssh
  ~/.aws
  ~/.gnupg
  ...

Paths sandboxed commands may not write (26):
  ~/.bashrc
  ~/.bash_profile
  ...

Change the lists in settings.yaml: sandbox.deny_read and sandbox.deny_write add paths, sandbox.exclude leaves built-in entries out. Project .env files are not listed (their reads are not flagged); add them with sandbox.deny_read if you want.

Exit codes

CodeMeaning
0Done (or nothing to change)
1Refused or failed, nothing written: for example Codex runs without a sandbox (danger-full-access, also through the active [profiles.<name>] or a permission profile extending :danger-full-access), a refused deny_read / deny_write entry (/, the home directory or above it, empty, $VAR), a settings file that is a symlink out of the project, a settings path that is not a regular file (a FIFO), a record of what was added that cannot be saved (the settings file is then left unchanged), a settings file that cannot be written (read-only), or one that cannot be parsed
2Usage error: no agent, an unsupported agent, or --scope project / local for codex
Terminal
$ shellfirm sandbox codex
Error: Codex is set to run without a sandbox (sandbox_mode = "danger-full-access" in /home/dev/.codex/config.toml); shellfirm does not change that. Choose workspace-write or read-only first, then re-run.