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
+12
View File
@@ -0,0 +1,12 @@
import { NotdienstAlertStatus } from "@prisma/client";
import { hashToken } from "@/lib/tokens";
export function activeAlertTokenWhere(token: string) {
const today = new Date(); today.setUTCHours(0, 0, 0, 0);
return {
confirmationToken: { in: [hashToken(token), ...(token.length === 36 ? [token] : [])] },
status: NotdienstAlertStatus.PENDING,
triggeredAt: { gt: new Date(Date.now() - 24 * 60 * 60_000) },
assignment: { date: { gte: today } },
parentUser: { disabledAt: null },
};
}