Interview practice question
Preventing open redirects after login
Frontend Engineering · Frontend System Design · Intermediate
Your login page redirects users to a returnUrl parameter after login. What risk does this create, and how do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Open redirect to attacker sites (phishing).
- Allow only relative paths or allowlisted hosts.
- Validate on server.
- Reject javascript: and protocol-relative URLs.
- Fallback to default page.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.