Browser & Web Performance · Middle · Question 61 of 75

How does a nonce-based CSP decide which inline scripts may run?

Content-Security-Policy: script-src 'nonce-r4nd0m'
<script nonce="r4nd0m">init()</script>

Explanation

An attacker can't guess a fresh random nonce. Reusing the same nonce across responses defeats the protection.

Further reading

Problem with a question

Browser & Web Performance · Middle · question 61

Test yourself

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

Take this quiz