race condition security patch

This commit is contained in:
Christian Beutel
2025-04-18 12:59:17 +02:00
parent 29b8a0352e
commit d8f7a862f6
53 changed files with 240 additions and 222 deletions

View File

@@ -1,9 +1,10 @@
import type { User } from '$lib/models/user';
import { pb } from '$lib/pocketbase';
import { getPb } from '$lib/pocketbase';
import { currentUser } from '$lib/stores/user_store';
const pb = getPb();
pb.authStore.loadFromCookie(document.cookie)
pb.authStore.onChange(() => {
pb.authStore.onChange(() => {
currentUser.set(pb.authStore.record as User)
const secure = location.protocol === "https:"
document.cookie = pb.authStore.exportToCookie({ httpOnly: false, secure: secure, sameSite: "Lax" })