JavaScript · Senior · Question 65 of 75

How do CSP nonces allow specific inline scripts?

Content-Security-Policy: script-src 'nonce-r4nd0m'
<script nonce="r4nd0m">...</script>

Explanation

The nonce must be unpredictable and regenerated on every response, which makes pages dynamic. 'strict-dynamic' lets trusted scripts load further scripts.

Further reading

Problem with a question

JavaScript · Senior · question 65

Test yourself

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

Take this quiz