How Subresource Integrity Could Have Blocked the Optimizely Attack
The script came from the same Optimizely URL it had always used. The connection was still encrypted. For a website that loaded the script without checking its contents, the browser had no reason to reject it. Yet the JavaScript had changed.
On 16 November 2026, an attacker exploited a flaw in the Optimizely Web Experimentation signup flow to impersonate users and insert malicious JavaScript into customer projects, according to Optimizely’s incident report. Optimizely’s CDN then served the modified snippets from the same URLs customers already used. Report URI identified compromised snippets associated with 178 organisations and documented code capable of swapping cryptocurrency wallet addresses and skimming payment details entered into forms it could access.
The incident raises a question for any team that relies on third-party JavaScript. If a supplier changed a script at its usual URL tomorrow, would your visitors’ browsers still run it?
Where SRI would have stopped the attack
Subresource Integrity, or SRI, lets a website specify a cryptographic hash for a file it expects the browser to load. The site puts that hash in the script tag’s integrity attribute. When the browser fetches the script, it calculates a hash of the file it received and compares it with the expected value. If they differ, the browser refuses to execute the script. Cross-origin scripts also need a compatible CORS configuration.
For a page that had pinned a known-good Optimizely snippet before the incident, the injected JavaScript would have changed the file’s hash. The browser would have rejected the modified snippet before the injected code could run or load a second script. HTTPS would still have delivered the file securely from the expected host. SRI would have caught the change in the file itself.
The challenge is keeping the hash current
SRI applies the same rule to every change. A legitimate update to an A/B test can change the script’s hash just as an unauthorised edit can. If the supplier publishes that change at the same URL, the browser will block the updated script until the website publishes a matching hash. For an experimentation platform, that can mean an experiment stops running until the two updates are coordinated.
Start with scripts that have stable, versioned releases. Update the script URL and integrity hash together after reviewing the new release. For vendor-managed scripts that change frequently, ask whether the supplier offers versioned builds. Where pinning is impractical, limit where the script runs, monitor it for unexpected changes and use a restrictive Content Security Policy to limit what it can load or contact. Give particular attention to checkout, account and other pages that handle sensitive data.
Check what your website loads
Enter a page URL in the ThreatPrevent SRI Checker to review the script references it finds and see where it observes integrity attributes. Start with the homepage, then check pages that handle sign-ins, payments or sensitive forms. Each page can load a different set of scripts. Use the results to identify which script references need a closer look.