check-secure-headers
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "check-secure-headers" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-f107828dee1615c3a90ada367790364dd2fcd2ecadfb9f9f4fd32cb6f6e54ebd. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Audit HTTP security header configuration, checking Content Security Policy (CSP), X-Frame-Options, HSTS, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and cache-control headers.
Introduction source: third_party · dykyi-roman · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Audits HTTP security headers configuration. Checks CSP, X-Frame-Options, HSTS, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and cache control headers.
- Inputs and outputs
- ```markdown
- Testing
- Not tested
Browse files
Frontmatter
name: check-secure-headers
description: Audits HTTP security headers configuration. Checks CSP, X-Frame-Options, HSTS, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and cache control headers.Secure Headers Audit (A05:2021)
Analyze PHP code for missing or misconfigured HTTP security headers.
Detection Patterns
1. Missing Content-Security-Policy (CSP)
// VULNERABLE: No CSP — allows XSS via inline scripts
class ResponseMiddleware
{
public function handle(Request $request, Response $response): Response
{
// No Content-Security-Policy header
return $response;
}
}
// CORRECT: Strict CSP
$response->headers->set('Content-Security-Policy',
"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-ancestors 'none'"
);
2. Missing X-Frame-Options
// VULNERABLE: Page can be embedded in iframe (clickjacking)
// No X-Frame-Options or frame-ancestors CSP directive
// CORRECT:
$response->headers->set('X-Frame-Options', 'DENY');
// Or for same-origin iframes:
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
3. Missing HSTS (HTTP Strict Transport Security)
// VULNERABLE: No HSTS — allows SSL stripping attacks
// User can be downgraded from HTTPS to HTTP
// CORRECT:
$response->headers->set('Strict-Transport-Security',
'max-age=31536000; includeSubDomains; preload'
);
4. Missing X-Content-Type-Options
// VULNERABLE: Browser may MIME-sniff responses
// A CSS file could be executed as JavaScript
// CORRECT:
$response->headers->set('X-Content-Type-Options', 'nosniff');
5. Missing Referrer-Policy
// VULNERABLE: Full URL sent as Referer to external sites
// Leaks sensitive URL parameters (tokens, IDs)
// CORRECT:
$response->headers->set('Referrer-Policy', 'strict-origin-when-cross-origin');
// Or most restrictive:
$response->headers->set('Referrer-Policy', 'no-referrer');
6. Missing Permissions-Policy
// VULNERABLE: Browser features available by default
// Camera, microphone, geolocation accessible
// CORRECT:
$response->headers->set('Permissions-Policy',
'camera=(), microphone=(), geolocation=(), payment=()'
);
7. Insecure Cache Headers on Sensitive Pages
// VULNERABLE: Sensitive page cached by browser/proxy
class AccountController
{
public function profile(): Response
{
// No cache control — profile page cached!
return new Response($this->render('profile'));
}
}
// CORRECT: No caching for sensitive pages
$response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
$response->headers->set('Pragma', 'no-cache');
$response->headers->set('Expires', '0');
8. Weak CSP Configuration
// VULNERABLE: Overly permissive CSP
$response->headers->set('Content-Security-Policy', "default-src *"); // Allows everything!
// VULNERABLE: unsafe-eval allows XSS
$response->headers->set('Content-Security-Policy',
"script-src 'self' 'unsafe-eval' 'unsafe-inline'" // Defeats CSP purpose
);
Grep Patterns
# Security headers being set
Grep: "Content-Security-Policy|X-Frame-Options|Strict-Transport-Security" --glob "**/*.php"
Grep: "X-Content-Type-Options|Referrer-Policy|Permissions-Policy" --glob "**/*.php"
# Middleware/response handling
Grep: "class.*Middleware|function handle.*Response" --glob "**/*.php"
Grep: "headers->set\(|header\(" --glob "**/*.php"
# Framework security configs
Grep: "security.*headers|secure.*headers" --glob "**/*.yaml" --glob "**/*.yml"
Grep: "nelmio_security|security_headers" --glob "**/*.yaml"
# Cache headers on sensitive routes
Grep: "Cache-Control|no-store|no-cache" --glob "**/*.php"
# Weak CSP
Grep: "unsafe-eval|unsafe-inline|\*" --glob "**/*.php"
Required Headers Checklist
| Header | Value | Purpose |
|---|---|---|
Content-Security-Policy |
default-src 'self' |
Prevent XSS, data injection |
X-Frame-Options |
DENY |
Prevent clickjacking |
Strict-Transport-Security |
max-age=31536000; includeSubDomains |
Force HTTPS |
X-Content-Type-Options |
nosniff |
Prevent MIME sniffing |
Referrer-Policy |
strict-origin-when-cross-origin |
Control referrer leakage |
Permissions-Policy |
camera=(), microphone=() |
Restrict browser features |
Cache-Control |
no-store (on sensitive pages) |
Prevent caching secrets |
Severity Classification
| Pattern | Severity |
|---|---|
| Missing CSP | 🔴 Critical |
| Missing HSTS | 🔴 Critical |
| unsafe-eval in CSP | 🔴 Critical |
| Missing X-Frame-Options | 🟠 Major |
| Missing X-Content-Type-Options | 🟠 Major |
| Missing Referrer-Policy | 🟡 Minor |
| Missing Permissions-Policy | 🟡 Minor |
Output Format
### Secure Headers: [Description]
**Severity:** 🔴/🟠/🟡
**Location:** `file.php:line` or framework config
**CWE:** CWE-693 (Protection Mechanism Failure)
**OWASP:** A05:2021 — Security Misconfiguration
**Missing/Misconfigured Header:**
`Header-Name: expected-value`
**Risk:**
[What attack this enables]
**Fix:**
```php
$response->headers->set('Header-Name', 'secure-value');
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决OWASP A05安全配置错误这一核心安全问题
- 覆盖7种关键HTTP安全头的完整检测方案
- 提供从检测、定位到修复的完整闭环
Highlights
- description清晰描述审计功能,覆盖CSP、HSTS等关键安全头
- 触发词精准,边界清晰,无歧义
Highlights
- 结构完整,包含检测模式、grep命令、检查清单和严重性分类
- 提供端到端示例,从漏洞代码到修复方案完整展示
- frontmatter完整,文档组织清晰
Highlights
- 提供具体的grep检测命令,可直接执行
- 覆盖主要异常场景和修复方案
- 严重性分类清晰,便于优先级处理
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.