agentleFS
saizulsaizul/security-audit-skills/skills/security-headers-check/SKILL.md

security-headers-check

Skill0 starsChanged 10 days agoMITView on GitHub

Grade the HTTP security headers of your own site or API from a HAR file or curl -I output, offline - HSTS, Content-Security-Policy quality (unsafe-inline, unsafe-eval, wildcards, object-src, base-uri, frame-ancestors wildcards, report-only), X-Frame-Options values, conflicting duplicate headers, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, COOP, version-leaking Server/X-Powered-By, permissive CORS and legacy X-XSS-Protection - with an A-F grade and copy-paste fixes for nginx, Apache, Express, Django, Laravel and Next.js. Use when the user asks to check or improve security headers, add a CSP, fix a securityheaders.com or Mozilla Observatory grade, harden a site before launch, or review CORS headers.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before launch, after moving to a new host/CDN/proxy

    line 20
  2. Distinctive:

    Re-capture and re-grade: after deployment; show before/after grades.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security headers check

Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).

When to use

  • "Check the security headers of my site", "what headers am I missing?"
  • "Help me add a Content-Security-Policy without breaking the site"
  • A scanner or pentest report flagged HSTS/CSP/clickjacking/CORS
  • Before launch, after moving to a new host/CDN/proxy

When not to use

  • Cookie flags and sessions: auth-session-review (its script reads the same HAR)
  • TLS certificates and protocol versions: use a TLS checker (for example testssl.sh or an ssl-tls-check skill)
  • Sites the user does not own or operate

Workflow

  1. Capture headers from the user's own site. Only fetch URLs the user names:
    curl -sIL https://www.example.com/ > headers.txt          # follows redirects
    curl -sI -X GET https://www.example.com/app > app.txt     # some apps answer HEAD differently
    Or export a HAR from the browser (DevTools > Network > Export HAR), which covers every page and API response loaded. HARs contain cookies; do not paste them into chat.
  2. Grade (offline, read-only).
    python3 scripts/headers_grade.py headers.txt
    python3 scripts/headers_grade.py site.har                    # HTML documents only
    python3 scripts/headers_grade.py site.har --all --url /api/  # API responses too
    python3 scripts/headers_grade.py headers.txt --json --min-grade A
    With redirects the last response is graded (--all for each hop). Raw headers are treated as HTTPS unless --http. Exit 1 = a response below --min-grade (default B).
  3. Interpret. HSTS, clickjacking protection, CSP and CORS matter most. A CSP frame-ancestors * (or https:) overrides X-Frame-Options, so the page can be framed by anyone even with X-Frame-Options: DENY; values other than DENY / SAMEORIGIN are ignored too. "Sent N times with different values" usually means the proxy and the app both add the header: keep one. Info items (Permissions-Policy, COOP) are hardening. API-only JSON responses need fewer headers (nosniff, CORS, cache control); CSP matters for HTML.
  4. Write the fix for the user's stack from references/recommended-headers.md. Find where headers are set today (web server, CDN, framework middleware) and change them in one place; nginx add_header in a location block drops headers inherited from server.
  5. Roll out CSP safely: send Content-Security-Policy-Report-Only first, watch the browser console or a report endpoint, fix violations (move inline scripts to files or add nonces), then enforce. HSTS: start with a short max-age, raise to one year, add preload only when every subdomain is HTTPS-only for good.
  6. Re-capture and re-grade after deployment; show before/after grades.

Output

F (10/100)  response (HTTP 200)
  HIGH   strict-transport-security: missing HSTS
  HIGH   access-control-allow-origin: wildcard origin with credentials
  MEDIUM content-security-policy: missing Content-Security-Policy
  ...
Proposed nginx snippet (server block, with `always`): ...
After deploy: A (100/100)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.