security-headers
БесплатноБез исполняемых скриптовНе проверенWrite HTTP security header configs for Cloudflare, Vercel, Netlify, nginx, and Next.js in Claude Code, GitHub Copilot, Codex, Cursor, and other coding agents…
от squirrelscan★ 110 звёзд на GitHubОб этом скилле
Security Headers
Write the HTTP security headers for a site and put them where the platform wants them: Cloudflare, Vercel, Netlify, nginx or Next.js. No squirrel CLI is needed; curl is enough.
Headers reduce the damage of some attacks (clickjacking, MIME sniffing, downgrade to http, injected scripts). They do not fix a vulnerable app. A missing header is a finding to fix; a full set of headers is not proof the site is secure.
Step 1: see what is sent now
curl -sI https://example.com | grep -i -E '^(strict-transport|content-security|x-frame|x-content-type|referrer-policy|permissions-policy|cross-origin|set-cookie)'
Check a page, not only the homepage, and the response a browser gets (not a cached one from a CDN with other rules). Note which headers are already set and by what: the app, the CDN or the host.
Step 2: the baseline set
OWASP's secure headers project (https://secure-headers-project.owasp.org/best-practices) proposes this baseline:
| Header | Value | Notes |
|---|---|---|
Strict-Transport-Security |
max-age=63072000; includeSubDomains |
HTTPS only. Start with a short max-age (for example 300) on a site you are unsure about. Add preload only when every subdomain is HTTPS for good, since it is hard to undo |
X-Content-Type-Options |
nosniff |
|
Content-Security-Policy |
start from default-src 'self'; base-uri 'self'; object-src 'none'; form-action 'self'; frame-ancestors 'none' |
Then allow only what the site really loads. See step 3 |
X-Frame-Options |
DENY (or SAMEORIGIN if you frame your own pages) |
Old browsers. CSP frame-ancestors is the modern control; OWASP advises setting both for defense in depth |
Referrer-Policy |
strict-origin-when-cross-origin (or no-referrer) |
OWASP proposes no-referrer; the middle value keeps analytics working |
Permissions-Policy |
camera=(), microphone=(), geolocation=() |
List only features the site does not use; add others as needed |
If the site must be framed by a partner, use frame-ancestors https://partner.example and drop X-Frame-Options (it cannot name a host).
Step 3: roll CSP out safely
A strict CSP breaks pages that rely on inline scripts, third-party widgets and analytics. Do not ship it blind:
- Send it as
Content-Security-Policy-Report-Onlyfirst, with areport-to/report-uriendpoint if the user has one, and watch the browser console. - Replace
'unsafe-inline'with nonces or hashes where the framework supports them (Next.js and others can issue a per-request nonce). - Add each legitimate origin to the right directive (
script-src,style-src,img-src,connect-src,frame-src). - Switch to enforcing
Content-Security-Policywhen the console is clean on the main flows (sign-in, checkout, forms).
Step 4: put it where it belongs
Next.js (next.config.ts):
const headers = [
{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" },
];
export default { async headers() { return [{ source: "/(.*)", headers }]; } };
Vercel (vercel.json):
{ "headers": [{ "source": "/(.*)", "headers": [
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" },
{ "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }
] }] }
Netlify (_headers in the publish directory):
/*
Strict-Transport-Security: max-age=63072000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
nginx (in the server block; always adds the header on error responses too):
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
nginx drops parent add_header lines when a nested location sets its own: repeat them there.
Cloudflare: Rules, Transform Rules, Modify Response Header: add each header as "Set static" for the hostname. Turn on Always Use HTTPS in SSL/TLS, Edge Certificates. Keep one source for each header: if the origin also sets it, check the response for a duplicate.
WordPress, Shopify, Webflow: headers are set at the host or CDN in front (a Cloudflare rule, the host's .htaccess or panel). Shopify and Webflow limit what the owner can set; say what is not changeable instead of promising it.
Step 5: verify
Re-run the curl -sI check a
Установить security-headers в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(curl:*)Bash(squirrel:*)ReadEditGrepGlobВложенные файлы
FAQ
Что делает скилл security-headers?
Write HTTP security header configs for Cloudflare, Vercel, Netlify, nginx, and Next.js in Claude Code, GitHub Copilot, Codex, Cursor, and other coding agents, covering HSTS, report-only CSP first, frame-ancestors, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and Permissions-Policy. This standalone squirrelscan skill needs no squirrel CLI or hosted squirrelscan MCP server and verifies live headers with curl. Use when asked "add security headers to Next.js", "set up a CSP", or "fix missing HSTS and Referrer-Policy headers".
Как установить скилл security-headers?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл security-headers запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic