csp-analysis

Analyze Content-Security-Policy headers and meta tags to flag weak directives on authorized targets.

1|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/mccleod1290/bb-agentic-setupv2 --skill csp-analysis-mccleod1290
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: csp-analysis
Source: https://github.com/mccleod1290/bb-agentic-setupv2/tree/main/web-skills/csp-analysis
Command: npx skills add https://github.com/mccleod1290/bb-agentic-setupv2 --skill csp-analysis-mccleod1290

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Manually inspecting Content-Security-Policy headers across targets is slow and error-prone, and weak directives like unsafe-inline or wildcards are easy to miss during recon. This Skill automates CSP extraction and heuristic analysis so security testers can quickly identify XSS and clickjacking leads on in-scope hosts. ## Core Features & Use Cases - CSP Extraction and Parsing: Fetches a URL with a low-volume GET request, collects policies from both response headers and HTML meta tags, and parses them into structured directives. - Weakness Detection: Flags unsafe-inline, unsafe-eval, wildcards, missing object-src, missing base-uri, and frame-ancestors gaps, then rates each policy's strength. - Structured Reporting: Writes REPORT.md and csp.json under notes/{target}/recon-data/csp-analysis/ for downstream cartographer and hypothesis workflows. - Use Case: During the recon phase of a bug-bounty engagement, run the analyzer against an in-scope app to discover that script-src allows 'unsafe-inline', generating a lead for follow-up XSS testing with a proof of concept. ## Quick Start Analyze the CSP of an authorized target by asking the agent to run the csp_analyze.py script against the target URL with the output directory set to the target's recon-data folder.

Frequently Asked Questions about csp-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze a Content-Security-Policy header for weaknesses?▼

Run the csp_analyze.py script against the target URL with an output directory. It fetches the page, parses CSP directives from headers and meta tags, and flags weak patterns like unsafe-inline, unsafe-eval, and wildcards in a REPORT.md file.

What weak CSP directives indicate XSS risk?▼

The highest-risk patterns are 'unsafe-inline' and 'unsafe-eval' in script-src, plus wildcard hosts and data: schemes. Missing object-src and base-uri also weaken the policy, though these are leads requiring a proof of concept, not confirmed vulnerabilities.

Does CSP analysis require external Python packages?▼

No, the analyzer uses only the Python standard library, including urllib, ssl, and html.parser. It runs with python3 directly and needs no pip installs or third-party dependencies.

Can a weak CSP be reported as a vulnerability by itself?▼

No, a weak CSP is only a lead for impact elevation, not a filed finding. You still need a working XSS or clickjacking proof of concept, and the finding must pass adversarial validation before filing.

Why does CSP analysis fail on some targets?▼

Fetch failures occur from network errors, timeouts, or unreachable hosts, and the script records the error in csp.json. For lab targets with invalid TLS certificates, it falls back to an unverified SSL context automatically.