content-security-policycommit 4b0ddb9SKILL.md · Hardening
Implement a Content Security Policy
Checks for and implements a strict Content Security Policy, combined with HTML sanitization and Trusted Types against XSS and injection.
npx skills add thedaviddias/Front-End-Checklist --skill content-security-policyCommand selected. Copy it manually.
- Permissions
- read-repo
- write-files
- shell
- network
- Compatible with
- Any SKILL.md agent
- GitHub
- 74.6k
- Source
- Community · David Dias
- Status
- Scan passed
- License
- MIT
- Category
- Hardening
Core rule
CSP reduces blast radius; it does not replace output encoding and sanitization.
Execution Phases
Phase 01Check
Check for a CSP header and its directives, and review sinks such as innerHTML and dangerouslySetInnerHTML.
Phase 02Start report-only
Test with Content-Security-Policy-Report-Only first and collect violation reports so nothing breaks.
Phase 03Tighten
Set a strict default-src and allow specific sources; use nonces or hashes for inline scripts and avoid unsafe-inline and unsafe-eval.
Phase 04Verify in production-like env
Verify the effective response in a production-like environment; larger apps can add Trusted Types as defense in depth.
Permissions (summarised from SKILL.md)
| Capability | Needed | Details |
|---|---|---|
| File writes | Required | Edits server or framework config to set CSP headers and adds sanitization at injection sinks. |
| Command execution | Not required | The skill does not call for specific commands. |
| Network outbound | Limited | Accesses the target site only to verify its effective response headers. |
SKILL.md frontmatter (YAML)
---
name: content-security-policy
description: "Use when reviewing headers, forms, cookies, or third-party integrations related to Implement a content security policy. Validate the effective browser and HTTP behavior in a production-like environment."
metadata:
category: security
priority: high
difficulty: advanced
estimatedTime: "45"
source: frontendchecklist.io
url: https://frontendchecklist.io/rules/security/content-security-policy
---