Content Security Policy (CSP)

5 minutes 5 Questions

Content Security Policy (CSP) is a security feature that helps prevent cross-site scripting (XSS) and other code injection attacks. It allows web developers to define a whitelist of trusted sources for content, such as scripts, images, and styles. When implemented correctly, CSP can effectively blo…

Test mode:
CompTIA Security+ - Content Security Policy (CSP) Example Questions

Test your knowledge of Content Security Policy (CSP)

Question 1

A website manager wants to allow loading images from only their domain and a trusted CDN. Which CSP policy achieves this?

Question 2

A company wants to implement subresource integrity for their external script. Which CSP directive can be used in combination with the script element 'integrity' attribute?

Question 3

A web application developer wants to prevent cross-site scripting (XSS) attacks. Which CSP directive should be used to restrict the sources of script files?

More Content Security Policy (CSP) questions
2 questions (total)