What is Content Security Policy (CSP)?
also: CSP
// short answer
A security header that tells browsers which scripts, styles and other files your site is allowed to load, which limits the damage of injected code.
In plain English
A Content Security Policy is a response header your site sends with every page. It is a list of rules: where scripts may come from, where images may come from, whether the page can be framed, and so on. The browser enforces those rules and blocks anything that breaks them.
Content-Security-Policy: default-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'self'; base-uri 'self'Its main job is to limit cross-site scripting. If an attacker manages to sneak a script into your page, a good policy stops the browser from running it. Policies that include 'unsafe-inline' for scripts lose much of that protection, because inline scripts are exactly what injected code usually looks like.
The frame-ancestors directive also controls who may frame your site, which protects against clickjacking.
Why it matters to a small business
Most small-business sites load scripts from plugins, analytics and chat widgets. A CSP is a safety net: it does not fix a vulnerability, but it can stop one from turning into stolen logins or a defaced page.
What to do
Start with a report-only policy (Content-Security-Policy-Report-Only) so nothing breaks, review what it would block, then switch it on. Building a policy for a busy WordPress site takes some care, which is the kind of job our fix work covers.