firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Fix trusted types violation in packages/auth/src/platform_browser/index.ts

Open KJ202 opened this issue 3 weeks ago • 1 comments

This change addresses a Trusted Types violation in the loadJS function. The violation occurs because a URL constructed from a string is used to set the src attribute of a script element, which is a potential DOM XSS vulnerability.

The patch resolves this issue by using safevalues.safeUrl to create a SafeUrl object from the URL string. This sanitized URL is then used with the safevalues.dom.setSrc function to safely set the src attribute of the script element. This ensures that only sanitized, trusted URLs can be loaded, thus mitigating the risk of DOM XSS attacks.

This change is purely for security and has no functional impact.

Test: Verified that all existing tests pass after the change.

KJ202 avatar Dec 01 '25 23:12 KJ202

⚠️ No Changeset found

Latest commit: 1d9f402b57b20e8bed53c3653a1f4709565a0745

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

changeset-bot[bot] avatar Dec 01 '25 23:12 changeset-bot[bot]