Content-Security-Policy header is present
Why it matters
Without a Content-Security-Policy, any XSS vulnerability in your app becomes a full code execution primitive — injected scripts can exfiltrate cookies, keylog form inputs, or pivot to your users' other browser contexts. CSP is the browser-enforced last line of defense: even when input sanitization fails, a tight policy prevents injected scripts from loading external resources or executing inline. OWASP A03 (Injection) and A05 (Security Misconfiguration) both call out missing CSP as a critical gap; CWE-79 names the XSS class that a CSP directly mitigates. Without it, a single missed sanitization anywhere in your rendering pipeline becomes an account-takeover vector.
Severity rationale
High because the absence of any CSP removes the last browser-enforced barrier against XSS exploitation, leaving injected scripts with unrestricted execution access.
Remediation
Add a Content-Security-Policy header starting with a restrictive default-src 'self' and expand from there based on what your app actually loads. Start minimal and use browser console violation reports to tune.
// next.config.js
headers: [{
key: 'Content-Security-Policy',
value: "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'"
}]
If your app uses third-party scripts, add their domains explicitly (script-src 'self' https://cdn.example.com) rather than using the wildcard *. For inline scripts, use nonces rather than unsafe-inline — see the csp-no-unsafe-inline pattern for the nonce implementation.
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 Security Headers & Basics Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-1021 — Improper Restriction of Rendered UI Layers or Frames
- cwe · CWE-79 — Improper Neutralization of Input During Web Page Generation (XSS)
- owasp:2021 · A05 — Security Misconfiguration
- owasp:2021 · A03 — Injection
- soc2:2017 · CC6.6 — Protection against threats from outside system boundaries
Taxons
History
- 2026-04-17·v1.0.0·Initial import from security-headers·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.6) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2