Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: add delay (#12321)

Max Deichmann03b736ef4aca
diff --git a/web/src/server/auth.ts b/web/src/server/auth.ts
index a3c2d21816..102a498324 100644
--- a/web/src/server/auth.ts
+++ b/web/src/server/auth.ts
@@ -7,7 +7,10 @@ import {
} from "next-auth";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import { prisma } from "@langfuse/shared/src/db";
-import { verifyPassword } from "@/src/features/auth-credentials/lib/credentialsServerUtils";
+import {
+ hashPassword,
+ verifyPassword,
+} from "@/src/features/auth-credentials/lib/credentialsServerUtils";
import { parseFlags } from "@/src/features/feature-flags/utils";
import { env } from "@/src/env.mjs";
import { createProjectMembershipsOnSignup } from "@/src/features/auth/lib/createProjectMembershipsOnSignup";
@@ -121,11 +124,17 @@ const staticProviders: Provider[] = [
},
});
- if (!dbUser) throw new Error("Invalid credentials");
- if (dbUser.password === null)
+ if (!dbUser) {
+ // Keep bcrypt work comparable across failed login paths to reduce timing-based user enumeration.
+ await hashPassword(credentials.password);
+ throw new Error("Invalid credentials");
+ }
+
+ if (dbUser.password === null) {
throw new Error(
"Please sign in with the identity provider (e.g. Google, GitHub, Azure AD, etc.) that is linked to your account.",
);
+ }
const isValidPassword = await verifyPassword(
credentials.password,