All quizzes
Free quiz · 20 questions in the bank

Content Security Policy quiz

Test your Content Security Policy knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

Why is allowing `'unsafe-inline'` in a `script-src` directive generally discouraged from a security standpoint?

Questions in this quiz
  1. Why is allowing `'unsafe-inline'` in a `script-src` directive generally discouraged from a security standpoint?
  2. What is a CSP "nonce," used as an alternative to 'unsafe-inline' for permitting specific inline scripts?
  3. Why is a CSP that includes a wildcard like `script-src *` generally considered ineffective as a security control?
  4. What does the `script-src` CSP directive control?
  5. Why is CSP considered a "defense in depth" measure rather than a substitute for proper input sanitization and output encoding?
  6. How is a Content Security Policy typically delivered to the browser?
  7. What does `object-src 'none'` typically aim to prevent?
  8. What does the `default-src` CSP directive do?
  9. Why does adopting a strict CSP retroactively on an existing, mature web application often require significant upfront effort?
  10. What is the purpose of the `upgrade-insecure-requests` CSP directive?
  11. What is the purpose of running CSP in "report-only" mode (`Content-Security-Policy-Report-Only` header) before fully enforcing a policy?
  12. What is a reasonable general strategy for defining a CSP that balances security with maintainability for a complex web application?
Gaps to close?
Read the curated Content Security Policy notes — core concepts, patterns, interview prep.
Content Security Policy notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web