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

Function validate_sandbox_id

crates/openshell-driver-vm/src/driver.rs:3227–3250  ·  view source on GitHub ↗
(sandbox_id: &str)

Source from the content-addressed store, hash-verified

3225
3226#[allow(clippy::result_large_err)]
3227fn validate_sandbox_id(sandbox_id: &str) -> Result<(), Status> {
3228 if sandbox_id.is_empty() {
3229 return Err(Status::invalid_argument("sandbox id is required"));
3230 }
3231 if sandbox_id.len() > 128 {
3232 return Err(Status::invalid_argument(
3233 "sandbox id exceeds maximum length (128 bytes)",
3234 ));
3235 }
3236 if matches!(sandbox_id, "." | "..") {
3237 return Err(Status::invalid_argument(
3238 "sandbox id must match [A-Za-z0-9._-]{1,128}",
3239 ));
3240 }
3241 if !sandbox_id
3242 .bytes()
3243 .all(|b| b.is_ascii_alphanumeric() || matches!(b, b'.' | b'_' | b'-'))
3244 {
3245 return Err(Status::invalid_argument(
3246 "sandbox id must match [A-Za-z0-9._-]{1,128}",
3247 ));
3248 }
3249 Ok(())
3250}
3251
3252#[allow(clippy::result_large_err)]
3253fn parse_registry_reference(image_ref: &str) -> Result<Reference, Status> {

Callers 5

delete_sandboxMethod · 0.85
get_sandboxMethod · 0.85
validate_vm_sandboxFunction · 0.85
sandbox_state_dirFunction · 0.85

Calls 2

lenMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected