What is a Content Security Policy?
A clear explanation of what a Content Security Policy is, why teams lose track of it, and what becomes visible once it is defined.
Last updated 01/21/2026
A Content Security Policy (CSP) is a set of rules a website sends to the browser that defines what the site is allowed to load and run. It names which sources are trusted for scripts, images, styles, frames, and other resources, and tells the browser to block everything else. A CSP makes expected behavior explicit instead of relying on browser defaults.
What a Content Security Policy is
A Content Security Policy is a declaration of intent. It states which external systems a site depends on and which ones it does not. Once the policy exists, the browser enforces those boundaries consistently. The browser no longer guesses.
Where teams usually encounter this
Teams often encounter CSP indirectly. The site appears healthy. Pages load. Features work. Yet questions about where code comes from or why certain requests exist lead to repeated investigation instead of clear answers. Nothing is obviously broken, but confidence erodes.
Why this happens as sites grow
As sites grow, ownership spreads across teams, vendors, and tools. Each addition makes sense locally. Without a single policy that names what is allowed, the full picture never exists in one place. The absence of a CSP is rarely deliberate. It is the result of growth without explicit limits.
What’s wrong
Without a Content Security Policy, the browser cannot distinguish expected behavior from unexpected behavior. Everything looks acceptable, including things that should not be there.
Why it matters
Most security incidents begin with ambiguity, not alarms. A CSP reduces ambiguity by making intent explicit. When expectations are clear, unexpected behavior stands out.
The correct change
Define a Content Security Policy that reflects how the site actually behaves today. Instruct the browser to allow only known, intentional sources and block everything else.
Scope
This is usually enforced at the template or header level. The same policy should apply wherever the same page structure and delivery path are used.
How to verify
Inspect the response headers to confirm a Content Security Policy is present. When a resource violates the policy, the browser blocks it and records a violation.
What becomes clearer once a CSP exists
- Which external systems the site actually depends on
- Which behaviors are intentional versus accidental
- Where dependency drift has accumulated
- When new behavior appears without agreement