Skip to content

sbx claude does not deny Claude Code's local tools: the agent can act on the user's machine #702

Closed

Description

@esnible

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-5aab68c99752622d647e1b69ce

The 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-config also means the session loads no MCP server but this one. That is the same containment up applies when it denies the local tools". It isn't the same containment.
  • docs/sbx/user-guide.md:98 lists "mocactl sbx claude, per run" next to "Denied (permissions.deny)" in the agent table.
  • The sbx claude help 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-tools with CLAUDE_DENY as 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 on sbx up.
  • Check how this interacts with sbx up --cortex. In Cortex mode up leaves the local tools to Cortex rather than denying them, so sbx claude in 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.ts comment, the sbx claude help text, and the user-guide table and its "mocactl sbx claude asks none of this but the folder trust" section.
  • Tests: claudeArgs() includes the deny flag with every CLAUDE_DENY name, and the caller's arguments after -- don't extend it.
  • Consider having sbx doctor flag a claude too 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

  1. self-assigned this
    on Nov 9, 2026
  2. added
    bug
    on Nov 9, 2026
  3. added
    ready-for-ai-review
    on Nov 9, 2026
  4. added this to the v0.11.0 milestone on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugready-for-ai-review

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions