pub struct SecurityPolicies {
pub max_wasm_file_size: u64,
pub allowed_imports: HashSet<String>,
pub forbidden_imports: HashSet<String>,
pub max_memory_pages: u32,
pub max_functions: u32,
pub allow_floats: bool,
pub allow_simd: bool,
pub allow_network_access: bool,
pub allow_filesystem_read: bool,
pub allow_filesystem_write: bool,
}Expand description
Security policies for plugin validation
Fields§
§max_wasm_file_size: u64Maximum WASM file size in bytes
allowed_imports: HashSet<String>Allowed import modules
forbidden_imports: HashSet<String>Forbidden import functions
max_memory_pages: u32Maximum memory pages (64KB each)
max_functions: u32Maximum number of functions
allow_floats: boolAllow floating point operations
allow_simd: boolAllow SIMD operations
allow_network_access: boolAllow network access
allow_filesystem_read: boolAllow filesystem read access
allow_filesystem_write: boolAllow filesystem write access
Implementations§
Source§impl SecurityPolicies
impl SecurityPolicies
Sourcepub fn validate_manifest(&self, manifest: &PluginManifest) -> LoaderResult<()>
pub fn validate_manifest(&self, manifest: &PluginManifest) -> LoaderResult<()>
Validate plugin manifest against security policies
Sourcepub fn validate_capabilities(
&self,
capabilities: &PluginCapabilities,
) -> LoaderResult<()>
pub fn validate_capabilities( &self, capabilities: &PluginCapabilities, ) -> LoaderResult<()>
Validate plugin capabilities
Sourcepub fn validate_wasm_module(&self, module: &Module) -> LoaderResult<()>
pub fn validate_wasm_module(&self, module: &Module) -> LoaderResult<()>
Validate WebAssembly module
Sourcepub fn allow_network_access(&self) -> bool
pub fn allow_network_access(&self) -> bool
Check if network access is allowed
Sourcepub fn allow_filesystem_read(&self) -> bool
pub fn allow_filesystem_read(&self) -> bool
Check if file system read access is allowed
Sourcepub fn allow_filesystem_write(&self) -> bool
pub fn allow_filesystem_write(&self) -> bool
Check if file system write access is allowed
Sourcepub fn max_memory_bytes(&self) -> usize
pub fn max_memory_bytes(&self) -> usize
Get maximum allowed memory in bytes
Sourcepub fn max_cpu_percent(&self) -> f64
pub fn max_cpu_percent(&self) -> f64
Get maximum allowed CPU usage
Trait Implementations§
Source§impl Clone for SecurityPolicies
impl Clone for SecurityPolicies
Source§fn clone(&self) -> SecurityPolicies
fn clone(&self) -> SecurityPolicies
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecurityPolicies
impl Debug for SecurityPolicies
Auto Trait Implementations§
impl Freeze for SecurityPolicies
impl RefUnwindSafe for SecurityPolicies
impl Send for SecurityPolicies
impl Sync for SecurityPolicies
impl Unpin for SecurityPolicies
impl UnwindSafe for SecurityPolicies
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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>
Converts
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>
Converts
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