hardStudy question · answer published in TypeScript interview questions, so no pointsssrnodejsweb-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
- Stored versus reflected XSSFull Stack Developer
- Writing location.hash into the pageFull Stack Developer