七阶段纵深安全审计流水线
简介
基于 OWASP 标准的七阶段安全审计流水线,覆盖攻击面测绘、依赖漏洞扫描、应用渗透测试、API 安全、配置加固、密钥泄露检测及合规报告,适用于生产部署前或事件响应后的系统性安全评估。
原始描述
7-phase security audit pipeline — reconnaissance, dependency scan, application tests, API security, hardening check, OWASP verification, report. Use before p...
通过你的 Agent 添加
安装目录:shadows-security-scanner/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Security Scanner 是一套结构化的七阶段安全审计流水线,专为开发团队在关键节点执行深度安全评估而设计。其工作流程包括:1)攻击面侦察——枚举所有入口点、数据流和认证边界;2)依赖扫描——通过 npm audit、pip audit、cargo audit 等工具识别已知 CVE 漏洞;3)应用安全测试——针对 OWASP Top 10 进行静态代码审查,重点检测 SQL 注入、身份验证缺陷、敏感数据泄露、XSS、CSRF 和不安全反序列化;4)API 安全——验证认证、授权、速率限制、输入校验和 CORS 配置;5)加固检查——审计 HTTP 安全响应头(HSTS、CSP、X-Frame-Options)及调试模式状态;6)密钥验证——通过 Git 历史扫描和 .gitignore 审查防止凭证泄露;7)结构化报告——生成包含分级风险、可操作建议和修复优先级的 Markdown 报告。
显著优点
- 流程完整性:强制七阶段全覆盖,避免审计盲区,符合 DevSecOps 最佳实践。
- 工具链原生:直接调用
npm/pip/cargo audit,无需额外代理,结果可追溯至官方 CVE 库。
- 可操作性强:每处发现均标注文件路径与行号,并提供具体修复代码示例。
- 多语言支持:覆盖 Node.js、Python、Rust 等主流技术栈,适应异构架构。
- 报告标准化:输出格式兼容合规审计与团队协作,支持风险分级和状态跟踪。
潜在缺点与局限性
- 静态分析局限:依赖正则表达式和文本搜索,无法检测复杂逻辑漏洞或运行时行为异常。
- 误报风险:字符串拼接的 grep 模式可能匹配非注入场景,需人工复核。
- 无动态测试:缺乏自动化模糊测试(fuzzing)或主动渗透能力,无法发现业务逻辑缺陷。
- 环境依赖:部分命令(如
pip audit)需预装工具,Windows 兼容性未经充分验证。
- 无集成 CI/CD:未提供预构建的 GitHub Actions/GitLab CI 模板,需手动编排。
适合人群
- 需要在生产部署前执行强制安全门禁的开发团队
- 事件响应后需系统性复盘的安全工程师
- 缺乏专职安全人员的中小技术团队,作为轻量级自助审计工具
- 进行代码审计或合规检查(如 SOC 2、ISO 27001)的技术负责人
常规风险
- 假阴性风险:静态扫描无法覆盖所有攻击向量,通过审计不代表系统绝对安全(文档已明确声明)。
- 凭证暴露:扫描过程中若未妥善配置,可能将
grep 结果输出到日志,导致敏感信息二次泄露。
- 供应链延迟:依赖扫描结果受限于工具数据库更新频率,零日漏洞无法即时检出。
- 权限要求:部分命令需访问源码和 Git 历史,存在误操作覆盖生产数据的风险。
npm/pip/cargo audit,无需额外代理,结果可追溯至官方 CVE 库。- 静态分析局限:依赖正则表达式和文本搜索,无法检测复杂逻辑漏洞或运行时行为异常。
- 误报风险:字符串拼接的 grep 模式可能匹配非注入场景,需人工复核。
- 无动态测试:缺乏自动化模糊测试(fuzzing)或主动渗透能力,无法发现业务逻辑缺陷。
- 环境依赖:部分命令(如
pip audit)需预装工具,Windows 兼容性未经充分验证。 - 无集成 CI/CD:未提供预构建的 GitHub Actions/GitLab CI 模板,需手动编排。
适合人群
- 需要在生产部署前执行强制安全门禁的开发团队
- 事件响应后需系统性复盘的安全工程师
- 缺乏专职安全人员的中小技术团队,作为轻量级自助审计工具
- 进行代码审计或合规检查(如 SOC 2、ISO 27001)的技术负责人
常规风险
- 假阴性风险:静态扫描无法覆盖所有攻击向量,通过审计不代表系统绝对安全(文档已明确声明)。
- 凭证暴露:扫描过程中若未妥善配置,可能将
grep 结果输出到日志,导致敏感信息二次泄露。
- 供应链延迟:依赖扫描结果受限于工具数据库更新频率,零日漏洞无法即时检出。
- 权限要求:部分命令需访问源码和 Git 历史,存在误操作覆盖生产数据的风险。
- 假阴性风险:静态扫描无法覆盖所有攻击向量,通过审计不代表系统绝对安全(文档已明确声明)。
- 凭证暴露:扫描过程中若未妥善配置,可能将
grep结果输出到日志,导致敏感信息二次泄露。 - 供应链延迟:依赖扫描结果受限于工具数据库更新频率,零日漏洞无法即时检出。
- 权限要求:部分命令需访问源码和 Git 历史,存在误操作覆盖生产数据的风险。
技能正文
name: security-scanner
description: "7-phase security audit pipeline — reconnaissance, dependency scan, application tests, API security, hardening check, OWASP verification, report. Use before production deployments or post-incident."
metadata: { "openclaw": { "emoji": "🛡️", "requires": { "anyBins": ["npm", "pip", "cargo"] }, "os": ["darwin", "linux", "win32"] } }
Security Scanner — 7-Phase Audit Pipeline
Version: 1.0.0 | Author: Shadows Company | License: MIT
WHEN TO TRIGGER
- Before any production deployment
- After a security incident
- Regular scheduled audit (monthly recommended)
- New dependency or library added
- User says "security audit", "check for vulnerabilities", "scan security"
- Code review for security-sensitive features (auth, payments, data handling)
WHEN NOT TO TRIGGER
- Simple UI changes with no data handling
- Documentation-only changes
PROTOCOL — 7 PHASES
Phase 1 — RECONNAISSANCE
- Simple UI changes with no data handling
- Documentation-only changes
PROTOCOL — 7 PHASES
Phase 1 — RECONNAISSANCE
Map the attack surface:
- List all entry points (routes, APIs, webhooks, forms)
- Identify data flows (user input → storage → output)
- Map authentication and authorization boundaries
- Identify external service integrations
- Check for exposed ports and services
# Example for Node.js
grep -r "app\.\(get\|post\|put\|delete\|patch\)" --include="*.js" --include="*.ts" -l
# Example for Python
grep -r "@app\.\(route\|get\|post\)" --include="*.py" -l
Phase 2 — DEPENDENCY SCAN
Check for known vulnerabilities in dependencies:
# Node.js
npm audit --json 2>/dev/null || echo "npm audit not available"
# Python
pip audit 2>/dev/null || pip list --outdated
# Rust
cargo audit 2>/dev/null || echo "cargo-audit not installed"
For each vulnerability found:
- Severity (Critical/High/Medium/Low)
- CVE identifier
- Affected package and version
- Available fix version
- Is it exploitable in this context?
Phase 3 — APPLICATION SECURITY TESTS
Check OWASP Top 10:
-
Injection (SQL, NoSQL, OS, LDAP)
- Search for string concatenation in queries
- Verify parameterized queries are used
grep -rn "f['\"].*SELECT\|f['\"].*INSERT\|f['\"].*UPDATE" --include="*.py" grep -rn "query.*\+\|exec.*\+" --include="*.js" --include="*.ts" -
Broken Authentication
- Check session management, token expiry, password policies
- Verify MFA implementation if applicable
-
Sensitive Data Exposure
- Search for hardcoded secrets
grep -rniE "(password|secret|api_key|token|private_key)\s*[:=]\s*['\"][^'\"]{8,}" --include="*.py" --include="*.js" --include="*.ts" --include="*.env"- Check HTTPS enforcement, HSTS headers
-
XSS — Check for unsanitized user input in HTML output
-
CSRF — Verify anti-CSRF tokens on state-changing endpoints
-
Insecure Deserialization — Check for
eval(),pickle.loads(),JSON.parse()on untrusted data
Phase 4 — API SECURITY
For each API endpoint:
- Authentication required? (JWT, API key, session)
- Authorization enforced? (role checks, ownership validation)
- Rate limiting configured?
- Input validation present? (schema validation, type checking)
- Response doesn't leak internal details? (stack traces, DB structure)
- CORS properly configured?
Phase 5 — HARDENING CHECK
Verify infrastructure hardening:
# Check security headers
curl -sI https://your-site.com | grep -iE "(strict-transport|content-security|x-frame|x-content-type)"
Checklist:
-
Strict-Transport-Securityheader -
Content-Security-Policyheader -
X-Frame-Optionsheader -
X-Content-Type-Options: nosniff - No server version exposed
- Debug mode disabled in production
- Error pages don't leak stack traces
- File upload restrictions enforced
Phase 6 — SECRETS VERIFICATION
# Check git history for leaked secrets
git log --all -p | grep -iE "(api[_-]?key|secret|token|password)\s*[:=]\s*['\"]" | head -20
# Check .gitignore
cat .gitignore | grep -E "(\.env|secret|credential|\.pem|\.key)"
# Check git history for leaked secrets
git log --all -p | grep -iE "(api[_-]?key|secret|token|password)\s*[:=]\s*['\"]" | head -20
# Check .gitignore
cat .gitignore | grep -E "(\.env|secret|credential|\.pem|\.key)"
Verify:
-
.envfiles in.gitignore - No secrets in git history
- Secrets stored in environment variables or vault
- No secrets in logs or error messages
Phase 7 — REPORT
Generate a structured security report:
OUTPUT FORMAT
# Security Audit Report
**Date**: [YYYY-MM-DD]
**Scope**: [project/module name]
**Auditor**: [agent name]
## Executive Summary
- Critical: [count] | High: [count] | Medium: [count] | Low: [count]
- Overall Risk: [Critical/High/Medium/Low]
## Findings
### [CRITICAL/HIGH] Finding Title
- **Category**: [OWASP category]
- **Location**: [file:line]
- **Description**: [what's wrong]
- **Impact**: [what could happen]
- **Remediation**: [how to fix]
- **Status**: [Open/Fixed]
## Dependency Vulnerabilities
| Package | Severity | CVE | Fix Version |
|---------|----------|-----|-------------|
| ... | ... | ... | ... |
## Hardening Status
| Check | Status |
|-------|--------|
| HSTS | [PASS/FAIL] |
| CSP | [PASS/FAIL] |
| ... | ... |
## Recommendations (Priority Order)
1. [Most critical action]
2. [Second priority]
3. [Third priority]
RULES
- Never skip phases — even if project seems simple
- Evidence-based — every finding must have file:line or command output
- Severity accuracy — don't inflate or downplay risks
- Actionable remediation — every finding must include HOW to fix
- No false security — passing this scan doesn't mean 100% secure
# Security Audit Report
**Date**: [YYYY-MM-DD]
**Scope**: [project/module name]
**Auditor**: [agent name]
## Executive Summary
- Critical: [count] | High: [count] | Medium: [count] | Low: [count]
- Overall Risk: [Critical/High/Medium/Low]
## Findings
### [CRITICAL/HIGH] Finding Title
- **Category**: [OWASP category]
- **Location**: [file:line]
- **Description**: [what's wrong]
- **Impact**: [what could happen]
- **Remediation**: [how to fix]
- **Status**: [Open/Fixed]
## Dependency Vulnerabilities
| Package | Severity | CVE | Fix Version |
|---------|----------|-----|-------------|
| ... | ... | ... | ... |
## Hardening Status
| Check | Status |
|-------|--------|
| HSTS | [PASS/FAIL] |
| CSP | [PASS/FAIL] |
| ... | ... |
## Recommendations (Priority Order)
1. [Most critical action]
2. [Second priority]
3. [Third priority]
- Never skip phases — even if project seems simple
- Evidence-based — every finding must have file:line or command output
- Severity accuracy — don't inflate or downplay risks
- Actionable remediation — every finding must include HOW to fix
- No false security — passing this scan doesn't mean 100% secure
Published by Shadows Company — "We work in the shadows to serve the Light."
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。