$ ./guess_the_languageCybersecurity
Cybersecurity · medium · #280

What does adding a nonce value to a Content-Security-Policy script-src directive achieve?

Content-Security-Policy: script-src 'nonce-a1b2c3'
  1. Only scripts with that nonce run
  2. It encrypts inline scripts before they run
  3. It signs each outgoing HTTP response
  4. 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 ▸