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

Function require_sandbox_identifier

crates/openshell-driver-docker/src/lib.rs:2413–2420  ·  view source on GitHub ↗

Reject driver requests that arrive with neither a sandbox id nor a sandbox name. Without this guard, downstream label filters degenerate to "match every managed container in the namespace", which would let `delete_sandbox`/`stop_sandbox`/`get_sandbox` pick an arbitrary sandbox out of the set the driver manages.

(sandbox_id: &str, sandbox_name: &str)

Source from the content-addressed store, hash-verified

2411/// `delete_sandbox`/`stop_sandbox`/`get_sandbox` pick an arbitrary
2412/// sandbox out of the set the driver manages.
2413fn require_sandbox_identifier(sandbox_id: &str, sandbox_name: &str) -> Result<(), Status> {
2414 if sandbox_id.is_empty() && sandbox_name.is_empty() {
2415 return Err(Status::invalid_argument(
2416 "sandbox_id or sandbox_name is required",
2417 ));
2418 }
2419 Ok(())
2420}
2421
2422fn docker_container_openshell_endpoint(endpoint: &str, host: &str, port: u16) -> String {
2423 let Ok(mut url) = Url::parse(endpoint) else {

Callers 4

get_sandboxMethod · 0.85
stop_sandboxMethod · 0.85
delete_sandboxMethod · 0.85

Calls 1

is_emptyMethod · 0.45