Skip to content

Commit 8ce300f

Browse files
committed
feat(isolation): expose trusted launch and registry data contracts
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent 1a65cdc commit 8ce300f

5 files changed

Lines changed: 75 additions & 26 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//! Trusted launch metadata for an endpoint-registered Sandbox Protocol backend.
5+
6+
use std::collections::BTreeMap;
7+
use std::net::IpAddr;
8+
9+
use openshell_core::SandboxSessionId;
10+
use openshell_isolation_interface::contract::{OuterFenceGuarantees, ResolvedWorkloadIdentity};
11+
use serde::{Deserialize, Serialize};
12+
13+
use crate::boundary_protocol::SandboxTlsClientConfig;
14+
15+
/// Delivered by the trusted driver separately from its opaque backend payload.
16+
/// Endpoint selection belongs to operator configuration, not launch data.
17+
#[derive(Clone, Debug, Serialize, Deserialize)]
18+
#[serde(deny_unknown_fields)]
19+
pub struct DelegatedLaunch {
20+
pub backend_name: String,
21+
pub sandbox_id: String,
22+
pub generation: String,
23+
pub session_id: SandboxSessionId,
24+
pub workload_identity: ResolvedWorkloadIdentity,
25+
pub tls: SandboxTlsClientConfig,
26+
#[serde(default)]
27+
pub host_gateway_ip: Option<IpAddr>,
28+
pub resource_claims: BTreeMap<String, String>,
29+
pub outer_fence: OuterFenceGuarantees,
30+
}

‎crates/openshell-sandbox-backend/src/lib.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//! types in this crate.
1010
1111
pub mod boundary_protocol;
12+
pub mod delegated;
1213
pub mod mediation;
1314
mod runtime;
1415
pub mod sandbox_auth;

‎crates/openshell-supervisor/src/backend_setup.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
//! Backend-owned launch decoding and client construction for supervisor startup.
55
6+
mod registration;
7+
pub use registration::{BackendRegistration, BackendRegistrations};
8+
69
use std::path::PathBuf;
710
use std::sync::{Arc, Mutex};
811

@@ -27,8 +30,9 @@ pub struct LaunchIdentity {
2730
pub vm_policy_identity: Option<super::VmPolicyIdentity>,
2831
}
2932

30-
/// Runtime state remains owned by the supervisor. Backends retain these same
31-
/// handles so CA publication, provider reload, and bearer rotation stay visible
33+
/// Runtime state remains owned by the supervisor.
34+
///
35+
/// Backends retain these same handles so CA publication, provider reload, and bearer rotation stay visible
3236
/// after attachment; copying their current contents would lose later updates.
3337
pub struct BackendServices {
3438
pub ca_file_paths: Arc<Mutex<Option<(PathBuf, PathBuf)>>>,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//! Operator-owned endpoint registration; launch payloads never select a route.
5+
6+
pub use openshell_core::isolation_registration::BackendRegistration;
7+
use serde::Deserialize;
8+
9+
#[derive(Default, Deserialize)]
10+
#[serde(deny_unknown_fields)]
11+
pub struct BackendRegistrations {
12+
pub backends: Vec<BackendRegistration>,
13+
}

‎crates/openshell-supervisor/src/lib.rs‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compile_error!(
1616
);
1717

1818
mod activity_aggregator;
19-
mod backend_setup;
19+
pub mod backend_setup;
2020
mod denial_aggregator;
2121
mod endpoint_status;
2222
mod mechanistic_mapper;
@@ -667,33 +667,34 @@ pub async fn run_sandbox(
667667
.await
668668
}
669669

670-
struct SandboxRunConfig {
671-
command: Vec<String>,
672-
workdir: Option<String>,
673-
timeout_secs: u64,
674-
interactive: bool,
675-
await_main_process_attachment: bool,
676-
sandbox_id: Option<String>,
677-
sandbox: Option<String>,
678-
openshell_endpoint: Option<String>,
679-
policy_rules: Option<String>,
680-
policy_data: Option<String>,
681-
ssh_socket_path: Option<String>,
682-
health_socket_path: Option<std::path::PathBuf>,
683-
health_port: Option<u16>,
684-
ocsf_enabled: Arc<AtomicBool>,
685-
ocsf_schema_version: Arc<std::sync::Mutex<String>>,
686-
upstream_proxy_args: openshell_supervisor_network::upstream_proxy::UpstreamProxyArgs,
687-
backend_descriptor: openshell_isolation_interface::contract::BackendDescriptor,
688-
auth_bundle: openshell_core::jwt::SupervisorAuthBundle,
689-
admitted_isolation_backend: Option<String>,
690-
main_exit_marker: Option<std::path::PathBuf>,
670+
/// Trusted inputs for one supervisor launch.
671+
pub struct SandboxRunConfig {
672+
pub command: Vec<String>,
673+
pub workdir: Option<String>,
674+
pub timeout_secs: u64,
675+
pub interactive: bool,
676+
pub await_main_process_attachment: bool,
677+
pub sandbox_id: Option<String>,
678+
pub sandbox: Option<String>,
679+
pub openshell_endpoint: Option<String>,
680+
pub policy_rules: Option<String>,
681+
pub policy_data: Option<String>,
682+
pub ssh_socket_path: Option<String>,
683+
pub health_socket_path: Option<std::path::PathBuf>,
684+
pub health_port: Option<u16>,
685+
pub ocsf_enabled: Arc<AtomicBool>,
686+
pub ocsf_schema_version: Arc<std::sync::Mutex<String>>,
687+
pub upstream_proxy_args: openshell_supervisor_network::upstream_proxy::UpstreamProxyArgs,
688+
pub backend_descriptor: openshell_isolation_interface::contract::BackendDescriptor,
689+
pub auth_bundle: openshell_core::jwt::SupervisorAuthBundle,
690+
pub admitted_isolation_backend: Option<String>,
691+
pub main_exit_marker: Option<std::path::PathBuf>,
691692
}
692693

693694
/// Trusted composition chooses the setup before shared admission, policy, and
694695
/// lifecycle handling. Payload contents never select a backend implementation.
695696
#[allow(clippy::similar_names)]
696-
async fn run_sandbox_with_backend(
697+
pub async fn run_sandbox_with_backend(
697698
backend_setup: &dyn backend_setup::BackendSetup,
698699
config: SandboxRunConfig,
699700
) -> Result<i32> {
@@ -2141,7 +2142,7 @@ enum LocalPolicyIdentity {
21412142
/// init maps the `sandbox` account to this pair; the host must not resolve
21422143
/// guest selectors through its own account database.
21432144
#[derive(Clone, Copy)]
2144-
struct VmPolicyIdentity {
2145+
pub struct VmPolicyIdentity {
21452146
uid: u32,
21462147
gid: u32,
21472148
}

0 commit comments

Comments
 (0)