Skip to content

Lesson 3 of 11 · 18 min read

Content Security Policy in Depth

A Content Security Policy is a response header the browser enforces for one document: it decides which scripts, styles, frames and connections the page may use, blocks the rest and can report violations. Host allowlists failed in practice because allowed domains host code an attacker can reuse. A strict policy trusts scripts by per-response nonce or by hash, propagates trust with strict-dynamic, and adds object-src and base-uri. Trusted Types closes DOM sinks. CSP limits XSS impact; it does not fix XSS or stop data leaving.

Reviewed By the AISecurityInterviews editorial team
free sign-in, no card required

Practise it as an interviewer asks it

Related lessons