Harden authentication, tenant isolation and security boundaries

This commit is contained in:
t.indorf
2026-10-09 22:49:55 +02:00
parent ec3f4f933d
commit 656ada80bd
71 changed files with 3107 additions and 1200 deletions
+2 -7
View File
@@ -3,6 +3,7 @@
import { AuthError } from "next-auth";
import { z } from "zod";
import { safeCallbackUrl } from "@/lib/safe-redirect";
import { signIn } from "@/auth";
// =====================================================================
@@ -17,7 +18,7 @@ import { signIn } from "@/auth";
const loginSchema = z.object({
email: z.string().email("Bitte eine gültige E-Mail-Adresse angeben.").toLowerCase().trim(),
password: z.string().min(1, "Passwort fehlt."),
password: z.string().min(1, "Passwort fehlt.").max(72),
callbackUrl: z.string().optional(),
});
@@ -29,12 +30,6 @@ export type LoginState = {
};
};
function safeCallbackUrl(value: string | undefined) {
if (!value) return "/dashboard";
if (!value.startsWith("/") || value.startsWith("//")) return "/dashboard";
return value;
}
export async function loginAction(
_prev: LoginState,
formData: FormData,