#[non_exhaustive]pub struct SandboxFilesystem {
pub allow_write: Option<Vec<String>>,
pub deny_write: Option<Vec<String>>,
pub deny_read: Option<Vec<String>>,
pub allow_read: Option<Vec<String>>,
pub allow_managed_read_paths_only: Option<bool>,
pub disabled: Option<bool>,
pub extra: Extra,
}Expand description
sandbox.filesystem.
Control which paths sandboxed commands can read and write. By default they can write to the
working directory, the per-user temp directory, and directories you add with --add-dir,
/add-dir, or permissions.additionalDirectories, and can read the rest of the filesystem,
including credential files.
Docs: sandbox.filesystem.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.allow_write: Option<Vec<String>>Add paths where sandboxed commands can write, beyond the working directory, the per-user
temp directory, and the directories you’ve added with --add-dir, /add-dir, or
permissions.additionalDirectories. Use it when a subprocess such as kubectl or a
build tool needs to write outside the project.
- Values: array of path strings, using the sandbox path prefixes
- Default: unset, so sandboxed commands can write to the working directory, the
per-user temp directory, directories you’ve added with
--add-diror/add-dir, and directories inpermissions.additionalDirectories - Scope: any settings file, with limits on project and local settings.
Docs: allowWrite.
deny_write: Option<Vec<String>>Block sandboxed commands from writing to specific paths, including paths inside a directory that is otherwise writable.
- Values: array of path strings, using the sandbox path prefixes
- Default: unset
- Scope: any settings file.
Docs: denyWrite.
deny_read: Option<Vec<String>>Block sandboxed commands from reading specific paths, such as credential files that the
default read policy would otherwise expose. To protect a credential file and keep it
usable through the sandbox proxy, see
sandbox.credentials
instead.
- Values: array of path strings, using the sandbox path prefixes
- Default: unset, so sandboxed commands keep the default read
access, which
includes credential files such as
~/.aws/credentials - Scope: any settings file.
Docs: denyRead.
allow_read: Option<Vec<String>>Re-open reading for specific paths inside a region that
denyRead
blocks, to build workspace-only read access. An exact or wildcard denyRead entry stays
blocked inside a broader allowRead, as the overlap
table shows. When a
wildcard denyRead entry such as ~/**/.env matches a directory, Claude Code blocks
reads of its contents as well.
- Values: array of path strings, using the sandbox path prefixes
- Default: unset
- Scope: any settings file, with limits on project and local settings.
Docs: allowRead.
allow_managed_read_paths_only: Option<bool>Honor only the
allowRead
entries that come from managed settings, so developers can’t re-open read access to
paths your organization blocked. Claude Code still merges denyRead entries from every
settings scope the session loads.
- Values: Boolean
true: Claude Code honors only theallowReadentries from managed settingsfalse:allowReadentries from other settings files can merge in
- Default:
false - Scope: managed.
Docs: allowManagedReadPathsOnly.
disabled: Option<bool>Skip filesystem isolation while keeping network isolation. Sandboxed commands get
unrestricted read and write access to the host filesystem, and their network egress
stays confined to
network.allowedDomains.
Use it when you sandbox to control where commands connect rather than what they write.
- Values: Boolean
true: Claude Code skips filesystem isolation and keeps network isolationfalse: filesystem isolation stays on
- Default:
false, so filesystem isolation stays on - Scope: user or managed. When managed settings configure
sandbox.filesystemat all, or list asandbox.credentials.filesentry with"mode": "deny", only managed settings can set it.
Docs: disabled.
extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.