Skip to main content

Module csp

Module csp 

Source
Expand description

Content-Security-Policy construction and nonce generation. CSP nonce generation and policy construction: the enforced policy, its typed extensions, and enforced Trusted Types with a named route relaxation.

Structs§

CspNonce
A validated CSP nonce.
InvalidNonce
Returned by CspNonce::parse for a value that is not safe to interpolate.
NonceError
Returned by CspNonce::generate when the operating system’s random source fails: there is no nonce, so there is no page.
PolicyError
An extension PolicyExtensions refused: the page fails instead of going out with a policy nobody meant.
PolicyExtensions
What a handler may add to a page’s policy, and nothing else.

Functions§

build_csp_header
Build a strict Content-Security-Policy header value.
generate_csp_nonce
Generate a cryptographically random CSP nonce (base64, 44 chars).