cors-config-drift
CORS config drift scanner: harvests every Access-Control-Allow-Origin header, cors()-middleware call, @cross_origin decorator, options-handler with cors config, and per-route origin/credentials settin
SKILL.mdskills/security/cors-config-drift/SKILL.md
GitHubWhat this is for
CORS configurations drift silently: one route uses origin:'*' with credentials:true,
another reflects the Origin header, a third forgets preflight handling. Standard scanners
flag "use CORS" - no tool reads the actual per-route origins and credentials and classifies
each as safe vs dangerous. This skill catalogs every CORS-relevant statement, and the LLM
classifies each by drift-type and severity.
PROTECTION RULE - never ~/.claude/
Read-only skill. Guard required if write mode added later.
## What You Must Do When Invoked
During analysis, assign a confidence level to each finding: proven (confirmed by evidence), likely (strong signal, needs review), or suspected (weak signal).
Step 1
- If
-helpis passed, print the## Usageblock below and stop.
Step 2
- Confirm
-ProjectDiris provided and the path exists.
Step 3
- Run:
scripts/cors-scan.ps1 -ProjectDir "<path>"
Step 4
- LLM reads the JSON output. For each finding:
Step 5
- Credentials + wildcard:
origin:'*'withcredentials:trueis fatally insecure - the browser sends cookies cross-origin to any domain.
Step 6
- Permissive origin:
origin: true(reflect), regex wildcards likehttps://*.example.comthat match unintended subdomains,allowMultipleOrigins: true.
Step 7
- Preflight handling: is
OPTIONShandled? doesAccess-Control-Max-Ageexpose a large window? are methods/headers overly permissive?
Step 8
- Route-specific drift: one route uses permissive CORS while another on the same app uses restrictive - inconsistent posture across the surface.
Step 9
- Header-based vs middleware: raw
res.header('Access-Control-Allow-Origin', '*')bypasses any centralized policy - classify as ad-hoc drift.
Step 10
- Severity scale: credentials+wildcard > reflected origin > regex wildcard > permissive preflight > inconsistent route config.
Step 11
- Write
cors-config-drift-report.mdto the working directory.
Usage
/cors-drift # interactive
/cors-drift <dir> # scan project
/cors-drift -help # show usage
Returns JSON with findings[]:
{file, line, corsType, origin, credentials, route, wildcard, dangerous} plus summary counts.