Skip to content

[Feature] Add configurable sandbox write paths (additionalWriteDirectories) #22628

Description

@olearydj

Summary

There's no way to configure sandbox write paths for bash commands. Write paths are hardcoded, and additionalDirectories only grants read access.

Background

This was discussed in #10377 (now closed/locked). A commenter found the write paths are hardcoded:

B = [
    "/dev/stdout", "/dev/stderr", "/dev/null", "/dev/tty",
    "/dev/dtracehelper", "/dev/autofs_nowait",
    "/tmp/claude", "/private/tmp/claude",
    iJ.join(A, ".npm/_logs"), iJ.join(A, ".claude/debug"),
    ".",
]

Reproduction

Config:

{
  "permissions": {
    "allow": ["Edit(/Volumes/Casa/**)"]
  },
  "sandbox": {
    "enabled": true,
    "autoAllowBashIfSandboxed": true,
    "additionalDirectories": ["/Volumes/Casa"]
  }
}

Result:

$ touch /Volumes/Casa/test.txt
# Operation not permitted

$ mv /tmp/claude/file.txt /Volumes/Casa/file.txt
# Operation not permitted

Expected behavior

additionalDirectories should grant both read and write access, or there should be a separate additionalWriteDirectories setting.

Current workarounds

  • Use Edit/Write tools instead of bash (requires read+write, inefficient)
  • Ask user to run the command
  • Add to excludedCommands (security tradeoff)

Proposal

The underlying sandbox-runtime already supports filesystem.allowWrite. Expose this in Claude Code settings, e.g.:

{
  "sandbox": {
    "additionalWriteDirectories": ["/Volumes/Casa", "/path/to/other"]
  }
}

Or make additionalDirectories grant write access too (simpler, matches user expectation).

Environment

  • macOS Darwin 24.5.0
  • Claude Code (latest as of 2026-02-02)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions