touchups after refactor

This commit is contained in:
Christian Beutel
2025-01-03 00:13:59 +01:00
parent 871481a84e
commit 0d2e71c2f6
32 changed files with 1157 additions and 45 deletions

View File

@@ -20,7 +20,7 @@ function csrf(allowedPaths: string[]): Handle {
request.method === "PATCH" ||
request.method === "DELETE") &&
request.headers.get("origin") !== url.origin &&
!allowedPaths.includes(url.pathname);
!allowedPaths.some(p => url.pathname.startsWith(p));
if (forbidden) {
const message = `Cross-site ${request.method} form submissions are forbidden`;
@@ -111,4 +111,4 @@ const auth: Handle = async ({ event, resolve }) => {
return response
}
export const handle = sequence(csrf(['/api/v1/trail/upload']), auth)
export const handle = sequence(csrf(['/api/v1']), auth)