Repository navigation
Description
Problem
mocactl sbx claude is meant to start a Claude Code session confined to the sandbox. It doesn't: Claude Code's built-in tools stay enabled and run on the user's own machine, alongside the sandbox's MCP tools.
Reproduced with Claude Code 2.1.306, run outside a repository where sbx up had been run:
mocactl sbx claude --sandbox sbx-5aab68c99752622d647e1b69ceThe session could see and run tools on both the sandbox and the local Mac.
Cause
claudeArgs() (packages/mocactl/src/sbx/claude.ts:55) passes only:
--mcp-config '{"mcpServers":{"sandbox":…}}' --strict-mcp-config
--strict-mcp-config limits which MCP servers load. It has no effect on Claude Code's built-in tools (Bash, Read, Edit, Write, Glob, Grep, …). Those are turned off only by the permissions.deny list (CLAUDE_DENY, packages/mocactl/src/sbx/agent-config.ts:50). sbx up writes that list into the repository's .claude/settings.json; sbx claude doesn't apply it.
So sbx claude contains the agent only when it's started in a repository where sbx up already wrote the deny list. Anywhere else, including the --sandbox ID case, the local tools stay enabled.
The code and docs say the opposite:
claude.ts:27: "--strict-mcp-configalso means the session loads no MCP server but this one. That is the same containmentupapplies when it denies the local tools". It isn't the same containment.docs/sbx/user-guide.md:98lists "mocactl sbx claude, per run" next to "Denied (permissions.deny)" in the agent table.- The
sbx claudehelp text (packages/mocactl/src/sbx/cli.ts:66) doesn't mention the local tools. A user reasonably assumes they're off.
Impact
A user who chose sbx claude to keep an agent off their machine gets an agent that can read, write and run commands on it. Nothing warns them.
Proposed fix
claudeArgs()always passes--disallowed-toolswithCLAUDE_DENYas one comma-separated value. A single value matters because the flag is variadic: a prompt in the caller's arguments must not be read as a tool name. Containment then doesn't depend on the directory or onsbx up.- Check how this interacts with
sbx up --cortex. In Cortex modeupleaves the local tools to Cortex rather than denying them, sosbx claudein a Cortex-mode repository may need to skip the flag (sbx up's agent config: the CLAUDE.md steering never loads (Read deny), and stale deny names warn on every startup #568). - Correct the
claude.tscomment, thesbx claudehelp text, and the user-guide table and its "mocactl sbx claudeasks none of this but the folder trust" section. - Tests:
claudeArgs()includes the deny flag with everyCLAUDE_DENYname, and the caller's arguments after--don't extend it. - Consider having
sbx doctorflag aclaudetoo old to accept--disallowed-tools.
The known cost: with Read denied, Claude Code won't load the project's CLAUDE.md. sbx up already accepts that trade-off (#568).
Workaround
Pass the deny list through to claude:
mocactl sbx claude --sandbox <ID> -- \
--disallowed-tools "Bash,Read,Edit,Write,Glob,Grep,NotebookEdit,WebFetch,WebSearch,Agent,Task,EnterWorktree,ExitWorktree,Workflow,Monitor,PowerShell,LSP"Or run mocactl sbx up in the repository first and start sbx claude from there.
Activity
fix(mocactl): sbx claude denies Claude Code's local tools (rossoctl#702…