Skip to content

Commit 6204bb6

Browse files
committed
fix(security): isolate supervisor identity from sandbox children
1 parent c40becc commit 6204bb6

5 files changed

Lines changed: 404 additions & 26 deletions

File tree

architecture/sandbox.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ agent process and SSH child processes. Driver-controlled environment variables
7070
override template values so sandbox images cannot spoof identity, callback, or
7171
relay settings.
7272

73+
Supervisor bootstrap identity is not inherited by agent child processes. In
74+
Kubernetes SPIFFE mode, children also enter a private mount namespace where the
75+
Workload API socket directory is hidden before privilege drop.
76+
7377
Credential placeholders in proxied HTTP requests can be resolved by the proxy
7478
when policy allows the target endpoint. Secrets must not be logged in OCSF or
7579
plain tracing output.

crates/openshell-sandbox/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,13 @@ pub async fn run_sandbox(
563563
#[allow(clippy::no_effect_underscore_binding)]
564564
let _netns: Option<()> = None;
565565

566+
// Prepare the child-only mount namespace before the supervisor seccomp
567+
// prelude blocks mount operations. Children enter this namespace with
568+
// `setns` in pre_exec so supervisor identity sockets stay hidden from
569+
// untrusted code while remaining available to the supervisor for refresh.
570+
#[cfg(target_os = "linux")]
571+
process::prepare_supervisor_identity_mount_namespace_from_env()?;
572+
566573
// Install the supervisor seccomp prelude after privileged startup helpers
567574
// (network namespace setup, nftables probes) complete, but before the SSH
568575
// listener and workload process are exposed.

0 commit comments

Comments
 (0)