What is the primary purpose of the ‘Content-Security-Policy’ (CSP) ‘script-src’ directive?

Web Development Hard

Web Development — Hard

What is the primary purpose of the ‘Content-Security-Policy’ (CSP) ‘script-src’ directive?

Key points

  • Mitigates Cross-Site Scripting (XSS).
  • Restricts execution to trusted domains.
  • Supports nonces and hashes for inline scripts.
  • Does not replace server-side input validation.

Ready to go further?

Related questions