Skip to main content

SandboxFilesystem

Struct SandboxFilesystem 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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.

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.

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 the allowRead entries from managed settings
    • false: allowRead entries 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 isolation
    • false: filesystem isolation stays on
  • Default: false, so filesystem isolation stays on
  • Scope: user or managed. When managed settings configure sandbox.filesystem at all, or list a sandbox.credentials.files entry with "mode": "deny", only managed settings can set it.

Docs: disabled.

§extra: Extra

Keys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.

Trait Implementations§

Source§

impl Clone for SandboxFilesystem

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SandboxFilesystem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SandboxFilesystem

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SandboxFilesystem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SandboxFilesystem

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SandboxFilesystem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SandboxFilesystem

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.