Terminology Index
Glossary
2953 terms
C32
CSP
Content Security Policy: a browser security mechanism, delivered via an HTTP header, that lets a site restrict which sources of scripts, styles, and other content the browser will load, sharply reducing the impact of cross-site scripting.
CSP tells the browser which origins are trusted for each content type, so even if an attacker injects a script, the browser refuses to run it unless its source is allowed. A well-crafted policy is one of the strongest defenses against cross-site scripting and related injection, though it must be tuned carefully to avoid breaking legitimate content. It is configured through response headers alongside other browser protections.
Introduced in: Defensive Web Fundamentals
Examples
- A policy that only allows scripts from the site's own origin, blocking injected ones.
- Using CSP to disallow inline scripts that XSS often relies on.
- Tuning a policy so legitimate third-party resources still load.
