Content Security Policies: Let's Break Stuff
summary
Content Security Policy reduces XSS risk by declaring allowed resource origins and blocking others; demo shows default-src/script-src/style-src/img-src/form-action directives, upgrade-insecure-requests, and using a cryptographic nonce per request to allow necessary inline scripts. A middleware and demo site deploy CSP and initially breaks production (extensions like LastPass and some users' browsers fail); adding a report-uri.io endpoint and using report-only mode yields JSON violation reports (thousands of noisy reports at first), letting CI plus Selenium-driven browsers validate and tighten policy safely.
AI-written summary · about
chapters (9)
- 0:00Introduction to CSP talk
- 1:02Speaker background and agenda
- 9:58What is cross-site scripting?
- 19:13How CSP reduces XSS risks
- 23:27Debugging CSP violations with Report URI
- 26:19Best practices for CSP implementation
- 28:29Demo: Breaking stuff with CSP
- 34:30Fixing CSP issues in the demo
- 39:06Resources and Q&A
