Skip to content

Content Security Policy Headers

Medium — good to knowSecurity

ELI5 — The Vibe Check

CSP tells the browser exactly where scripts, styles, images, and other resources are allowed to load from. If a hacker injects a script pointing to evil.com, CSP blocks it because evil.com isn't on the approved list. It's a whitelist for everything your page is allowed to load.

Real Talk

Content Security Policy is an HTTP header that prevents XSS, clickjacking, and code injection by declaring approved content sources per resource type. Directives include default-src, script-src, style-src, img-src, connect-src, and frame-ancestors. Report-only mode enables testing without enforcement.

When You'll Hear This

"CSP blocked an XSS payload because we don't allow 'unsafe-inline' scripts." / "Start with CSP in report-only mode to find violations before enforcing."

Made with passive-aggressive love by manoga.digital. Powered by Claude.