fix(security): authorize site uploads and harden tokens, media and request identity
This commit is contained in:
1 parent
52f6d1491f
commit
8abfe352ef
70 files changed
+1609
-204
No files matched your search
@@ -3,6 +3,7 @@ import { headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { unixNow } from "@/lib/bans";
|
||||
import { resolveClientIp } from "@/lib/client-ip";
|
||||
import { Ban, db } from "@/lib/db";
|
||||
import { safeRedirect } from "@/lib/foundation/security";
|
||||
import { logger } from "@/lib/logger";
|
||||
@@ -26,10 +27,7 @@ function isExempt(path: string): boolean {
|
||||
export async function enforceSiteAccess(): Promise<void> {
|
||||
const h = await headers();
|
||||
const path = h.get("x-pathname") ?? "/";
|
||||
const ip =
|
||||
h.get("x-real-client-ip") ??
|
||||
h.get("x-forwarded-for")?.split(",")[0]?.trim() ??
|
||||
"0.0.0.0";
|
||||
const ip = resolveClientIp(h);
|
||||
|
||||
void recordRequest(ip).catch(() => {});
|
||||
|
||||
|
||||
Reference in new issue
Block a user