Content Security Policy header present and allows essential resources
Why it matters
A missing Content Security Policy header leaves the application exposed to cross-site scripting via CWE-693 (Protection Mechanism Failure) and is a finding under OWASP A05 (Security Misconfiguration). CSP restricts which scripts, styles, and resources the browser will execute — without it, any XSS vector can load arbitrary scripts from external origins. For SEO, a compromised site that injects spam links or redirects risks Google Safe Browsing flagging, which removes the site from SERPs entirely until manual review clears it. A CSP that blocks analytics scripts is also a failure mode — it silently stops tracking data without an error.
Severity rationale
Low in this audit context because CSP is a defense-in-depth control and its absence doesn't constitute an active vulnerability — but any existing XSS vector becomes higher-impact without it.
Remediation
Add CSP headers in next.config.js using the headers() async function. Start with a report-only policy to detect violations before enforcing:
// next.config.js
async headers() {
return [{
source: '/(.*)',
headers: [{
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-inline' *.google-analytics.com *.vercel-insights.com",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: https:",
"font-src 'self' fonts.gstatic.com",
"connect-src 'self' *.supabase.co *.google-analytics.com",
].join('; ')
}]
}]
}
Verify with curl -I https://yoursite.com | grep -i content-security-policy. Add report-uri to a CSP reporting endpoint (e.g., Report URI) to catch violations from real users before tightening the policy.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Advanced SEO Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-693 — Protection Mechanism Failure — absent CSP
- owasp:2021 · A05 — Security Misconfiguration — missing security headers
Taxons
History
- 2026-04-18·v1.0.0·Initial import from seo-advanced·automated