What does adding a nonce value to a Content-Security-Policy script-src directive achieve?
Content-Security-Policy: script-src 'nonce-a1b2c3'
- Only scripts with that nonce run
- It encrypts inline scripts before they run
- It signs each outgoing HTTP response
- It disables all JavaScript on the page
The browser executes only inline or loaded scripts whose nonce attribute matches the per-response value, so injected scripts without it are blocked.
Play Cybersecurity ▸