Testing CSP and Script Allowlists Against a Compromised Vendor Script
An Optimizely-style vendor compromise means someone else writes JavaScript that runs in your origin. This video runs the controls most teams rely on against a lab stand-in for that situation, using a publisher on one port and a vendor CDN on another, and reports what the browser actually did. What the run shows: - A host allowlist with 'unsafe-inline' approves the vendor host, so the file loads and the injected segment inside it executes. Nothing is reported, because nothing was blocked. - A nonce without the host allowlist does block the vendor script, but it also breaks every vendor tag that injects its own script element. - Adding 'strict-dynamic' to get those tags working again restores the original exposure. A script created by an already-trusted script is trusted too, so the injected segment runs and the violation report stays empty. The conclusion is narrow and useful: CSP is a load-time control. It decides whether a file may execute, not what that file may do once it is running. A quiet CSP dashboard during a vendor compromise is the expected output, not evidence of safety, and strict-dynamic remains the right call for the inline-to-external XSS pivot while doing nothing against a vendor you deliberately trusted. The post keeps the payload to markers and log lines on purpose, then walks through SRI, host allowlists and iframe isolation against the same harness, and draws the boundary question every third-party tag raises: your vendor inventory is a list of companies with permission to execute code in your origin. Read the full write-up: https://hackyjs.com/posts/testing-csp-script-allowlists-and-vendor-isolation-against-a-compromised-third-party-script