Web Security · Junior · Question 64 of 75

With Content-Security-Policy: script-src 'self', what happens to <script>alert(1)</script> written into the page?

Explanation

Blocking inline scripts is what makes CSP useful against XSS. Inline event handlers like onclick are blocked too.

Further reading

Problem with a question

Web Security · Junior · question 64

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