pub struct LLMSecurityConfig {
pub enable_injection_detection: bool,
pub enable_output_validation: bool,
pub max_code_size_bytes: usize,
pub strict_mode: bool,
pub log_attacks: bool,
pub max_llm_calls_per_hour: u32,
}Expand description
Configuration for the LLM security layer
Fields§
§enable_injection_detection: boolEnable prompt injection detection
enable_output_validation: boolEnable output validation
max_code_size_bytes: usizeMaximum code size to analyze (prevent DoS)
strict_mode: boolBlock suspicious patterns even if detection is uncertain
log_attacks: boolLog all detected attacks
max_llm_calls_per_hour: u32Rate limit for LLM calls per IP
Implementations§
Source§impl LLMSecurityConfig
impl LLMSecurityConfig
Sourcepub fn new(
enable_injection_detection: bool,
enable_output_validation: bool,
max_code_size_bytes: usize,
strict_mode: bool,
) -> Self
pub fn new( enable_injection_detection: bool, enable_output_validation: bool, max_code_size_bytes: usize, strict_mode: bool, ) -> Self
Create a new configuration with custom values
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a permissive configuration
Sourcepub fn is_development(&self) -> bool
pub fn is_development(&self) -> bool
Check if this is a development configuration
Sourcepub fn is_production(&self) -> bool
pub fn is_production(&self) -> bool
Check if this is a production configuration
Trait Implementations§
Source§impl Clone for LLMSecurityConfig
impl Clone for LLMSecurityConfig
Source§fn clone(&self) -> LLMSecurityConfig
fn clone(&self) -> LLMSecurityConfig
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 LLMSecurityConfig
impl Debug for LLMSecurityConfig
Source§impl Default for LLMSecurityConfig
impl Default for LLMSecurityConfig
Source§impl<'de> Deserialize<'de> for LLMSecurityConfig
impl<'de> Deserialize<'de> for LLMSecurityConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LLMSecurityConfig
impl RefUnwindSafe for LLMSecurityConfig
impl Send for LLMSecurityConfig
impl Sync for LLMSecurityConfig
impl Unpin for LLMSecurityConfig
impl UnwindSafe for LLMSecurityConfig
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