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.
- Invalid
Nonce - Returned by
CspNonce::parsefor a value that is not safe to interpolate. - Nonce
Error - Returned by
CspNonce::generatewhen the operating system’s random source fails: there is no nonce, so there is no page. - Policy
Error - An extension
PolicyExtensionsrefused: the page fails instead of going out with a policy nobody meant. - Policy
Extensions - 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).