pub enum SecurityViolation {
BodyTooLarge,
UriTooLong,
InvalidHost,
PathTraversal,
CsrfInvalid,
Custom {
status_code: usize,
message: String,
},
}Expand description
Security policy violation returned by built-in guards or custom crate::SecurityRule hooks.
Variants§
BodyTooLarge
Request body exceeded configured maximum byte size (413 Payload Too Large).
UriTooLong
Request path/URI exceeded configured maximum length (414 URI Too Long).
InvalidHost
Host header did not match the configured allowlist (400 Bad Request).
PathTraversal
Request path contained traversal sequences or NUL bytes (400 Bad Request).
CsrfInvalid
Double-submit HMAC CSRF token was absent, mismatched, or forged (403 Forbidden).
Custom
Custom violation emitted by an application-supplied crate::SecurityRule.
Implementations§
Source§impl SecurityViolation
Inherent implementation of SecurityViolation.
impl SecurityViolation
Inherent implementation of SecurityViolation.
Sourcepub fn status_code(&self) -> usize
pub fn status_code(&self) -> usize
Maps this violation to its canonical HTTP status code.
§Returns
usize- HTTP status code (400,403,413,414, or custom).
Trait Implementations§
Source§impl Clone for SecurityViolation
impl Clone for SecurityViolation
Source§impl Debug for SecurityViolation
impl Debug for SecurityViolation
Source§impl Display for SecurityViolation
Formatting for SecurityViolation.
impl Display for SecurityViolation
Formatting for SecurityViolation.
impl Eq for SecurityViolation
Source§impl Error for SecurityViolation
Implements Error for SecurityViolation.
impl Error for SecurityViolation
Implements Error for SecurityViolation.
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for SecurityViolation
impl PartialEq for SecurityViolation
impl StructuralPartialEq for SecurityViolation
Auto Trait Implementations§
impl Forget for SecurityViolation
impl Freeze for SecurityViolation
impl Move for SecurityViolation
impl RefUnwindSafe for SecurityViolation
impl Send for SecurityViolationwhere
RawVecInner: Send,
impl Sync for SecurityViolationwhere
RawVecInner: Sync,
impl Unpin for SecurityViolation
impl UnsafeUnpin for SecurityViolation
impl UnwindSafe for SecurityViolationwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.