Browser & Web Performance · Junior · Question 64 of 75

If you must insert user-provided HTML (e.g. formatted comments), what should you do?

Explanation

Regex filters miss vectors like <img src=x onerror=...> or <svg onload>. A real sanitizer parses HTML and keeps only an allowlist.

Further reading

Problem with a question

Browser & Web Performance · Junior · question 64

Test yourself

Take the Browser & Web Performance · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz