Skip to content

Commit

Permalink
Guard against isSecureContext not being present
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels committed Mar 21, 2024
1 parent bf2070d commit 939a060
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/auth/src/platform_browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export function getAuth(app: FirebaseApp = getApp()): Auth {

const authTokenSyncPath = getExperimentalSetting('authTokenSyncURL');
// Only do the Cookie exchange in a secure context
if (authTokenSyncPath && isSecureContext) {
if (
authTokenSyncPath &&
typeof isSecureContext === 'boolean' &&
isSecureContext
) {
// Don't allow urls (XSS possibility), only paths on the same domain
const authTokenSyncUrl = new URL(authTokenSyncPath, location.origin);
if (location.origin === authTokenSyncUrl.origin) {
Expand Down

0 comments on commit 939a060

Please sign in to comment.