Technical Medium Frontend DevOps/SRE Software Engineer

What is Content Security Policy (CSP), and how does it prevent Cross-Site Scripting (XSS)?

Practise this question with AI feedback

Record your spoken answer or type your response to receive immediate scoring and STAR improvements.

💡 Suggested Approach & Sample Answer

Browser Defense in Depth:
- Definition: Content Security Policy (CSP) is an HTTP response header that restricts the resources (scripts, styles, images, iframes) the browser is allowed to load and execute for a given page.

1. How CSP Blocks XSS:
- Disables Inline Execution: By default, a strict CSP rejects inline