Skip to content

Commit f1bed3b

Browse files
authored
Add a sanity check for useEmulator URL.
1 parent eeb1dfa commit f1bed3b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/auth/src/auth.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ fireauth.Auth.prototype.useDeviceLanguage = function() {
299299
fireauth.Auth.prototype.useEmulator = function(url) {
300300
// Emulator config can only be set once.
301301
if (!this.emulatorConfig_) {
302+
if (!/^https?:\/\//.test(url)) {
303+
throw new fireauth.AuthError(
304+
fireauth.authenum.Error.ARGUMENT_ERROR, 'Emulator URL must start with a valid scheme (http:// or https://).');
305+
}
302306
// Emit a warning so dev knows we are now in test mode.
303307
this.emitEmulatorWarning_();
304308
// Persist the config.

0 commit comments

Comments
 (0)