Skip to main content

hyperlane_plugin_security/
enum.rs

1/// Security policy violation returned by built-in guards or custom [`crate::SecurityRule`] hooks.
2#[derive(Clone, Debug, Eq, PartialEq)]
3pub enum SecurityViolation {
4    /// Request body exceeded configured maximum byte size (`413 Payload Too Large`).
5    BodyTooLarge,
6    /// Request path/URI exceeded configured maximum length (`414 URI Too Long`).
7    UriTooLong,
8    /// `Host` header did not match the configured allowlist (`400 Bad Request`).
9    InvalidHost,
10    /// Request path contained traversal sequences or NUL bytes (`400 Bad Request`).
11    PathTraversal,
12    /// Double-submit HMAC CSRF token was absent, mismatched, or forged (`403 Forbidden`).
13    CsrfInvalid,
14    /// Custom violation emitted by an application-supplied [`crate::SecurityRule`].
15    Custom {
16        /// HTTP status code returned to the client.
17        status_code: usize,
18        /// Human-readable rejection reason.
19        message: String,
20    },
21}