Skip to main content

Crate use_security_header

Crate use_security_header 

Source
Expand description

§use-security-header

Web security header and browser-policy primitives for RustUse.

§Experimental

use-security-header is experimental while the use-security workspace remains below 0.3.0. Expect small API adjustments during the first release wave.

§Example

use use_security_header::{SecurityHeaderKind, SecurityHeaderName};

let name = SecurityHeaderName::new("Content-Security-Policy")?;

assert_eq!(name.as_str(), "Content-Security-Policy");
assert_eq!(SecurityHeaderKind::StrictTransportSecurity.header_name(), "Strict-Transport-Security");

§Scope

  • Security header names, categories, and directive labels.
  • CSP, HSTS, referrer policy, frame options, CORS, and permissions policy metadata.

§Non-goals

  • HTTP server or browser behavior.
  • WAF behavior.
  • Complete CSP or header parsing.

§License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

Structs§

SecurityHeaderName
A validated HTTP security header name.

Enums§

ContentSecurityPolicyDirective
Content Security Policy directive labels.
CorsPolicyKind
CORS policy labels.
FrameOptionsKind
X-Frame-Options labels.
PermissionsPolicyDirective
Permissions policy directive labels.
ReferrerPolicyKind
Referrer policy labels.
SecurityHeaderKind
Security header categories.
SecurityHeaderNameError
Error returned when a security header name is invalid.
SecurityHeaderParseError
Error returned when a security header label cannot be parsed.
TransportSecurityDirective
Strict-Transport-Security directive labels.