pub struct Sandbox { /* private fields */ }Expand description
Clonable because two places run under the same policy without being able to share one
value: the agent’s tool registry and the interface’s !command.
Implementations§
Source§impl Sandbox
impl Sandbox
pub fn new( cfg: &ToolsConfig, workspace: &Path, scripts_dir: Option<&Path>, ) -> Self
Sourcepub fn off() -> Self
pub fn off() -> Self
A sandbox that does nothing. Tests of the process-group kill (and anything else that wants the plain child) use this, so the two mechanisms stay separately testable.
pub fn mode(&self) -> ShellIsolate
Sourcepub fn refuses(&self) -> bool
pub fn refuses(&self) -> bool
Whether a mode that promised containment will refuse instead of running at all. True only
for fs without bubblewrap; process degrades instead.
Sourcepub fn degraded(&self) -> bool
pub fn degraded(&self) -> bool
Whether isolation was asked for and could not be given: the run happens anyway, and the
result says so. Only process degrades; fs refuses in Sandbox::plan, because a
read-only promise is not one to keep halfway.
Sourcepub fn status(&self) -> String
pub fn status(&self) -> String
What config check and the docs print: the mode, and whether the mechanism is there.
Sourcepub fn plan(
&self,
program: &OsStr,
args: &[OsString],
cwd: &Path,
) -> Result<Plan, ToolError>
pub fn plan( &self, program: &OsStr, args: &[OsString], cwd: &Path, ) -> Result<Plan, ToolError>
The program and arguments to run instead of program itself.
cwd is passed to bubblewrap rather than left to the caller so the directory is resolved
inside the namespace, which is the only place it is guaranteed to mean the same thing.
Sourcepub fn skipped_hides(&self) -> Vec<&PathBuf>
pub fn skipped_hides(&self) -> Vec<&PathBuf>
The hides a profile asked for that cannot be applied, for config check and the docs to
name rather than leave someone believing a path is hidden when it is not.