pub struct SandboxConfig {
pub enabled: bool,
pub profile: SandboxProfile,
pub allow_read: Vec<PathBuf>,
pub allow_write: Vec<PathBuf>,
pub strict: bool,
pub backend: String,
pub denied_domains: Vec<String>,
pub fail_if_unavailable: bool,
}Expand description
OS-level subprocess sandbox configuration ([tools.sandbox] TOML section).
When enabled = true, all shell commands are wrapped in an OS-native sandbox:
- macOS:
sandbox-exec(Seatbelt) with a generatedTinySchemeprofile. - Linux (requires
sandboxcargo feature):bwrap+ Landlock + seccomp BPF.
This sandbox applies only to subprocess executors (shell). In-process executors
(WebScrapeExecutor, FileExecutor) are not covered — see NFR-SB-1.
§Examples
[tools.sandbox]
enabled = true
profile = "workspace"
allow_read = ["$HOME/.cache/zeph"]
allow_write = ["./.local"]
strict = true
backend = "auto"Fields§
§enabled: boolEnable OS-level sandbox. Default: false.
On Linux requires the sandbox cargo feature. When true but the feature is absent,
startup emits WARN and degrades to noop (fail-open). Use strict = true to
make the feature absence an error instead.
profile: SandboxProfileEnforcement profile controlling the baseline restrictions.
allow_read: Vec<PathBuf>Additional paths granted read access. Resolved to absolute paths at startup.
allow_write: Vec<PathBuf>Additional paths granted write access. Resolved to absolute paths at startup.
strict: boolWhen true, sandbox initialization failure aborts startup (fail-closed). Default: true.
backend: StringOS backend hint: "auto" / "seatbelt" / "landlock-bwrap" / "noop".
"auto" selects the best available backend for the current platform.
denied_domains: Vec<String>Hostnames (or single-level wildcard patterns) denied network egress from sandboxed subprocesses. Enforcement is platform-specific:
- macOS Seatbelt: injects
(deny network* (remote host "<host>"))rules after(allow network*)so Seatbelt’s last-rule-wins semantics block the listed hosts. - Linux bwrap: mounts a synthetic
/etc/hoststhat resolves denied names to0.0.0.0. This is best-effort — processes using custom DNS clients, IP literals, or HTTP proxies can bypass this filter.
On NoopSandbox (unsupported platform), denied domains cannot be enforced.
See fail_if_unavailable to make that a startup error instead of a warning.
Patterns follow the same syntax as [tools.scrape].denied_domains:
exact hostname or *.suffix (single subdomain level).
When true, failure to activate an effective OS sandbox (noop selected, backend
missing, or platform unsupported) aborts startup with an error.
This is stricter than strict: strict only gates missing backend binary errors,
while fail_if_unavailable additionally rejects NoopSandbox selection (e.g. on an
unsupported platform). Default: false.
Implementations§
Source§impl SandboxConfig
impl SandboxConfig
Sourcepub fn validate_denied_domains(&self) -> Result<(), String>
pub fn validate_denied_domains(&self) -> Result<(), String>
Validate denied_domains entries.
Each entry must contain only alphanumeric characters, dots, hyphens, and an
optional leading * wildcard. Returns Err with a descriptive message on the
first invalid entry.
§Errors
Returns an error string when any pattern contains invalid characters.
Trait Implementations§
Source§impl Clone for SandboxConfig
impl Clone for SandboxConfig
Source§fn clone(&self) -> SandboxConfig
fn clone(&self) -> SandboxConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more