security_csp_analyze
Analyze Content-Security-Policy headers to detect unsafe directives and calculate a security score for XSS protection assessment.
Instructions
Deep analysis of Content-Security-Policy: parse CSP directives, detect unsafe-inline/unsafe-eval/wildcard * and other unsafe configurations, and produce a CSP security score.
中文详情:
用途:深度分析 Content-Security-Policy 策略,解析 CSP 指令,检测不安全配置(unsafe-inline/unsafe-eval/通配符 * 等)并评估 CSP 安全评分
何时使用:CSP 策略上线前评估时;XSS 防护层验证时;第三方脚本加载白名单审查时;CSP 报告异常排查时
输出:{ ok: boolean, url: string, csp: string, directives: object, unsafeDirectives: array, score: number, recommendations: array }
参数:
url (string, 必填):目标 URL
错误:URL 不可达抛出 'Request failed';响应无 CSP 头返回 score=0 但 ok=true
示例:{"url":"https://example.com"}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | 目标 URL(必填) |