Interview practice question
Download endpoint exposes server files
Backend Engineering · Auth and Security · Intermediate
Your endpoint /download?file=report.pdf returned /etc/passwd when someone passed file=../../etc/passwd. How do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Path traversal.
- Never build paths from raw input.
- Use IDs mapped to stored files.
- Normalise and check path stays in base dir.
- Serve from object storage with access checks.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.