Skip to main content

wasm_capability_contract/capability/vo/
capability_scope.rs

1//! [`CapabilityScope`] — what a granted capability is actually allowed to reach.
2
3use serde::{Deserialize, Serialize};
4
5/// A granted capability's own allowlist, carried on a [`crate::CapabilityGrant`].
6///
7/// Deliberately generic: this contract has no knowledge of what a
8/// specific capability's `allowed` entries mean (hostnames, method
9/// names, model ids, tool names, query names, secret names, or anything
10/// else), nor of which capabilities may accept a literal `"*"` entry as
11/// an explicit "unrestricted" opt-in versus which must never accept one
12/// under any circumstance. That interpretation, and any enforcement of
13/// it, belongs entirely to the real `ComponentValidator` implementor
14/// that actually knows the capability, checked again on every call, not
15/// just once at grant-registration time.
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
17pub struct CapabilityScope {
18    /// What this grant is allowed to reach. Empty means nothing is
19    /// reachable; a specific consumer's own validator decides what (if
20    /// anything) a literal `"*"` entry means for a given capability.
21    pub allowed: Vec<String>,
22}