/viperclaw:viper-headers-csp-corsfrom viperclaw
Audits HTTP security headers, CSP, and CORS configurations against OWASP Secure Headers and Mozilla Observatory standards. Reviews origin reflection, framing defenses, and credential handling.
Ships in viperclaw. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
viper-headers-csp-cors)viper_fingerprint_traffic, viper_verify_and_reportviperclaw fingerprint ./traffic.har --output headers_audit.jsonflowchart LR
Origin["Browser Cross-Origin Request"] --> CORS["Strict Origin Allowlist Match"] --> CSP["Nonce/Hash CSP + frame-ancestors"] --> Client["Protected Browser Context"]
Permissive configurations weaken browser Same-Origin Policy protections by reflecting the incoming Origin header into Access-Control-Allow-Origin alongside Access-Control-Allow-Credentials: true, or weaken CSP with 'unsafe-inline', 'unsafe-eval', and broad CDN wildcards.
Run the following discovery commands across the target repository before manual code review:
# 1. Automated ViperClaw analysis
viperclaw fingerprint ./traffic.har --output headers_audit.json
# 2. Rapid static pattern discovery (ripgrep)
rg -n "(Access-Control-Allow-Origin|Access-Control-Allow-Credentials|CORSMiddleware|cors\()"
rg -n "(Content-Security-Policy|unsafe-inline|unsafe-eval|frame-ancestors)"
rg -n "(Strict-Transport-Security|X-Frame-Options|X-Content-Type-Options|Referrer-Policy)"
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
|---|---|---|---|
HDR-01 | Zero Arbitrary CORS Origin Reflection | When Access-Control-Allow-Credentials: true is present, Access-Control-Allow-Origin is validated against an exact-match set of trusted origins. | Server reflects req.headers.origin or uses regex .endswith('example.com') (matched improperly by evilexample.com). |
HDR-02 | Block Origin: null in Credentialed CORS | Origin: null is never allowed on credentialed endpoints. | Access-Control-Allow-Origin: null + Allow-Credentials: true (reachable via sandboxed <iframe sandbox>). |
HDR-03 | Vary: Origin Shared-Cache Isolation | Dynamic Access-Control-Allow-Origin responses always include Vary: Origin. | Missing Vary: Origin causes CDN to cache Origin A's CORS header and serve it to Origin B. |
HDR-04 | CSP script-src Hardening (No unsafe-inline/eval) | CSP uses cryptographic nonces ('nonce-...') + 'strict-dynamic' or hashes, with object-src 'none' and base-uri 'self'. | script-src * 'unsafe-inline' 'unsafe-eval' data: rendering CSP ineffective against XSS. |
HDR-05 | Clickjacking Defense (frame-ancestors & X-Frame-Options) | CSP includes frame-ancestors 'none' (or 'self') paired with X-Frame-Options: DENY on HTML routes. | Authenticated state-changing UI pages frameable by external origins. |
HDR-06 | HSTS Preload Readiness | Strict-Transport-Security: max-age=63072000; includeSubDomains; preload served over HTTPS. | max-age < 1 year (31536000) or missing includeSubDomains. |
HDR-07 | Referrer-Policy & Permissions-Policy | Referrer-Policy: strict-origin-when-cross-origin (or no-referrer) and Permissions-Policy: camera=(), microphone=(), geolocation=() set. | unsafe-url referrer policy leaking sensitive URL paths/tokens to third-party links. |
HDR-08 | Cross-Origin Isolation Headers (COOP / CORP) | Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Resource-Policy: same-origin configured. | Window references retained across cross-origin popups (window.opener tabnabbing). |
| Severity Tier | Baseline CVSS v3.1 Vector | Qualifying Security Impact |
|---|---|---|
| HIGH (8.1) | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N | Reflected Access-Control-Allow-Origin + Allow-Credentials: true on authenticated API leaking tokens/PII. |
| MEDIUM (6.1) | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N | Clickjacking on sensitive account-settings UI due to missing frame-ancestors / X-Frame-Options. |
| LOW (3.7) | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N | Permissive Referrer-Policy or missing Vary: Origin header. |
# ❌ VULNERABLE: FastAPI CORSMiddleware with wildcard origin reflection + allow_credentials=True
app.add_middleware(
CORSMiddleware,
allow_origin_regex=r"https://.*example\.com", # Matches https://evilexample.com!
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# ✅ HARDENED: Exact-match origin allowlist + restricted methods and headers
app.add_middleware(
CORSMiddleware,
allow_origins=["https://app.example.com", "https://admin.example.com"],
allow_credentials=True,
allow_methods=["GET", "POST", "PUT", "DELETE"],
allow_headers=["Authorization", "Content-Type", "X-CSRF-Token"],
)
viperclaw taint and viperclaw verify to confirm zero remaining unmitigated flows in .viperclaw/graph.db.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
http-headers, csp-audit, cors-audit, security-headers, owasp
npx claudepluginhub zahidoverflow/viperclaw --plugin viperclaw72 skills in this plugin
/viper-agent-skill-supplychainAI Agent Skill, Plugin & MCP Config Supply-Chain Auditor (modeled on NVIDIA SkillSpector & OWASP Agentic Skills Top 10). Audits SKILL.md bundles and MCP JSON configs./viper-ai-llm-guardrailsAI, LLM & MCP Application Security & Guardrails Auditor (OWASP LLM Top 10). Reviews prompt boundaries, RAG data isolation, tool-call authorization, and output sanitization./viper-api-gateway-apigee-kongAPI Gateway, BFF & Rate-Tier Policy Auditor (Kong, AWS API Gateway, Apigee, Envoy Gateway). Reviews JWT authorizers, backend origin lockdown, and route-level quotas./viper-auth-oauth-jwtAuthentication, OAuth 2.0 / OIDC & JWT Security Auditor. Reviews token verification, algorithm allowlisting, claim validation, and OAuth redirect_uri configurations./viper-aws-iam-cloud-auditAWS IAM, STS, S3, KMS & Lambda Security Auditor (modeled on Prowler, Parliament & CloudSplaining). Reviews iam:PassRole escalation, STS ExternalId, S3 policies, and IMDSv2./viper-bola-idorObject & Function-Level Authorization (BOLA / BFLA) Audit Skill. Reviews resource access controls, tenant scoping, and ownership checks across API endpoints and controllers.Other plugins' skills for the same job