| name | dependency-audit |
| description | 依赖安全审计时使用。覆盖 npm audit / Snyk / Trivy / 密钥扫描 / 容器扫描。 |
依赖安全审计(Dependency Audit)
适用场景
- 第三方依赖漏洞扫描
- 容器镜像安全扫描
- Git 历史密钥泄露检测
- SBOM(软件物料清单)生成
- 供应链安全评估
- CI/CD 安全门禁配置
与其他 skill 的分工
| 场景 | 用什么 |
|---|
| 依赖/容器/密钥扫描 | 本 skill |
| Web 漏洞扫描(DAST) | web-vulnerability/ |
| 认证授权安全审计 | auth-security-audit/ |
| 渗透测试 | reverse-pentest 工作流 |
核心命令
Node.js 依赖扫描
npm audit
npm audit fix
npm audit --production
pnpm audit
pnpm audit --fix
npx snyk test
npx snyk monitor
pnpm outdated
npx npm-check-updates
Java 依赖扫描
./gradlew dependencyCheckAnalyze
mvn org.owasp:dependency-check-maven:check
snyk test --all-projects
Python 依赖扫描
pip install safety
safety check
pip install pip-audit
pip-audit
snyk test --file=requirements.txt
容器镜像扫描
trivy image myapp:latest
trivy image --severity HIGH,CRITICAL myapp:latest
docker scout cves myapp:latest
docker scout quickview myapp:latest
grype myapp:latest
Git 密钥扫描
gitleaks detect --source .
gitleaks detect --source . --report-format json --report-path report.json
gitleaks protect --staged
trufflehog git file://. --only-verified
IaC 扫描
trivy config .
trivy config --severity HIGH,CRITICAL .
checkov -d .
checkov --framework terraform -d ./infra
CI 集成(GitHub Actions)
name: Security Scan
on: [push, pull_request]
jobs:
dependency-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm audit --audit-level=high
- uses: gitleaks/gitleaks-action@v2
- uses: aquasecurity/trivy-action@master
with:
scan-type: fs
severity: HIGH,CRITICAL
exit-code: 1
处理策略
发现高危漏洞时:
1. 检查是否影响生产(只在 devDependencies?)
2. 有补丁 → 立即升级
3. 无补丁 → 评估替代库 or 临时缓解
4. 误报 → 加入 ignore list(备注原因)
severity 对应 SLA:
CRITICAL → 24h 内修复
HIGH → 7 天内修复
MEDIUM → 下个迭代修复
LOW → 评估后决定
配套模板
templates/dependency-audit-template.md
常见坑
1. npm audit 报100+ 漏洞 → 大多数在 devDependencies,先过滤
2. 强制 npm audit fix → 可能引入破坏性升级
3. 忽略间接依赖 → 供应链攻击就从间接依赖来
4. 只扫不修 → 扫描结果没人看等于没扫
5. 不配 CI 门禁 → 新漏洞照样进代码
6. 密钥已提交再删 → Git 历史里还在(需要 rewrite)
7. 容器用 latest → 基础镜像漏洞无法追溯
8. 不生成 SBOM → 出事后不知道用了什么
与其他 skill 的协作
上游:
backend-engineer / frontend-engineer → 代码 + 依赖
devops-engineer → 容器镜像 + IaC
下游:
ci-cd-pipeline → 安全门禁
security-report → 安全报告