Interview practice question
Reducing the impact of a successful XSS on sessions
Frontend Engineering · Frontend System Design · Experienced
Assume an attacker eventually finds an XSS bug. How would you design authentication so the damage is limited?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- HttpOnly cookies; no tokens in JS-readable storage.
- Short-lived sessions; re-auth for sensitive actions.
- CSP to limit exfiltration and script injection.
- Server-side anomaly detection, session revocation.
- Least privilege per session.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.