MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / prepare

Function prepare

crates/openshell-supervisor-process/src/sandbox/linux/mod.rs:25–31  ·  view source on GitHub ↗

Phase 1: Prepare sandbox restrictions **as root** (before `drop_privileges`). Opens Landlock `PathFds` while the process still has root privileges, ensuring paths like mode-700 directories are accessible.

(policy: &SandboxPolicy, workdir: Option<&str>)

Source from the content-addressed store, hash-verified

23/// Opens Landlock `PathFds` while the process still has root privileges,
24/// ensuring paths like mode-700 directories are accessible.
25pub fn prepare(policy: &SandboxPolicy, workdir: Option<&str>) -> Result<PreparedSandbox> {
26 let landlock = landlock::prepare(policy, workdir)?;
27 Ok(PreparedSandbox {
28 landlock,
29 policy: policy.clone(),
30 })
31}
32
33/// Phase 2: Enforce prepared sandbox restrictions (after `drop_privileges`).
34///

Callers 4

spawn_implMethod · 0.50
spawn_pty_shellFunction · 0.50
spawn_pipe_execFunction · 0.50

Calls

no outgoing calls

Tested by 1