Loading...
Content-Security-Policy: default-src *; script-src * 'unsafe-inline' 'unsafe-eval'Content-Security-Policy: default-src 'self'; script-src 'nonce-rAnd0m123' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'self'A per-response nonce with 'strict-dynamic' allows only your scripts, while the wildcard and 'unsafe-inline' allow injected ones.
script-src has no 'unsafe-inline' or 'unsafe-eval' and uses nonces or hashes instead.object-src 'none' and base-uri, and frame-ancestors is sent as a header, not in a meta tag.Content-Security-Policy-Report-Only before enforcing.Yes, with <meta http-equiv='Content-Security-Policy'>, but frame-ancestors, report-uri and sandbox are ignored there, so a header is preferred.
Use nonces for pages rendered per request, and hashes for static pages where inline script content never changes.
Attributes like onclick are inline scripts, and nonces do not apply to them. Move handlers into a script with addEventListener.