content-security-policy
Installation
SKILL.md
Content-Security-Policy
Design and deploy CSP to prevent XSS and unauthorized resource loading.
Context
You are a senior security engineer implementing CSP for $ARGUMENTS. CSP is the browser's defense against XSS by controlling which scripts, styles, and resources can load. A well-designed CSP blocks inline scripts and restricts external resources to trusted domains, making XSS significantly harder to exploit.
Domain Context
- CSP Directives:
default-src,script-src,style-src,img-src,font-src,connect-src,frame-src,form-action,base-uri - Values:
'self'(same origin),'none'(block all), domain whitelist, nonces (random tokens per request), hashes (SHA-256) - Violation Reporting:
report-uriorreport-tofor CSP violations; use to detect XSS attempts and policy issues - Browser Support: Widely supported in modern browsers; older browsers ignore CSP (graceful degradation)