Skip to content

fix(web): fetch the Optimizely datafile as JSON instead of a script - #14790

Open
dylanjeffers wants to merge 1 commit into
mainfrom
fix/web-optimizely-json-fetch
Open

dylanjeffers wants to merge 1 commit into
mainfrom
fix/web-optimizely-json-fetch

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

What

index.html loaded the Optimizely datafile through a <script src=".../<key>.json/tag.js"> tag, so whatever that host returned ran on audius.co. This fetches the same datafile as JSON instead, so nothing from the datafile host is executed.

  • index.html: inline fetch of experiments.audius.co/datafiles/<key>.json, kept in the head so it still starts alongside the entry bundle. Resolves to {} on any failure, same as the old onError.
  • remote-config-instance.ts: awaits window.optimizelyDatafilePromise and drops the OPTIMIZELY_LOADED event.
  • preconnect for the datafile host is now crossorigin, since the request is CORS.

Context: the Nov 16 Optimizely Web Experimentation compromise served malicious JS from Optimizely's CDN. We were not affected (the file we load is a plain datafile assignment and predates the attack), but there is no reason to execute it.

Testing

  • Datafile endpoint returns access-control-allow-origin: *.
  • tsc on packages/web shows no errors in the touched files.
  • Not run in a browser locally; worth a look on RC that flags resolve (e.g. weekly_rotation on) and the network tab shows the .json fetch.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b23bea2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant