ReviewOS

also looking at this

stacks/bench-review

Close unauthenticated /api/requests CRUD, and make the session cookie HttpOnly

#77
Merged glennmichael123 wants to merge fix/request-autocrud-and-httponly into main
11 files +552 -57
resources/stores/notifications.tsmodified+5-1
Changes to resources/stores/notifications.ts
@@ -22,7 +22,11 @@ defineStore('notifications', () => {
2222
2323 async function fetchNotifications(): Promise<void> {
2424 const authStore = useStore('auth')
25 if (!authStore.token()) return
25 // isAuthenticated(), not token(): the token is in-memory only since the
26 // session moved to an HttpOnly cookie, so it is empty after a reload while
27 // the session is still valid. Keying off it here meant the bell silently
28 // stopped fetching on every hard refresh.
29 if (!authStore.isAuthenticated()) return
2630 loading.set(true)
2731 try {
2832 const res = await authStore.authFetch(`/api/me/notifications?filter=${filter()}&limit=30`)