全方位安全审计技能。检查文件权限、环境变量、依赖漏洞、配置文件、网络端口、Git 安全、Shell 安全、macOS 安全、密钥检测等。支持 CLI 参数、JSON 输出、配置文件。当用户要求"安全检查"、"漏洞扫描"、"权限检查"、"安全审计"时使用此技能。
完整内容
本技能提供全面的安全检查功能,涵盖系统、代码、配置等多个层面,并支持生成报告发送到飞书。
本技能支持以下安全检查模块(可通过 --check 选择):
actual_mode & ~expected_mode 精确检测超出预期的权限位npm audit --json 检查 NPM 依赖漏洞lsof -i -P -n 检查监听端口使用正则模式精确匹配已知密钥格式:
| 类型 | 模式 |
|---|---|
| AWS Access Key | AKIA[0-9A-Z]{16} |
| GitHub Token | ghp_[a-zA-Z0-9]{36} / github_pat_ |
| Slack Token | xox[bpas]- |
| OpenAI/Anthropic Key | sk-[a-zA-Z0-9]{20,} |
| JWT Token | eyJ[a-zA-Z0-9_-]+\.eyJ |
| Private Key | -----BEGIN PRIVATE KEY----- |
同时支持 Shannon 信息熵检测(> 4.5 的高熵字符串视为可疑密钥)。
python3 scripts/security_audit.py
python3 scripts/security_audit.py --check permissions env git
python3 scripts/security_audit.py --severity high
python3 scripts/security_audit.py --json
python3 scripts/security_audit.py --json --output report.json
python3 scripts/security_audit.py --list-checks
python3 scripts/security_audit.py --quiet --json --output report.json
创建 .security-audit.json 自定义审计行为:
{
"excludePaths": [
"/tmp",
"node_modules"
],
"severityThreshold": "medium",
"autoFix": false,
"reportFormat": "markdown"
}
配置文件搜索顺序:
.security-audit.json~/.openclaw/.security-audit.json~/.openclaw/workspace/.security-audit.json# 富文本格式(默认)
python3 scripts/send_report_to_feishu.py report.md
# 卡片格式
python3 scripts/send_report_to_feishu.py report.md --format card
# 指定 Webhook
python3 scripts/send_report_to_feishu.py report.md --webhook https://...
--webhook 或 FEISHU_WEBHOOK_URL 环境变量)审计报告包含以下部分:
每个检查项包含:状态、风险等级、问题描述、影响范围、修复建议
按风险等级排序的问题列表,附带修复命令
npm audit 等)技能维护者: 小小宝 🐾✨
最后更新: 2026-03-12