pub struct SandboxCommand;Expand description
Wraps a standard OS command in a native kernel sandbox (bwrap or Seatbelt).
Ensures that agent-executed native tools are restricted from accessing anything outside the provided worktree sandbox.
Implementations§
Source§impl SandboxCommand
impl SandboxCommand
Sourcepub fn wrap(inner_cmd: Command, worktree_path: &Path) -> Result<Command>
pub fn wrap(inner_cmd: Command, worktree_path: &Path) -> Result<Command>
Wraps the provided command in the host OS sandbox, restricting its access to
the provided worktree_path.
- On Linux, this dynamically prepends
bwrapwith strict mount rules. - On macOS, this dynamically generates a Seatbelt profile and prepends
sandbox-exec -p. - On other platforms (Windows), this currently passes through the command unmodified (with a warning).
§Errors
Returns an error if the worktree path is not absolute, not valid UTF-8, or contains characters unsafe for SBPL interpolation (double-quote, backslash, or null byte).
§Panics
Panics on macOS if validate_sandbox_str passes but the path is not
valid UTF-8. This is unreachable because the validation rejects
non-UTF-8 paths.
Auto Trait Implementations§
impl Freeze for SandboxCommand
impl RefUnwindSafe for SandboxCommand
impl Send for SandboxCommand
impl Sync for SandboxCommand
impl Unpin for SandboxCommand
impl UnsafeUnpin for SandboxCommand
impl UnwindSafe for SandboxCommand
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
Mutably borrows from an owned value. Read more