CS Fundamentals Trainer · JavaScript · Security
A server uses a nonce-based CSP. Put the steps for one page view in order, first to last.
- The browser parses a `<script>` tag and compares its `nonce` with the policy
- The browser runs the script because the values match
- The server generates a fresh, unguessable random value for this response
- The server sends `Content-Security-Policy: script-src 'nonce-<value>'` in the response headers
- The server writes the same value into the `nonce` attribute of each of its `<script>` tags in the body
Difficulty: medium