Skip to content

Commit

Permalink
Prevent using authTokenSyncURL if the string begins with a double sla…
Browse files Browse the repository at this point in the history
…sh (#8060)
  • Loading branch information
hsubox76 authored Mar 11, 2024
1 parent 2b22838 commit 6d487d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-avocados-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/auth': patch
---

Do not allow double slash at beginning of authTokenSyncURL. (follow-up fix to https://github.com/firebase/firebase-js-sdk/pull/8056)
4 changes: 2 additions & 2 deletions packages/auth/src/platform_browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export function getAuth(app: FirebaseApp = getApp()): Auth {

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

0 comments on commit 6d487d7

Please sign in to comment.