From 0ca079270bab55583df5f6416936549eabfb9526 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 26 Jun 2026 14:01:29 +0800 Subject: [PATCH] fix(supervisor): wire prepare_supervisor_identity_mount_namespace_from_env When a gateway is configured with provider_spiffe_workload_api_socket_path, the Kubernetes driver injects PROVIDER_SPIFFE_WORKLOAD_API_SOCKET into sandbox pods. The supervisor then calls supervisor_identity_mount_from_env() inside spawn_entrypoint, which expects SUPERVISOR_IDENTITY_MOUNT_NS to be initialised by prepare_supervisor_identity_mount_namespace_from_env(). Without this call the OnceLock is never set, causing every sandbox pod to crash with: Error: Failed to prepare supervisor identity isolation: supervisor identity mount namespace was not prepared before startup hardening Wire the preparation step in run_process(), immediately after prepare_filesystem(), before any child processes are spawned. --- crates/openshell-supervisor-process/src/run.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/openshell-supervisor-process/src/run.rs b/crates/openshell-supervisor-process/src/run.rs index 5a5c203a2a..b1835a8076 100644 --- a/crates/openshell-supervisor-process/src/run.rs +++ b/crates/openshell-supervisor-process/src/run.rs @@ -79,6 +79,12 @@ pub async fn run_process( #[cfg(unix)] crate::process::prepare_filesystem(policy)?; + // Wire the SPIFFE Workload API mount namespace so that + // supervisor_identity_mount_from_env() succeeds in spawn_entrypoint when + // PROVIDER_SPIFFE_WORKLOAD_API_SOCKET is set. + #[cfg(target_os = "linux")] + crate::process::prepare_supervisor_identity_mount_namespace_from_env()?; + // Eagerly fetch initial settings and install the agent skill if the // proposals flag is on at startup, rather than waiting for the policy // poll loop's first tick. In offline/file-mode there is no gateway, so