No Content-Security-Policy: What It Means and How to Fix It
Your site is not sending a Content-Security-Policy header, so the browser has no allowlist for where scripts and other resources may load from. That does not mean you have been attacked, but it does mean a cross-site scripting flaw would do more damage than it should. Here is a safe, step-by-step path to adding a policy without breaking your pages.
One free scan, no login. This check runs alongside DNS, email, TLS, headers, exposed files and known CVEs.
What a Content-Security-Policy actually does
A Content-Security-Policy (CSP) is a response header your web server can send with every page. It tells the browser an allowlist: which origins are allowed to serve scripts, styles, images, fonts and other resources for that page. When the header is present, the browser refuses to load or run anything that is not on the list.
BadgerScan flagged this finding because your site sends no Content-Security-Policy header at all. From the outside view, we can see the header is simply missing, which means the browser falls back to its default behaviour and trusts any resource the page references, from any origin.
The header is a plain list of directives. For example, default-src 'self' tells the browser to only load resources from your own origin unless a more specific rule says otherwise (MDN, Content-Security-Policy). Each resource type, such as script-src or style-src, can then be tuned to allow the specific third parties you actually use.
Why it is worth fixing
A CSP is a safety net, not a lock on the front door. Its main job is to limit the damage if a cross-site scripting (XSS) flaw ever slips into your site, for example through a comment field, a plugin, or an ad. Without a policy, an injected script can run freely and load code from anywhere. With a sensible policy, the browser blocks scripts from origins you never approved, so many XSS attempts simply fail to execute (OWASP, Content Security Policy Cheat Sheet).
Because this is a low-severity finding, there is no rush and nothing is broken today. It is a hardening step: you are reducing how bad a future problem could be, rather than fixing an active issue. That is why it is worth doing carefully rather than quickly.
How to fix it, step by step
The safe approach is to watch before you enforce. CSP has a report-only mode that lets you see exactly what your pages load without blocking anything, so you can build an accurate policy before turning it on for real. Work through these steps in order:
- Start in report-only mode. Add a
Content-Security-Policy-Report-Onlyheader instead of the enforcing one. In this mode the browser reports what a policy would have blocked but still lets every resource load, so nothing on your site breaks. - Begin from your own origin. Set a starting policy of
default-src 'self', which allows resources only from your own domain. This is your baseline before you add any exceptions. - Discover what your pages really load. Browse your site normally with report-only active, and watch which resources get reported as violations. Those are the legitimate third parties (fonts, analytics, a payment widget) you will need to allow.
- Add the third-party origins you need, and only those. For each real dependency, add its exact origin to the right directive, for example
script-src 'self' https://www.googletagmanager.com. Keep the list as short as the site genuinely requires. - Enforce and retest. Once report-only shows no unexpected violations, switch the header name to
Content-Security-Policyto enforce it. Then click through the whole site again to confirm nothing broke. Build this policy up per site, because every site loads a different set of resources.
The one thing not to do
Do not paste in a strict policy and enforce it straight away. An over-strict CSP will block legitimate scripts and styles, and the result is usually a visibly broken page: missing fonts, dead buttons, or checkout flows that stop working. That is exactly why report-only mode comes first. It gives you the full list of what your pages load before any rule is enforced, so you enforce a policy you have already proven is complete.
After you go live, you can re-check the header with our security headers checker or by running the free scan again to confirm the Content-Security-Policy header is now present.
Check your security headers in under a minute
Not sure whether your site sends a Content-Security-Policy header? Run the free BadgerScan scan to see the outside view of your response headers, including CSP, in about a minute. No login and no changes to your site, just a clear read of what is publicly visible. Fix the header, then rescan to confirm it is in place.
Run a free security scanFrequently asked questions
Is a missing CSP a serious problem?
No, this is a low-severity finding. Nothing on your site is broken and it is not a sign you have been attacked. A CSP is a hardening measure that limits how much damage a future cross-site scripting flaw could cause, so it is worth adding when you have time to test it.
Will adding a CSP break my website?
It can if you enforce an over-strict policy too early, because the browser will block resources that are not on your allowlist. That is why you start with the Content-Security-Policy-Report-Only header, which reports violations without blocking anything, so you can see what your pages load before you enforce.
What does default-src 'self' mean?
It is the baseline rule of a policy. default-src 'self' tells the browser to load resources only from your own origin unless a more specific directive allows otherwise (MDN, Content-Security-Policy). You then add the specific third-party origins your site genuinely needs, such as a font host or analytics provider.
How do I confirm the header is fixed?
Run the free BadgerScan scan again after you enforce the policy. It reads the outside view of your headers and will confirm whether a Content-Security-Policy header is now being sent, with no login required.
Sources
More from CyberBadger
BadgerScan is the website side of what we do. We're one local Hamilton and Burlington team for your whole setup, on-site nearby and remote across Canada.
Coming soon: BadgerAudit. A full, on-site cybersecurity audit, interviews, hands-on review, and a detailed report, for when a self-serve scan isn't enough. Ask us about it.