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

Function enforce_sandbox_scope

crates/openshell-server/src/auth/guard.rs:57–68  ·  view source on GitHub ↗
(
    request: &tonic::Request<T>,
    claimed_sandbox_id: &str,
)

Source from the content-addressed store, hash-verified

55/// further (e.g. for audit logging).
56#[allow(clippy::result_large_err)]
57pub fn enforce_sandbox_scope<T>(
58 request: &tonic::Request<T>,
59 claimed_sandbox_id: &str,
60) -> Result<Principal, Status> {
61 let principal = request
62 .extensions()
63 .get::<Principal>()
64 .cloned()
65 .ok_or_else(|| Status::unauthenticated("missing principal"))?;
66 ensure_sandbox_scope(&principal, claimed_sandbox_id)?;
67 Ok(principal)
68}
69
70/// Require a sandbox principal and reject users or anonymous callers.
71///

Calls 1

ensure_sandbox_scopeFunction · 0.85