pub struct SandboxPolicy {
pub read_paths: Vec<PathPermission>,
pub write_paths: Vec<PathPermission>,
pub exec_paths: Vec<PathPermission>,
pub network: NetworkPolicy,
pub timeout: Option<Duration>,
pub allow_spawn: bool,
pub env_passthrough: Vec<String>,
pub flags: PolicyFlags,
}Expand description
Sandbox policy configuration
Fields§
§read_paths: Vec<PathPermission>Paths with read access
write_paths: Vec<PathPermission>Paths with write access
exec_paths: Vec<PathPermission>Paths with execute access
network: NetworkPolicyNetwork access policy
timeout: Option<Duration>Execution timeout
allow_spawn: boolAllow process spawning
env_passthrough: Vec<String>Environment variables to pass through
flags: PolicyFlagsAdditional policy flags
Implementations§
Source§impl SandboxPolicy
impl SandboxPolicy
Sourcepub fn default_for_tools(cwd: PathBuf) -> Self
pub fn default_for_tools(cwd: PathBuf) -> Self
Create a restrictive default policy for agent tools
Sourcepub fn allow_read(self, path: impl Into<PathBuf>) -> Self
pub fn allow_read(self, path: impl Into<PathBuf>) -> Self
Allow reading a path
Sourcepub fn allow_write(self, path: impl Into<PathBuf>) -> Self
pub fn allow_write(self, path: impl Into<PathBuf>) -> Self
Allow writing a path
Sourcepub fn allow_exec(self, path: impl Into<PathBuf>) -> Self
pub fn allow_exec(self, path: impl Into<PathBuf>) -> Self
Allow executing from a path
Sourcepub fn with_network(self, policy: NetworkPolicy) -> Self
pub fn with_network(self, policy: NetworkPolicy) -> Self
Set network policy
Sourcepub fn deny_network(self) -> Self
pub fn deny_network(self) -> Self
Deny all network access
Sourcepub fn allow_localhost(self) -> Self
pub fn allow_localhost(self) -> Self
Allow localhost network access
Sourcepub fn allow_full_network(self) -> Self
pub fn allow_full_network(self) -> Self
Allow full network access
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set execution timeout
Sourcepub fn allow_spawn(self, allow: bool) -> Self
pub fn allow_spawn(self, allow: bool) -> Self
Allow process spawning
Trait Implementations§
Source§impl Clone for SandboxPolicy
impl Clone for SandboxPolicy
Source§fn clone(&self) -> SandboxPolicy
fn clone(&self) -> SandboxPolicy
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SandboxPolicy
impl Debug for SandboxPolicy
Source§impl Default for SandboxPolicy
impl Default for SandboxPolicy
Source§fn default() -> SandboxPolicy
fn default() -> SandboxPolicy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SandboxPolicy
impl<'de> Deserialize<'de> for SandboxPolicy
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SandboxPolicy
impl RefUnwindSafe for SandboxPolicy
impl Send for SandboxPolicy
impl Sync for SandboxPolicy
impl Unpin for SandboxPolicy
impl UnwindSafe for SandboxPolicy
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)