hard20 pts · first answer countsssrnodejsweb-security
Module variable holds the current user
An SSR app on a long-running Node server stores the current user like this. Under load, some users see another person’s name in the header. What is happening?
// lib/current-user.ts
let currentUser: User | null = null
export function setCurrentUser(u: User) { currentUser = u }
export function getCurrentUser() { return currentUser }
// called at the start of every request, then read during renderDiscussion 0
Join free to post in the discussion.
Related questions
- What HttpOnly doesFull Stack Developer
- Empty req.body in ExpressFull Stack Developer
- What HTTPS protectsFull Stack Developer
- Why commit the lockfileFull Stack Developer
- Caching a bank statement pageFull Stack Developer
- What ^3.22.4 allowsFull Stack Developer
- Users see each other’s profileFull Stack Developer
- User bios rendered as HTMLFull Stack Developer