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§
- Csrf
Config - Stateless double-submit HMAC-SHA256 CSRF protection settings.
- Request
Guard Config - Built-in request guard limits protecting routing and handlers from malformed traffic.
- Security
Config - Unified security hardening configuration for
SecurityPlugin. - Security
Headers Config - Configurable HTTP security response headers.
- Security
Plugin - Process-wide
SecurityPluginsingleton holding prebuilt headers, guards, and custom rules. - Security
Request Hook - Opt-in request middleware enforcing guards, CSRF checks, custom rules, and applying security headers.
- Security
Response Hook - Opt-in response middleware guaranteeing security headers and stripping
X-Powered-By.
Enums§
- Security
Violation - Security policy violation returned by built-in guards or custom
crate::SecurityRulehooks.
Constants§
- DEFAULT_
COEP_ VALUE - Default
Cross-Origin-Embedder-Policyheader value. - DEFAULT_
COOP_ VALUE - Default
Cross-Origin-Opener-Policyheader value. - DEFAULT_
CORP_ VALUE - Default
Cross-Origin-Resource-Policyheader value. - DEFAULT_
CSP_ STRICT - Default
Content-Security-Policyvalue 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-Securityheader value (1 year, includeSubDomains). - DEFAULT_
MAX_ URI_ BYTES - Default maximum URI path length in bytes (8 KiB).
- DEFAULT_
PERMISSIONS_ POLICY - Default
Permissions-Policyheader value disabling sensitive browser APIs. - DEFAULT_
REFERRER_ POLICY - Default
Referrer-Policyheader value. - DEFAULT_
SECURITY_ MAX_ BODY_ BYTES - Default maximum request body size in bytes (
0means defer to coreRequestConfig). - DEFAULT_
X_ CONTENT_ TYPE_ OPTIONS - Default
X-Content-Type-Optionsheader value. - DEFAULT_
X_ FRAME_ OPTIONS - Default
X-Frame-Optionsheader value.
Traits§
- Security
Rule - Extensible request inspection rule evaluated before routing.
Functions§
- constant_
time_ eq - Compares two byte slices in constant time with respect to their contents.
- has_
path_ traversal - Detects raw or percent-encoded path traversal (
..,%2e%2e), backslashes, or NUL bytes. - hmac_
sha256 - Computes the RFC 4231 HMAC-SHA256 authentication code of
dataunderkey. - 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.
Type Aliases§
- Shared
Security Rule - Thread-safe shared reference to a pluggable
SecurityRule.