From c1848a997cca9e0063f0e77eaa9a8f16705c642e Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 28 May 2020 22:54:20 +0200 Subject: [PATCH] First check $ prefix --- server/auth.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/auth.go b/server/auth.go index 33a8c825..b36eb6f4 100644 --- a/server/auth.go +++ b/server/auth.go @@ -733,7 +733,11 @@ var validBcryptPrefix = regexp.MustCompile(`^\$2[a,b,x,y]{1}\$\d{2}\$.*`) // isBcrypt checks whether the given password or token is bcrypted. func isBcrypt(password string) bool { - return validBcryptPrefix.MatchString(password) + if strings.HasPrefix(password, "$") { + return validBcryptPrefix.MatchString(password) + } + + return false } func comparePasswords(serverPassword, clientPassword string) bool {