Skip to content

Commit 6d487d7

Browse files
authored
Prevent using authTokenSyncURL if the string begins with a double slash (#8060)
1 parent 2b22838 commit 6d487d7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/bright-avocados-attack.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Do not allow double slash at beginning of authTokenSyncURL. (follow-up fix to https://github.com/firebase/firebase-js-sdk/pull/8056)

packages/auth/src/platform_browser/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export function getAuth(app: FirebaseApp = getApp()): Auth {
9191

9292
const authTokenSyncPath = getExperimentalSetting('authTokenSyncURL');
9393
// Don't allow urls (XSS possibility), only paths on the same domain
94-
// (starting with '/')
95-
if (authTokenSyncPath && authTokenSyncPath.startsWith('/')) {
94+
// (starting with a single '/')
95+
if (authTokenSyncPath && authTokenSyncPath.match(/^\/[^\/].*/)) {
9696
const mintCookie = mintCookieFactory(authTokenSyncPath);
9797
beforeAuthStateChanged(auth, mintCookie, () =>
9898
mintCookie(auth.currentUser)

0 commit comments

Comments
 (0)