A third-party script can arrive from an approved domain over HTTPS and still contain malicious code.
The November 2026 Optimizely incident illustrates that risk. Websites loading an established experimentation tool received JavaScript that had been altered upstream. Their own application code did not need to change for visitors to encounter the injected content.
For teams using Content Security Policy, the incident raises a practical question: what happens after a script has been allowed to run?
What happened?
On 16 November, Report URI published an investigation describing malicious JavaScript delivered through Optimizely Web. Its researchers reported finding 188 infected snippets associated with 178 organisations, from a sample of 1,611 snippets examined. Those figures represent the researchers’ observations, rather than a vendor-confirmed total of affected organisations or visitors.
The investigation identified injected code in Project JavaScript, a field incorporated into customer snippets. The initial script could therefore arrive through a delivery route the website already trusted. Report URI’s investigation
Optimizely subsequently confirmed that an unauthorised party had exploited a vulnerability in Experimentation to add malicious JavaScript to some customer projects. In its update at 01:02 UTC on 17 November, the company said it had fixed the vulnerability and removed the injected code. It also said it had taken steps to secure affected accounts and introduced additional protections against unauthorised code delivery. That update marked the incident as monitoring. Optimizely’s incident update
These accounts do not establish that every visitor experienced the same outcome. Assessing exposure requires evidence about the pages, script versions and time periods involved.
Why an approved domain is not enough
Consider this simplified CSP example:
Content-Security-Policy: script-src 'self' https://cdn.example.netIt authorises scripts from the page’s own origin and the specified external source. It does not compare each downloaded file with a previously reviewed version or assess whether its behaviour is benign.
If an approved supplier changes a script, its source can remain allowed while its contents change substantially. HTTPS protects the connection to the server; it does not establish that the JavaScript delivered by that server is safe.
This example controls scripts only. With neither connect-src nor a default-src fallback, it does not impose CSP restrictions on Fetch or WebSocket destinations. It is an illustration, not a complete production policy. MDN: CSP, MDN: connect-src
Experimentation platforms, analytics tools and tag managers legitimately change browser behaviour. Access to their publishing controls therefore deserves the same attention as other ways of deploying code to your website.
Where CSP can interrupt subsequent activity
An allowed script may attempt to load another script, contact an external service or evaluate JavaScript contained in a string. Those actions can encounter further policy checks.
| Attempted action | Relevant control | Practical consideration |
|---|---|---|
| Load another external script | Applicable script directives | Source permissions and delegated trust determine whether it is allowed |
Send data through Fetch, XMLHttpRequest or sendBeacon() |
connect-src |
Allow only destinations the application needs |
Execute a string through eval() |
CSP’s script evaluation restrictions | Allowing 'unsafe-eval' weakens this protection |
connect-src also covers interfaces such as WebSocket and EventSource. It is not a universal control over every way information can leave a page, so it should not be presented as complete data-loss prevention. MDN: connect-src
Avoid adding 'unsafe-eval' simply to silence a browser error. Identify the dependency requiring string evaluation and investigate whether that behaviour can be removed. MDN’s CSP implementation guidance
Crucially, blocking a subsequent request does not undo code that has already executed. Malicious code inside an allowed script may alter the page without making another script-loading request. CSP does not inspect each statement and decide whether its purpose is legitimate.
Understand what strict-dynamic delegates
In supporting browsers, 'strict-dynamic' allows scripts authorised through a nonce or hash to load additional scripts through non-parser-inserted script elements, such as those created using DOM APIs.
For this behaviour, host and scheme allowlists in the applicable script source list are ignored. An unfamiliar child-script hostname is therefore not necessarily blocked.
This delegation does not relax connect-src or automatically permit eval(). It changes script-loading permissions, not every restriction applied to the page. W3C: strict-dynamic
The practical implication is that you must review the scripts receiving this authority. A nonce authorises execution; it does not verify that downloaded code matches a previously approved version.
Reporting shows violations, not every malicious action
A report-only policy observes violations without enforcing its restrictions. An enforced policy can block prohibited activity and report violations when reporting is configured. MDN: Content-Security-Policy-Report-Only
During an investigation, useful signals include:
- Previously unseen script or connection destinations.
- Violations appearing across several pages at similar times.
- Changes associated with a particular third-party integration.
- Whether reports describe report-only observations or enforced restrictions.
Treat these as investigation leads. A violation does not prove that an attack succeeded, and a lack of reports does not establish that a page was safe. Behaviour permitted by the policy may produce no violation.
Compare reports with available script versions, publishing history and application logs before drawing conclusions about exposure.
Would Subresource Integrity help?
Subresource Integrity, or SRI, lets a browser compare a downloaded resource against an expected cryptographic hash. A resource that fails the integrity check is not executed or applied.
SRI is useful for stable, versioned dependencies. It is harder to operate with scripts intentionally rebuilt whenever an experiment changes, because legitimate changes also require updated integrity metadata. Cross-origin resources must additionally satisfy SRI’s CORS requirements. MDN: Subresource Integrity
SRI checks whether content matches the expected bytes. It does not establish that those bytes are safe.
The operational question is whether your team can review and approve updates before changing the expected hash. Automatically accepting whatever a remote URL currently returns removes much of that review boundary.
A practical investigation checklist
If your website uses Optimizely Web Experimentation, follow the vendor’s current guidance alongside your own investigation.
- Identify the integration. Record project identifiers, snippet URLs and affected pages. Include deployments managed through tag managers or custom delivery routes.
- Preserve available evidence. Retain relevant script copies, timestamps, project changes and security reports before routine cleanup overwrites them.
- Inspect published configuration. Review custom JavaScript and recent publishing activity with the people who administer the platform.
- Check the delivered CSP. Inspect actual browser responses, including script permissions, delegated trust, evaluation restrictions and connection destinations.
- Assess exposure by page and time. Establish which script versions ran and what information or functionality was accessible during the suspected window.
- Verify remediation. Check the currently delivered content against vendor guidance and continue monitoring for unexpected changes.
Use this checklist to organise evidence gathering. Decisions about disabling integrations, invalidating sessions or rotating credentials should follow the incident’s circumstances and findings.
Make third-party scripts part of change management
Assign an owner and business purpose to every third-party script. Record where it runs, who can publish changes and how it can be disabled. Review whether it needs to execute on sensitive pages at all.
HeaderCentaur’s CSP reporting dashboard can help teams inspect policy violations, while its HTTP security header scanning can check the headers a website delivers. Combine those signals with script review, publishing controls and incident evidence.
An approved script source is an ongoing trust decision. Its address may stay the same long after the code you originally reviewed has changed.