Skip to content

fix(supervisor): wire prepare_supervisor_identity_mount_namespace_from_env - #2012

Closed
yhattm wants to merge 1 commit into
NVIDIA:mainfrom
yhattm:fix/wire-prepare-supervisor-identity-mount-namespace
Closed

fix(supervisor): wire prepare_supervisor_identity_mount_namespace_from_env#2012
yhattm wants to merge 1 commit into
NVIDIA:mainfrom
yhattm:fix/wire-prepare-supervisor-identity-mount-namespace

Conversation

@yhattm

@yhattm yhattm commented Jun 26, 2026

Copy link
Copy Markdown

Problem

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() (process.rs:524), which expects SUPERVISOR_IDENTITY_MOUNT_NS to be initialised by prepare_supervisor_identity_mount_namespace_from_env().

Without this call the OnceLock is never populated, causing every sandbox pod to crash with:

Error: Failed to prepare supervisor identity isolation: supervisor identity
mount namespace was not prepared before startup hardening

This makes the provider_spiffe_workload_api_socket_path gateway config option completely unusable — any cluster that enables it will have all sandbox pods crash-loop.

Root Cause

prepare_supervisor_identity_mount_namespace_from_env() is defined in process.rs but was never wired into the startup sequence. The function creates a private mount namespace to hide the SPIFFE Workload API socket from the child process (security isolation). It must run before supervisor_identity_mount_from_env() is called.

Fix

Call prepare_supervisor_identity_mount_namespace_from_env() in run_process() immediately after prepare_filesystem(), before any child processes are spawned.

Testing

Verified against an EKS cluster with SPIRE deployed:

  1. Set provider_spiffe_workload_api_socket_path = "/run/spire/certs/spire-agent.sock" in gateway config
  2. Before fix: sandbox pod crashes on every start with the error above
  3. After fix: sandbox pod starts cleanly, /run/spire/certs/spire-agent.sock is accessible inside the container

…m_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.
@copy-pr-bot

copy-pr-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown

Thank you for your interest in contributing to OpenShell, @yhattm.

This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer.

To get vouched:

  1. Open a Vouch Request discussion.
  2. Describe what you want to change and why.
  3. Write in your own words — do not have an AI generate the request.
  4. A maintainer will comment /vouch if approved.
  5. Once vouched, open a new PR (preferred) or reopen this one after a few minutes.

See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this Jun 26, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text:


I have read the DCO document and I hereby sign the DCO.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot.

lbelyaev added a commit to apelogic-ai/steward that referenced this pull request Jul 24, 2026
* S0.0: probe the OpenShell integration surface

Confirm D1 against OpenShell v0.0.90: scoped workspaces, membership, object uniqueness, immutable 19-character names, and teardown ordering.

Record D2 as a finding: the token-grant and configurable token_endpoint surface exists, but SPIFFE-enabled sandboxes cannot obtain an SVID because supervisor identity namespace preparation is never reached. G-2 remains not yet provided.

Dependencies: tokio drives the async SDK lifecycle; serde types evidence and provenance; serde_json reads nextest evidence; sha2 derives stable capped names; openshell-sdk provides the exact pinned API behind the adapter seam.

Conformance environment: Agent Sandbox v0.5.0; SPIRE 1.15.2; mcp-gw v0.2.0; LiteLLM 1.93.0.

* chore: allow approved transitive licenses

Permit foldhash 0.1.5 under Zlib: an OSI-permissive, MIT-equivalent-in-effect license on an unavoidable OpenShell transitive dependency.

Permit webpki-roots 1.0.9 under CDLA-Permissive-2.0: the data license covering Mozilla's CA bundle; version 2.0 carries no attribution requirement and the dependency is unavoidable.

Keep both approvals scoped to exact crates and versions so any other Zlib or CDLA-Permissive-2.0 dependency still fails the license gate.

* fix: carry OpenShell supervisor identity patch

Call the v0.0.90 supervisor identity namespace preparation during privileged startup so SPIFFE-enabled sandboxes fail closed with the child socket hidden, instead of crashing later because initialization was skipped.

Upstream attempts: NVIDIA/OpenShell#2012 (focused, auto-closed by vouch gate) and #2184 (open, broader fail-open recovery). Exit when an equivalent fail-closed upstream PR merges and the Steward pin contains it.

* test: verify patched OpenShell identity path

Record exact-pin live evidence, preserve the debug keep contract, and adapt the upstream K3s demo CIDR to the ephemeral kind service subnet without weakening its allow-list.

* fix: harden S0.0 spike tooling
lbelyaev added a commit to apelogic-ai/steward that referenced this pull request Jul 28, 2026
* S1: runtime-bound credential isolation

Exit criteria:
  - acting-user tool call succeeds (e2e_s1_tool_call_as_acting_user)
  - out-of-grant, forged-SVID, and cross-user reuse attempts fail closed

Guarantees re-run: G-2 green against OpenShell v0.0.90 + carried identity patch, SPIRE 1.15.2, and mcp-gw c2af10d9 + #1634acece3
Upstream dependencies recorded: NVIDIA/OpenShell#2012, #2184, #1970; apelogic-ai/mcp-gw#16

* fix: close S1 authority and provider lifecycle gaps

Revoke mint authority when deletion begins, provision and reconcile the gateway provider in every OpenShell workspace, and exercise a legitimate second runtime for cross-user isolation.

Add executable pinned G-2 conformance evidence and run it through the aggregate gate.

* fix: make S1 reconciliation and conformance exact

Reconcile the OpenShell gateway attachment symmetrically so removed tools detach it and unchanged state remains mutation-free. Replace source-shape evidence with one executed upstream-focused G-2 negative test in both pinned and latest lanes, while retaining the separate S1 E2E exit criterion.

* fix: make G-2 evidence exercise verified claims

Require policy to authorize from normalized HOP-1 identity and runtime tool claims before credential resolution. Count the nested Bun execution exactly and require its validated success sentinel alongside the Rust wrapper result. Latest upstream remains a recorded finding until apelogic-ai/mcp-gw#16 lands; pinned evidence carries that patch.

* fix: make G-2 test cross-subject credential lookup

Use Steward's minted subject contract, keeping acting-user email and runtime UID distinct. Give Bob matching tool authority so his request reaches the real credential broker and proves Alice's token is not returned; retain a separate unauthorized subject to assert policy denial precedes credential resolution.

* fix: report latest conformance as informational

Keep the latest-upstream conformance step and logs visibly failed, but tolerate that specific step and record the finding as a workflow warning and job summary. Pinned CI and setup failures remain blocking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant