Skip to content

Commit c1f07f1

Browse files
authored
[Auth] Restrict the ':' character in API key (#4706)
* Restrict the ':' character in API key * Formatting * Add domain test as well * Formatting
1 parent a4b794b commit c1f07f1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages-exp/auth-exp/src/core/auth/register.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,15 @@ export function registerAuth(clientPlatform: ClientPlatform): void {
5959
const app = container.getProvider('app-exp').getImmediate()!;
6060
const { apiKey, authDomain } = app.options;
6161
return (app => {
62-
_assert(apiKey, AuthErrorCode.INVALID_API_KEY, { appName: app.name });
62+
_assert(
63+
apiKey && !apiKey.includes(':'),
64+
AuthErrorCode.INVALID_API_KEY,
65+
{ appName: app.name }
66+
);
67+
// Auth domain is optional if IdP sign in isn't being used
68+
_assert(!authDomain?.includes(':'), AuthErrorCode.ARGUMENT_ERROR, {
69+
appName: app.name
70+
});
6371
const config: ConfigInternal = {
6472
apiKey,
6573
authDomain,

0 commit comments

Comments
 (0)