Lion Cipher Lab

Roll out a Content Security Policy safely: Report-Only mode, a violation-report collector, and triage before you enforce

Why it matters

A Content Security Policy (CSP) that actually stops cross-site scripting is strict, and a strict policy breaks things: every inline script without a nonce, every onclick attribute, every third-party beacon you forgot about. Ship it to enforcement on day one and checkout stops working. Never ship it, and you have no protection. The way out is the report-only rollout. The browser applies your policy in a pretend mode, blocks nothing, and sends you a violation report for everything it would have blocked. You read the reports, fix your own code, allowlist the vendors you really use, and enforce…

What you'll learn

Steps in this lab

  1. The idea: let the browser tell you what your policy would break
  2. Set up a folder and check Python
  3. Model the policy and the toy shop
  4. Build the hardened report collector
  5. Serve the toy shop with both reporting mechanisms
  6. Generate the report corpus, and why it is synthetic
  7. Attack your own collector before an attacker does
  8. Write the triage: from hundreds of reports to a few decisions
  9. Phase 1: collect in Report-Only and triage
  10. Phase 2: refactor, re-run in Report-Only, see what is left
  11. Phase 3: flip to enforcing, and measure the difference
  12. How a pro runs this differently
  13. Honest limits
  14. Where this fits with the other browser-hardening labs

Open the full interactive lab →