pub struct SandboxConfig {
pub backend: String,
pub writable_paths: Vec<String>,
}Expand description
OS-level sandbox configuration for shell-executing tools.
Serializes as the sandbox object in the global settings.json only:
{
"sandbox": {
"backend": "bwrap",
"writable_paths": ["/tmp/build-cache"]
}
}The default is SandboxConfig::auto — sandbox with whatever backend is
installed, bwrap preferred. Sandboxing shell commands is the baseline, and
turning it off is a deliberate act: --no-sandbox on the command line, or
{"backend": "off"} in the global settings file.
This block is deliberately absent from .tinyharness/config.json
(ProjectSettings has no sandbox field). A project config is shipped
inside the repository, so honouring it would let any cloned repo downgrade
the user’s chosen containment — including switching the sandbox off
entirely. Unknown keys are ignored by serde, so a stray sandbox block in
a project file has no effect.
backend is required whenever the sandbox object is present, and
accepts auto (use whatever is installed, bwrap preferred), bwrap,
firejail, or off. See
SandboxBackend. Requiring it is
deliberate: a block like {"sandbox": {"writable_paths": ["/tmp/x"]}}
states an intention to be sandboxed without naming a backend, and silently
defaulting that to off would leave the user unprotected while believing
otherwise. Omit the whole sandbox key to get SandboxConfig::auto.
There is deliberately no network setting: sandboxed commands always
have the network. A coding agent runs git fetch, curl, and cargo add
constantly, so a knob that would break those is not worth exposing.
Extra host directories come from the top-level allowed_paths setting,
which also drives the built-in file tools’ path guard (those tools run
in-process, so the guard is their only confinement); only write access
inside the sandbox is configured here.
Fields§
§backend: StringBackend selector: off | auto | bwrap | firejail. Required
whenever a sandbox block is present.
writable_paths: Vec<String>Extra host directories sandboxed commands may write.
Deliberately separate from allowed_paths: that setting also feeds the
path guard confining the built-in file tools, and those tools run
in-process, so granting it write access would widen their reach too.
Anything here is reachable only by sandboxed shell commands.
Implementations§
Source§impl SandboxConfig
impl SandboxConfig
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
true when no sandboxing is requested.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
true when a sandbox (auto-detected or explicit) is requested.
Trait Implementations§
Source§impl Clone for SandboxConfig
impl Clone for SandboxConfig
Source§impl Debug for SandboxConfig
impl Debug for SandboxConfig
Source§impl Default for SandboxConfig
impl Default for SandboxConfig
Source§impl<'de> Deserialize<'de> for SandboxConfig
impl<'de> Deserialize<'de> for SandboxConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SandboxConfig
Source§impl PartialEq for SandboxConfig
impl PartialEq for SandboxConfig
Source§impl Serialize for SandboxConfig
impl Serialize for SandboxConfig
impl StructuralPartialEq for SandboxConfig
Auto Trait Implementations§
impl Forget for SandboxConfig
impl Freeze for SandboxConfig
impl RefUnwindSafe for SandboxConfig
impl Send for SandboxConfig
impl Sync for SandboxConfig
impl Unpin for SandboxConfig
impl UnsafeUnpin for SandboxConfig
impl UnwindSafe for SandboxConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.