Dependency Audit Skill
Detect and report known vulnerabilities in your project's dependency tree.
Supports npm, pip (Python), Cargo (Rust), and Go out of the box.
No API keys. No config. Just point it at a project.
Activation
This skill activates when the user mentions:
- - "audit", "vulnerability", "CVE", "dependency check", "supply chain", "security scan"
- Checking dependencies, lockfiles, or packages for issues
- Generating an SBOM (Software Bill of Materials)
Example Prompts
- 1. "Audit this project for vulnerabilities"
- "Check all my repos in ~/projects for known CVEs"
- "Are there any critical vulnerabilities I should fix right now?"
- "Generate an SBOM for this project"
- "What dependencies need updating in this project?"
- "Audit only the Python dependencies"
Permissions
CODEBLOCK0
Agent Workflow
Follow this sequence exactly:
Step 1: Detect
Run the detection script to discover lockfiles and available tools:
CODEBLOCK1
If no target directory is given, use the current working directory (.).
Parse the JSON output. Note which ecosystems have lockfiles and which tools are available.
Step 2: Audit Each Ecosystem
For each ecosystem detected in Step 1:
- - If the audit tool is available, run the corresponding script:
CODEBLOCK2
- - If the tool is missing, tell the user which tool is needed and the install command from the detect output. Skip that ecosystem and continue with others.
Note: yarn.lock and pnpm-lock.yaml are detected as yarn and pnpm ecosystems respectively. Audit support is npm-only in v0.1.x (package-lock.json). If only a yarn.lock or pnpm-lock.yaml is present, inform the user that dedicated yarn/pnpm audit is not yet supported and suggest running yarn audit or pnpm audit manually.
Each script outputs normalized JSON to stdout.
Step 3: Aggregate
Pipe or pass all per-ecosystem JSON results to the aggregator:
CODEBLOCK3
The aggregator outputs unified JSON to stdout and a Markdown report to stderr.
Capture both: 2>report.md for the Markdown, 1>unified.json for the JSON.
Step 4: Present Results
Show the user the Markdown report from the aggregator. Highlight:
- - Total vulnerability count by severity
- Critical and High findings first (these need attention)
- Which ecosystems were scanned vs skipped
If zero vulnerabilities found: report "✅ No known vulnerabilities found."
If no lockfiles found: report "No lockfiles found in
. This skill works with npm, pip, Cargo, and Go projects."
Discord v2 Delivery Mode (OpenClaw v2026.2.14+)
When the user is in a Discord channel:
- - Send a short first response with totals and only Critical/High findings.
- Keep the first message under ~1200 characters and avoid large Markdown tables up front.
- If Discord components are available, include quick actions:
-
Show Full Report
-
Show Fix Commands
-
Generate SBOM
- - If components are unavailable, provide the same options as a numbered list.
- Send long details in short chunks (<=15 lines) to improve readability.
Step 5: Fix Suggestions (only if user asks)
If the user asks to fix vulnerabilities:
- 1. List every fix command with the package name, current version, and target version.
- Suggest creating a branch first: INLINECODE15
- Ask for explicit confirmation before running ANY fix command.
- Never batch-run fix commands silently.
Example interaction:
CODEBLOCK4
Step 6: SBOM (only if user asks)
CODEBLOCK5
Report the file location and component count.
Error Handling
| Situation | Behavior |
|---|
| Tool not found | Print which tool is missing + install command. Continue with available tools. |
| Audit tool fails |
Capture stderr, report "audit failed for [ecosystem]: [error]". Continue with others. |
| Timeout (>30s per tool) | When
timeout/
gtimeout is available, report "audit timed out for [ecosystem], skipping". Continue. |
| Invalid target directory | Report "directory not found or not accessible" and stop that ecosystem scan (do
not report false "clean"). |
| No lockfiles found | Report "No lockfiles found" + list supported ecosystems. |
|
jq not available | Detection works without jq. Audit and aggregation
require jq — install it first. |
| Malformed lockfile | Report parse error for that ecosystem. Continue with others. |
Aggregation Robustness
- -
aggregate.sh now tolerates mixed inputs (valid results + error objects). - Invalid input objects are listed under
errors in unified JSON and rendered in a "Skipped / Error Inputs" Markdown section. - If no valid ecosystem results are provided, aggregate output sets
status: "error" instead of crashing.
Safety
- - Default mode is report-only. The skill never modifies files unless you explicitly ask for a fix and confirm.
- Audit tools read lockfiles — they do not execute project code.
- Fix commands (
npm audit fix, pip install --upgrade) are printed as suggestions. The agent will ask for confirmation before running them. - This skill checks known advisory databases (OSV, GitHub Advisory DB, RustSec). It does not detect zero-days or runtime vulnerabilities.
- No data is sent to third-party services beyond what the native audit tools do (they query public advisory databases).
- No telemetry. No tracking. No phone-home.
依赖审计技能
检测并报告项目依赖树中的已知漏洞。
原生支持 npm、pip (Python)、Cargo (Rust) 和 Go。
无需API密钥。无需配置。只需指向项目即可。
激活条件
当用户提及以下内容时,此技能将被激活:
- - 审计、漏洞、CVE、依赖检查、供应链、安全扫描
- 检查依赖项、锁定文件或包是否存在问题
- 生成SBOM(软件物料清单)
示例提示
- 1. 审计此项目的漏洞
- 检查 ~/projects 中所有仓库的已知CVE
- 是否有我现在应该修复的关键漏洞?
- 为此项目生成SBOM
- 此项目中哪些依赖项需要更新?
- 仅审计Python依赖项
权限
yaml
permissions:
exec: true # 需要运行审计CLI
read: true # 读取锁定文件
write: on-request # 当用户要求时,SBOM生成写入sbom.cdx.json
network: true # 工具获取咨询数据库
智能体工作流程
请严格按照以下顺序执行:
步骤1:检测
运行检测脚本以发现锁定文件和可用工具:
bash
bash /scripts/detect.sh <目标目录>
如果未指定目标目录,则使用当前工作目录(.)。
解析JSON输出。注意哪些生态系统有锁定文件以及哪些工具可用。
步骤2:审计每个生态系统
对于步骤1中检测到的每个生态系统:
bash
bash
/scripts/audit-npm.sh <目录>
bash /scripts/audit-pip.sh <目录>
bash /scripts/audit-cargo.sh <目录>
bash /scripts/audit-go.sh <目录>
- - 如果工具缺失,告知用户需要哪个工具以及检测输出中的安装命令。跳过该生态系统并继续处理其他生态系统。
注意: yarn.lock 和 pnpm-lock.yaml 分别被检测为 yarn 和 pnpm 生态系统。v0.1.x版本仅支持npm审计(package-lock.json)。如果仅存在 yarn.lock 或 pnpm-lock.yaml,请告知用户尚不支持专用的yarn/pnpm审计,并建议手动运行 yarn audit 或 pnpm audit。
每个脚本将标准化的JSON输出到stdout。
步骤3:聚合
将所有每个生态系统的JSON结果通过管道或传递方式发送给聚合器:
bash
bash dir>/scripts/aggregate.sh result.json> ... 1>unified.json 2>report.md
聚合器将统一的JSON输出到stdout,并将Markdown报告输出到stderr。
捕获两者:2>report.md 用于Markdown,1>unified.json 用于JSON。
步骤4:呈现结果
向用户展示聚合器生成的Markdown报告。突出显示:
- - 按严重级别统计的漏洞总数
- 首先显示关键和高危发现(这些需要关注)
- 哪些生态系统已扫描,哪些已跳过
如果发现零漏洞:报告✅ 未发现已知漏洞。
如果未找到锁定文件:报告在 <目录> 中未找到锁定文件。此技能适用于npm、pip、Cargo和Go项目。
Discord v2 交付模式(OpenClaw v2026.2.14+)
当用户在Discord频道中时:
- - 发送简短的第一条回复,包含总数和仅关键/高危发现。
- 保持第一条消息在约1200字符以内,避免一开始就使用大型Markdown表格。
- 如果Discord组件可用,包含快速操作:
- 显示完整报告
- 显示修复命令
- 生成SBOM
- - 如果组件不可用,以编号列表形式提供相同选项。
- 将长内容分成短块(<=15行)发送,以提高可读性。
步骤5:修复建议(仅当用户要求时)
如果用户要求修复漏洞:
- 1. 列出每个修复命令,包含包名、当前版本和目标版本。
- 建议先创建分支:git checkout -b dep-audit-fixes
- 在运行任何修复命令之前,请求明确确认。
- 切勿静默批量运行修复命令。
示例交互:
我找到了这些修复命令:
1. cd /home/user/project && npm audit fix
2. pip install requests>=2.31.0
我建议先创建一个分支:
git checkout -b dep-audit-fixes
是否运行它们?(是/否)
步骤6:SBOM(仅当用户要求时)
bash
bash /scripts/sbom.sh <目录>
报告文件位置和组件数量。
错误处理
| 情况 | 行为 |
|---|
| 未找到工具 | 打印缺失的工具 + 安装命令。继续使用可用工具。 |
| 审计工具失败 |
捕获stderr,报告[生态系统]的审计失败:[错误]。继续处理其他生态系统。 |
| 超时(每个工具>30秒) | 当 timeout/gtimeout 可用时,报告[生态系统]审计超时,跳过。继续。 |
| 无效的目标目录 | 报告目录未找到或无法访问,并停止该生态系统的扫描(不要报告虚假的干净)。 |
| 未找到锁定文件 | 报告未找到锁定文件 + 列出支持的生态系统。 |
| jq 不可用 | 检测无需jq即可工作。审计和聚合需要jq — 请先安装。 |
| 格式错误的锁定文件 | 报告该生态系统的解析错误。继续处理其他生态系统。 |
聚合鲁棒性
- - aggregate.sh 现在可以容忍混合输入(有效结果 + 错误对象)。
- 无效输入对象在统一JSON中列在 errors 下,并在跳过的/错误输入Markdown部分中呈现。
- 如果未提供有效的生态系统结果,聚合输出设置 status: error 而不是崩溃。
安全性
- - 默认模式仅为报告。 除非您明确要求修复并确认,否则此技能绝不会修改文件。
- 审计工具读取锁定文件 — 它们不会执行项目代码。
- 修复命令(npm audit fix、pip install --upgrade)以建议形式打印。智能体将在运行前请求确认。
- 此技能检查已知的咨询数据库(OSV、GitHub Advisory DB、RustSec)。它不会检测零日漏洞或运行时漏洞。
- 除了原生审计工具所做的操作(它们查询公共咨询数据库)外,不会向第三方服务发送任何数据。
- 无遥测。无跟踪。无回传。