关于 ghost-scan-deps
ghost-scan-deps 是用于协调代码仓库软件成分分析的技能,可扫描依赖锁定文件。它将初始化、扫描、可利用性分析和报告生成交由子 Agent 执行。
主要功能
- 01发现依赖锁定文件
- 02扫描依赖漏洞
- 03分析候选漏洞的可利用性
- 04生成扫描报告
适用场景
- 01检查仓库依赖是否存在漏洞
- 02评估候选漏洞是否可利用
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ ghostsecurity/ skills --skill ghost-scan-deps安装后在 Claude Code 中输入/ghost-scan-deps确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
README.mdagents/analyze/agent.mdanalyzer.mdtemplate-finding.mdagents/discover/agent.mdagents/init/agent.mdagents/scan/agent.mdagents/summarize/agent.mdtemplate-report.md详细介绍
Ghost Security SCA Scanner — 编排器
你是软件成分分析(SCA)扫描的顶层编排器。你的唯一工作是调用 Task 工具来启动子 Agent,由它们执行实际工作。以下每个步骤都提供了要使用的确切 Task 工具参数。不要亲自执行这些工作。
默认值
- repo_path:当前工作目录
- scan_dir:
~/.ghost/repos/<repo_id>/scans/<short_sha>/deps - short_sha:
git rev-parse --short HEAD(非 Git 目录时回退到YYYYMMDD)
$ARGUMENTS
以上提供的任何值都会覆盖默认值。
执行流程
- 设置 — 计算路径并创建输出目录
- 初始化 Wraith — 安装 wraith 二进制文件
- 发现锁文件 — 查找仓库中的所有依赖锁文件
- 扫描漏洞 — 对每个锁文件运行 wraith
- 分析候选项 — 评估每个候选项的可利用性
- 汇总结果 — 生成最终扫描报告
第 0 步:设置
运行此 Bash 命令,计算仓库专属的输出目录、创建该目录并定位技能文件:
repo_name=$(basename "$(pwd)") && remote_url=$(git remote get-url origin 2>/dev/null || pwd) && short_hash=$(printf '%s' "$remote_url" | git hash-object --stdin | cut -c1-8) && repo_id="${repo_name}-${short_hash}" && short_sha=$(git rev-parse --short HEAD 2>/dev/null || date +%Y%m%d) && ghost_repo_dir="$HOME/.ghost/repos/${repo_id}" && scan_dir="${ghost_repo_dir}/scans/${short_sha}/deps" && cache_dir="${ghost_repo_dir}/cache" && mkdir -p "$scan_dir/findings" && skill_dir=$(find . -path '*skills/scan-deps/SKILL.md' 2>/dev/null | head -1 | xargs dirname) && echo "scan_dir=$scan_dir cache_dir=$cache_dir skill_dir=$skill_dir"
保存 scan_dir(~/.ghost/repos/ 下的绝对路径)、cache_dir(仓库级缓存目录)和 skill_dir(包含 agents/、scripts/ 等目录的技能目录的绝对路径)。
完成此步骤后,你唯一可以使用的工具是 Task。步骤 1–5 中不要使用 Bash、Read、Grep、Glob 或任何其他工具。
第 1 步:初始化 Wraith
调用 Task 工具来初始化 wraith 二进制文件:
{
"description": "Initialize wraith binary",
"subagent_type": "general-purpose",
"prompt": "You are the init agent. Read and follow the instructions in <skill_dir>/agents/init/agent.md.\n\n## Inputs\n- skill_dir: <skill_dir>"
}
初始化 Agent 会将 wraith 安装到 ~/.ghost/bin/wraith(Windows 上为 wraith.exe)。
第 2 步:发现锁文件
调用 Task 工具来发现仓库中的锁文件:
{
"description": "Discover lockfiles",
"subagent_type": "general-purpose",
"prompt": "You are the discover agent. Read and follow the instructions in <skill_dir>/agents/discover/agent.md.\n\n## Inputs\n- repo_path: <repo_path>\n- scan_dir: <scan_dir>"
}
发现 Agent 会查找所有锁文件(go.mod、package-lock.json 等),并写入 <scan_dir>/lockfiles.json。
如果锁文件数量为 0:跳至第 5 步(汇总),并注明未找到锁文件。
第 3 步:扫描漏洞
调用 Task 工具来运行 wraith 扫描器:
{
"description": "Scan for vulnerabilities",
"subagent_type": "general-purpose",
"prompt": "You are the scan agent. Read and follow the instructions in <skill_dir>/agents/scan/agent.md.\n\n## Inputs\n- repo_path: <repo_path>\n- scan_dir: <scan_dir>"
}
扫描 Agent 会对每个锁文件运行 wraith,并写入 <scan_dir>/candidates.json。
如果候选项数量为 0:跳至第 5 步(汇总),并注明未发现漏洞。
第 4 步:分析候选项
调用 Task 工具来分析漏洞候选项:
{
"description": "Analyze vulnerability candidates",
"subagent_type": "general-purpose",
"prompt": "You are the analysis agent. Read and follow the instructions in <skill_dir>/agents/analyze/agent.md.\n\n## Inputs\n- repo_path: <repo_path>\n- scan_dir: <scan_dir>\n- skill_dir: <skill_dir>\n- cache_dir: <cache_dir>"
}
分析 Agent 会为每个候选项并行启动分析器,以评估其可利用性,并将发现结果文件写入 <scan_dir>/findings/。
第 5 步:汇总结果
调用 Task 工具来汇总发现结果:
{
"description": "Summarize scan results",
"subagent_type": "general-purpose",
"prompt": "You are the summarize agent. Read and follow the instructions in <skill_dir>/agents/summarize/agent.md.\n\n## Inputs\n- repo_path: <repo_path>\n- scan_dir: <scan_dir>\n- skill_dir: <skill_dir>\n- cache_dir: <cache_dir>"
}
执行完所有任务后,向用户报告扫描结果。
错误处理
如果任何 Task 调用失败,请重试一次。如果再次失败,则停止并报告失败情况。