feat: Security CSRF Fix, Logout optimierung, Footer Anpassung, Rechtstexteanpassung
Docker Image bauen und veroeffentlichen / build-and-push (push) Failing after 1m33s
Docker Image bauen und veroeffentlichen / build-and-push (push) Failing after 1m33s
This commit is contained in:
1 parent
0753a3bc8a
commit
4d3100e9ba
28 files changed
+802
-121
No files matched your search
@@ -6,6 +6,7 @@ import { checkoutSchema } from "@/lib/validation";
|
||||
import { getProductsByIds } from "@/lib/data";
|
||||
import { getCurrentCustomer } from "@/lib/auth";
|
||||
import { rateLimit, getClientIp } from "@/lib/rate-limit";
|
||||
import { isTrustedOrigin } from "@/lib/csrf";
|
||||
import { getShippingCostCents } from "@/lib/shipping";
|
||||
import { isDiscountCodeValid, calculateDiscountCents } from "@/lib/discount-calc";
|
||||
import { ensureBulkDiscountCode } from "@/lib/bulk-discount";
|
||||
@@ -23,6 +24,14 @@ function generateOrderNumber(): string {
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
// Route-Handler haben (anders als Server Actions) keinen eingebauten
|
||||
// CSRF-Schutz — siehe lib/csrf.ts. Ohne diese Pruefung koennte eine fremde
|
||||
// Seite per gefaelschtem Cross-Site-POST Bestellungen unter dem Konto
|
||||
// einer eingeloggten Kundschaft anlegen und Lagerbestand reservieren.
|
||||
if (!isTrustedOrigin(request)) {
|
||||
return NextResponse.json({ error: "Ungültige Anfrage." }, { status: 403 });
|
||||
}
|
||||
|
||||
const ip = await getClientIp();
|
||||
if (!rateLimit(`checkout:${ip}`, 10, 60 * 60 * 1000)) {
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in new issue
Block a user