web-player: fix open redirect via returnTo, require SESSION_SECRET and validate API inputs

This commit is contained in:
2026-09-24 04:58:08 +02:00
parent b2f450dcf7
commit 3e546d4a1e
12 changed files with 64 additions and 13 deletions
+4 -2
View File
@@ -1,9 +1,11 @@
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { safeReturnTo } from '$lib/server/auth';
export const load: PageServerLoad = ({ locals, url }) => {
const returnTo = safeReturnTo(url.searchParams.get('returnTo'));
if (locals.user) {
redirect(302, url.searchParams.get('returnTo') ?? '/');
redirect(302, returnTo);
}
return { returnTo: url.searchParams.get('returnTo') ?? '/' };
return { returnTo };
};