Skip to main content

Crate hyperlane_plugin_security

Crate hyperlane_plugin_security 

Source
Expand description

hyperlane-plugin-security

Zero-allocation security hardening plugin for Hyperlane providing prebuilt security headers, stateless HMAC-SHA256 CSRF protection, host/URI/body/ path-traversal guards, and extensible SecurityRule hooks.

Structs§

CsrfConfig
Stateless double-submit HMAC-SHA256 CSRF protection settings.
RequestGuardConfig
Built-in request guard limits protecting routing and handlers from malformed traffic.
SecurityConfig
Unified security hardening configuration for SecurityPlugin.
SecurityHeadersConfig
Configurable HTTP security response headers.
SecurityPlugin
Process-wide SecurityPlugin singleton holding prebuilt headers, guards, and custom rules.
SecurityRequestHook
Opt-in request middleware enforcing guards, CSRF checks, custom rules, and applying security headers.
SecurityResponseHook
Opt-in response middleware guaranteeing security headers and stripping X-Powered-By.

Enums§

SecurityViolation
Security policy violation returned by built-in guards or custom crate::SecurityRule hooks.

Constants§

DEFAULT_COEP_VALUE
Default Cross-Origin-Embedder-Policy header value.
DEFAULT_COOP_VALUE
Default Cross-Origin-Opener-Policy header value.
DEFAULT_CORP_VALUE
Default Cross-Origin-Resource-Policy header value.
DEFAULT_CSP_STRICT
Default Content-Security-Policy value for strict web defaults.
DEFAULT_CSRF_COOKIE_NAME
Default double-submit CSRF cookie name.
DEFAULT_CSRF_HEADER_NAME
Default CSRF request header name.
DEFAULT_HSTS_VALUE
Default Strict-Transport-Security header value (1 year, includeSubDomains).
DEFAULT_MAX_URI_BYTES
Default maximum URI path length in bytes (8 KiB).
DEFAULT_PERMISSIONS_POLICY
Default Permissions-Policy header value disabling sensitive browser APIs.
DEFAULT_REFERRER_POLICY
Default Referrer-Policy header value.
DEFAULT_SECURITY_MAX_BODY_BYTES
Default maximum request body size in bytes (0 means defer to core RequestConfig).
DEFAULT_X_CONTENT_TYPE_OPTIONS
Default X-Content-Type-Options header value.
DEFAULT_X_FRAME_OPTIONS
Default X-Frame-Options header value.

Traits§

SecurityRule
Extensible request inspection rule evaluated before routing.

Functions§

constant_time_eq
Compares two byte slices in constant time with respect to their contents using 8-byte word XORs.
has_path_traversal
Detects raw or percent-encoded path traversal (.., %2e%2e), backslashes, or NUL bytes via 8-byte SWAR scanning.
hmac_sha256
Computes the RFC 4231 HMAC-SHA256 authentication code of data under key.
issue_csrf_token
Issues a stateless HMAC-SHA256 signed CSRF token "<nonce>.<hex_mac>".
sha256
Computes the FIPS 180-4 SHA-256 digest of data.
verify_csrf_token
Verifies a stateless HMAC-SHA256 signed CSRF token in constant time.