Web Security · Junior · Question 23 of 75

Why can <a href={user.website}> in React still lead to XSS?

Explanation

Escaping protects against breaking out of the attribute, but javascript: is a valid URL scheme. Validate the protocol before using user-supplied links.

Further reading

Problem with a question

Web Security · Junior · question 23

Test yourself

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

Take this quiz