Study. uk . com
  1. Home
  2. All questions
  3. Question 151

CompTIA Security+ study material · question 151 of 611

What role does a Content Security Policy play in defending against cross-site scripting?

  1. It validates input before it reaches the application
  2. It replaces the need for output encoding
  3. It encrypts the response body
  4. It is a defence in depth that limits which script sources the browser will execute
Show the answer

Answer: D. It is a defence in depth that limits which script sources the browser will execute

A policy reduces what an injection can do if one slips through; it does not remove the need to encode output.

Source: OWASP Cross Site Scripting Prevention Cheat Sheet (OWASP) — OWASP Cross Site Scripting Prevention Cheat Sheet › Content Security Policy

Challenge yourself on this topic → Study as cards