Skip to main content
All Terms Glossary

Content Security Policy (CSP)

Definition

Content Security Policy is a browser security mechanism that helps prevent various types of attacks, including Cross-Site Scripting (XSS) and other code injection attacks. CSP works by specifying which content sources the browser should consider valid, controlling everything from script execution to image loading. It provides granular control over resource loading and helps maintain a strict security boundary around web applications.

What a CSP does

A Content Security Policy is an HTTP response header, or meta tag, that tells the browser which sources of scripts, styles, images, and other resources are allowed to load on a page. By declaring an allow-list, a CSP can block inline scripts and untrusted domains, which limits the impact of cross-site scripting and unauthorised resource loading. It is a browser-enforced defence-in-depth control, not a standalone security product.

Where CSP falls short

A CSP governs where scripts may load from, not what they do once loaded. If you allow-list a third-party vendor and that vendor is compromised, the browser still trusts and runs the malicious script. CSPs are also hard to maintain: unsafe-inline, broad wildcards, and long allow-lists creep in to avoid breaking functionality, quietly eroding the protection, and report-only mode plus alert fatigue means violations often go unwatched.

How cside complements a CSP

cside addresses exactly the gap a CSP leaves: it inspects the behaviour of the allow-listed scripts a CSP permits. When a trusted script starts reading card fields or contacting a new domain, cside flags and can block it, regardless of the CSP verdict. Used together, a CSP narrows which scripts can load and cside verifies that the ones that do load stay honest.

Definition

Is a CSP enough to secure my payment pages?

No. A CSP restricts script sources but cannot tell whether an allow-listed script has been tampered with. PCI DSS 6.4.3 and 11.6.1 expect you to both manage which scripts run and monitor their integrity and behaviour; the second half is what a CSP does not provide.

Definition

What is the most common CSP mistake?

Weakening the policy to avoid breakage, adding unsafe-inline, wildcard sources, or a long list of third-party domains, until it no longer meaningfully restricts anything. A permissive CSP can give a false sense of security while allowing most of what it was meant to block.

Got more questions

Talk to a security expert

We answer client-side security questions every day. Bring yours.

Book a demo

Want to walk through this with an engineer?

Thirty minutes, on your own site. Not a slide deck.

We'll show you:

Which third-party scripts are running on your site right now
Where you stand on PCI DSS 6.4.3 and 11.6.1
How much of your traffic is bots and AI agents

Rather just send a question?

Finding open slots…

Real humans only. We'd know.

Having trouble booking? Open scheduler in a new tab

What are you trying to solve?

Tell us in a line and we'll come back with something useful, not a generic pitch.

We usually help with:

Seeing which third-party scripts run on your site
PCI DSS 6.4.3 and 11.6.1 evidence
Bots, AI agents and account takeover

Prefer to just book a time? Pick a slot instead