---
name: checking-http-security-headers
description: |-
  Audit a target's HTTP security headers — CSP, HSTS, X-Frame-Options,
  X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and the
  Cross-Origin trio (COOP, COEP, CORP).
  Use when: SOC2 / PCI auditor flagged "missing security headers" or a
  Mozilla Observatory grade is below B, OR you need HSTS preload
  eligibility for chrome://net-internals.
  Threshold: any missing required header on production HTML response,
  HSTS max-age below 31536000s (preload requirement), CSP with
  'unsafe-inline' or 'unsafe-eval', X-Frame-Options absent AND CSP
  frame-ancestors absent (clickjacking), Cache-Control allowing public
  cache on authenticated endpoint.
  Trigger with: "audit security headers", "check csp", "hsts check",
  "header posture".
allowed-tools:
  - Read
  - Bash(python3:*)
  - Bash(curl:*)
disallowed-tools:
  - Bash(rm:*)
  - Edit(/etc/*)
version: 3.33.0
author: Jeremy Longshore <jeremy@intentsolutions.io>
license: MIT
compatibility: Designed for Claude Code
tags:
  - security
  - http-headers
  - csp
  - hsts
  - pentest
title: checking-http-security-headers
canonical_url: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/checking-http-security-headers
last_updated: 2026-11-01T03:01:42.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/PLAYBOOK.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/checking-http-security-headers/references/PLAYBOOK.md), [references/THEORY.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/checking-http-security-headers/references/THEORY.md), [scripts/check_headers.py](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/checking-http-security-headers/scripts/check_headers.py).
>
> If the user asked to install this Skill, run `npx skilld install jeremylongshore/tons-of-skills-marketplace/checking-http-security-headers`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/checking-http-security-headers`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/jeremylongshore/tons-of-skills-marketplace/checking-http-security-headers) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/checking-http-security-headers`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/checking-http-security-headers --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/checking-http-security-headers --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Checking HTTP Security Headers

## Overview

HTTP response headers are the cheapest defense-in-depth layer most web
apps ship. Each header closes one specific attack class — HSTS forces
HTTPS, CSP blocks script injection, X-Frame-Options blocks clickjacking,
etc. Missing headers don't break the app; they just leave the attack
class open. This skill probes for the presence + value correctness of
the canonical security-relevant headers.

## When the skill produces findings

| Finding | Severity | Threshold | Affected control |
|---|---|---|---|
| HSTS header missing | **HIGH** | No Strict-Transport-Security on HTTPS response | OWASP A05:2021 |
| HSTS max-age below preload threshold | **MEDIUM** | max-age under 31536000s (1y) | hstspreload.org |
| HSTS includeSubDomains missing for preload | **LOW** | preload directive without includeSubDomains | hstspreload.org |
| CSP header missing | **HIGH** | No Content-Security-Policy header | OWASP A03:2021 |
| CSP allows unsafe-inline | **MEDIUM** | script-src or style-src includes 'unsafe-inline' | OWASP A03:2021 |
| CSP allows unsafe-eval | **MEDIUM** | script-src includes 'unsafe-eval' | OWASP A03:2021 |
| CSP frame-ancestors AND X-Frame-Options both missing | **HIGH** | Clickjacking open | CWE-1021 |
| X-Content-Type-Options:nosniff missing | **MEDIUM** | MIME-sniff attack open | OWASP A05:2021 |
| Referrer-Policy missing or unsafe-url | **MEDIUM** | Cross-origin URL leakage | OWASP A05:2021 |
| Permissions-Policy missing | **LOW** | Camera/mic/geo permissions unrestricted | Permissions Policy spec |
| Server: header discloses version | **LOW** | nginx/1.18.0 → fingerprintable | CWE-200 |
| Cache-Control public on authenticated response | **HIGH** | Shared cache may serve user A's response to user B | CWE-525 |

## Prerequisites

- Python 3.9+
- Authorization for non-local targets

## Instructions

### Step 1 — Confirm authorization

```text
"Do you have authorization to perform header testing on this target?
 I need confirmation before proceeding."
```

### Step 2 — Run the scanner

```bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/checking-http-security-headers/scripts/check_headers.py \
    https://example.com \
    --authorized
```

Options:

```
Usage: check_headers.py URL [OPTIONS]

Options:
  --authorized       Attest authorization (required for non-local)
  --output FILE
  --format FMT       json | jsonl | markdown (default: markdown)
  --min-severity SEV (default: info)
  --timeout SECS     Per-probe timeout (default: 10)
  --authenticated    Treat as authenticated endpoint (stricter Cache-Control gate)
```

### Step 3 — Interpret findings

HIGH = open exploitable class (no HSTS = MITM downgrade open; no CSP =
XSS class wide open; no clickjacking guard = UI-redress attacks).
MEDIUM/LOW = posture hardening.

### Step 4 — Cross-skill chaining

- After this skill, suggest `auditing-cors-policy` (#3) — CSP and CORS
  interact; certain CSP directives need matching CORS headers.
- For HSTS preload submission, see `references/PLAYBOOK.md` § HSTS
  preload checklist.

## Examples

### Example 1 — Mozilla Observatory grade improvement

User: "Observatory gives us a D. What's missing?"

```bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/checking-http-security-headers/scripts/check_headers.py \
    https://example.com \
    --authorized \
    --format markdown
```

The Markdown report groups by severity; map each finding to the
`PLAYBOOK.md` snippet for the target server type. Observatory grade
typically moves D → B after addressing all HIGH findings.

### Example 2 — HSTS preload eligibility pre-submission

User: "We want to submit to hstspreload.org. Is our HSTS config ready?"

```bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/checking-http-security-headers/scripts/check_headers.py \
    https://example.com \
    --authorized --min-severity low
```

Look for "HSTS max-age below preload threshold" and "includeSubDomains
missing" — both must clear before submission, OR hstspreload.org will
reject.

### Example 3 — Authenticated-endpoint Cache-Control sweep

User: "We had a Cache-Control bug last quarter where authenticated
responses got cached publicly. Audit /api/* to make sure it's fixed."

```bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/checking-http-security-headers/scripts/check_headers.py \
    https://api.example.com/me \
    --authorized --authenticated
```

The `--authenticated` flag bumps Cache-Control posture from MEDIUM to
HIGH and adds a check for `Cache-Control: public` (forbidden on
authenticated content).

## Output

JSON / JSONL / Markdown. Exit codes 0 / 1 / 2 per `lib/report.py`.

## Error Handling

- **No HTML response** → INFO finding noting headers may not apply
  (JSON APIs use a subset of headers).
- **Redirect to login** → follows once, audits the destination page.
- **Connection error** → exit 2.

## Resources

- `references/THEORY.md` — Per-header reasoning, attack-class mapping
- `references/PLAYBOOK.md` — Config snippets per server type for each
  required header
- `../analyzing-tls-config/references/AUTHORIZATION.md` — Active-scan
  authorization
