What is Content Security Policy?
DefinitionContent Security Policy (CSP) is a browser security standard that lets a website declare which sources of scripts, styles, images and other content may load, helping prevent cross-site scripting and other injection attacks.
Also known as CSP
A site sends its policy in the Content-Security-Policy HTTP header, or in a meta tag, with directives such as script-src and img-src that list trusted sources. The browser then blocks anything that doesn't match, such as an inline script injected by an attacker, and can report violations to an address the site chooses.
CSP is developed by the W3C's Web Application Security Working Group and is supported by all modern browsers. Strict policies that use nonces or hashes instead of long allowlists give the strongest protection against cross-site scripting. Adding third-party tools such as analytics or embeds usually means updating the policy, and many sites start in report-only mode to find problems before enforcing it. CSP works alongside other defenses such as a web application firewall.
Content Security Policy resources
Topics: Privacy and security, Web development
Cite this definition
- APA
What is Content Security Policy? (2026, November 22). Glossary. https://glossary.io/content-security-policy/
- MLA
“What Is Content Security Policy?” Glossary, Coywolf, 22 Nov. 2026, glossary.io/content-security-policy/.
- Chicago
“What Is Content Security Policy?” Glossary. Coywolf. November 22, 2026. https://glossary.io/content-security-policy/.
- HTML link
<a href="https://glossary.io/content-security-policy/">What is Content Security Policy?</a>
Published