Interview practice question
Safely displaying user-uploaded HTML or SVG content
Frontend Engineering · Frontend System Design · Intermediate
Your app lets users upload SVG images and rich text that other users view. How would you display it safely?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- SVG and HTML can contain scripts.
- Sanitise server-side and client-side (DOMPurify).
- Serve from separate sandbox domain.
- Render in img tag for SVG; sandboxed iframe.
- CSP restrictions.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.