pub struct Capabilities {
pub network: bool,
pub network_allow: Vec<String>,
pub storage: bool,
pub env: bool,
pub sober: bool,
pub memory_mb: u32,
pub max_instructions: u64,
pub http_timeout_secs: u64,
}Expand description
What the plugin is allowed to touch at runtime.
Defaults are permissive on purpose for back-compat. Future major
versions will flip this to deny-by-default; the migration path is
“add a capabilities block to your manifest”.
Fields§
§network: boolMay the plugin make outbound HTTP requests via the injected http table?
network_allow: Vec<String>If set, restricts http to these hosts (suffix match — api.slack.com
allows api.slack.com and *.api.slack.com). Empty = any host.
storage: boolMay the plugin read/write its private storage via the storage table?
env: boolMay the plugin read environment variables via os.getenv?
sober: boolMay the plugin call the host-provided Sober governance bridge?
memory_mb: u32Maximum heap memory the plugin VM can allocate, in megabytes.
max_instructions: u64Maximum Lua instructions a single hook call may execute.
http_timeout_secs: u64HTTP request timeout in seconds.
Implementations§
Source§impl Capabilities
impl Capabilities
Sourcepub fn legacy_default() -> Self
pub fn legacy_default() -> Self
Permissive defaults for legacy plugins that ship without a capability block. Network is off by default — plugins must opt in to the network surface.
Sourcepub fn host_allowed(&self, host: &str) -> bool
pub fn host_allowed(&self, host: &str) -> bool
Is host allowed by the network_allow list?
An empty list means any host. Suffix match: api.slack.com
in the list permits api.slack.com and hooks.api.slack.com.
Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Capabilities
impl Debug for Capabilities
Source§impl Default for Capabilities
impl Default for Capabilities
Source§fn default() -> Capabilities
fn default() -> Capabilities
Source§impl<'de> Deserialize<'de> for Capabilities
impl<'de> Deserialize<'de> for Capabilities
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Capabilities
impl RefUnwindSafe for Capabilities
impl Send for Capabilities
impl Sync for Capabilities
impl Unpin for Capabilities
impl UnsafeUnpin for Capabilities
impl UnwindSafe for Capabilities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more