Inline event handler
Not run<button onclick="window.__handlerRan = true">Guarded by script-src
Content Security Policy, running live
This page sends a strict CSP with every response. The markup below deliberately attempts things the policy forbids, and the browser reports each refusal back to this app's own endpoint using report-uri.
Content-Security-Policydefault-src 'self'; script-src 'self' 'nonce-rVHdceE9ALCBxbh+AgWXtQ==' 'strict-dynamic' 'report-sample'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; font-src 'self'; frame-src 'self'; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'; report-uri /api/csp-report
/api/csp-reportworks on HTTP and HTTPSFour elements are in the markup right now. The browser stopped them before they loaded; the reports arrived without any JavaScript on our side.
picsum.photos is not in img-src.example.org is not in frame-src.<script>
window.__staticInlineScriptRan = true;
</script>script-srcnonce, no unsafe-inline, no execution.<script
src="https://code.jquery.com/jquery-3.7.1.min.js">
</script>script-srcstrict-dynamic trusts nonce-created scripts, not parser-inserted ones.Each button asks the browser to do something the policy disallows. Watch the feed on the right while the request fails.
<button onclick="window.__handlerRan = true">Guarded by script-src
example.org/theme.cssGuarded by style-src
picsum.photos/seed/csp-run/320/200Guarded by img-src
example.org/?from=csp-runGuarded by frame-src
api.github.com/zenGuarded by connect-src
nonce="rVHdceE9…"Carries this response's nonce; expected to run
/api/csp-report (GET)Same origin; expected to pass
style="background:#096b50"Permitted by style-src's 'unsafe-inline'
The same violations are printed in the browser console. The feed reads them from the server, which is what makes the round trip visible.