pub struct RegexValidator { /* private fields */ }Expand description
Validator for Perl regular expressions to prevent security and performance issues
Implementations§
Source§impl RegexValidator
impl RegexValidator
Sourcepub fn validate(
&self,
pattern: &str,
start_pos: usize,
) -> Result<(), RegexError>
pub fn validate( &self, pattern: &str, start_pos: usize, ) -> Result<(), RegexError>
Validate a regex pattern for potential performance or security risks
Sourcepub fn detects_code_execution(&self, pattern: &str) -> bool
pub fn detects_code_execution(&self, pattern: &str) -> bool
Check if the pattern contains embedded code constructs (?{…}) or (??{…})
Sourcepub fn detect_nested_quantifiers(&self, pattern: &str) -> bool
pub fn detect_nested_quantifiers(&self, pattern: &str) -> bool
Check for nested quantifiers that can cause catastrophic backtracking e.g. (a+)+, (a*), (a?)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RegexValidator
impl RefUnwindSafe for RegexValidator
impl Send for RegexValidator
impl Sync for RegexValidator
impl Unpin for RegexValidator
impl UnsafeUnpin for RegexValidator
impl UnwindSafe for RegexValidator
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