From 08ba52293c94016dbd092896d76ab5781b8a59aa Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Fri, 29 Jan 2021 22:24:19 +0100 Subject: [PATCH] auth: Fix undefined secret error Signed-off-by: Philip Molares --- src/auth/auth.service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 3d0d76c5a..9662f4c1e 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -36,6 +36,9 @@ export class AuthService { async validateToken(token: string): Promise { const [keyId, secret] = token.split('.'); + if (!secret) { + throw new TokenNotValidError('Invalid AuthToken format'); + } if (secret.length > 72) { // Only the first 72 characters of the tokens are considered by bcrypt // This should prevent strange corner cases