pub struct XmlSecurityValidator {
pub reject_doctype: bool,
pub max_document_size: usize,
pub strict_validation: bool,
}Expand description
Security validator for XML content
Fields§
§reject_doctype: boolReject any DOCTYPE declarations
max_document_size: usizeMaximum document size in bytes
strict_validation: boolEnable detailed security checks beyond DOCTYPE
Implementations§
Source§impl XmlSecurityValidator
impl XmlSecurityValidator
Sourcepub fn new(
reject_doctype: bool,
max_document_size: usize,
strict_validation: bool,
) -> Self
pub fn new( reject_doctype: bool, max_document_size: usize, strict_validation: bool, ) -> Self
Create a new validator with custom settings
Sourcepub fn validate(&self, xml: &str) -> Result<(), SecurityViolation>
pub fn validate(&self, xml: &str) -> Result<(), SecurityViolation>
Validate XML content for security threats
Performs multiple security checks:
- Document size validation
- DOCTYPE declaration detection
- External entity reference detection
- Entity declaration detection
- Parameter entity detection
§Errors
Returns SecurityViolation if any security threat is detected.
Trait Implementations§
Source§impl Clone for XmlSecurityValidator
impl Clone for XmlSecurityValidator
Source§fn clone(&self) -> XmlSecurityValidator
fn clone(&self) -> XmlSecurityValidator
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 XmlSecurityValidator
impl Debug for XmlSecurityValidator
Auto Trait Implementations§
impl Freeze for XmlSecurityValidator
impl RefUnwindSafe for XmlSecurityValidator
impl Send for XmlSecurityValidator
impl Sync for XmlSecurityValidator
impl Unpin for XmlSecurityValidator
impl UnwindSafe for XmlSecurityValidator
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