关于 ghost-scan-secrets
用于秘密信息扫描的编排技能,将仓库扫描、候选项分析和报告生成交给子 Agent。它使用 Poltergeist 扫描器,并对失败任务重试一次。
主要功能
- 01初始化 Poltergeist 扫描器
- 02扫描仓库中的秘密候选项
- 03委派候选项分析
- 04生成发现摘要
- 05失败任务重试一次
适用场景
- 01扫描代码库中的暴露秘密
- 02评估检测到的秘密候选项
- 03生成扫描结果报告
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ ghostsecurity/ skills --skill ghost-scan-secrets安装后在 Claude Code 中输入/ghost-scan-secrets确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
README.mdagents/analyze/agent.mdanalyzer.mdtemplate-finding.mdagents/init/agent.mdagents/scan/agent.mdagents/summarize/agent.mdtemplate-report.md详细介绍
Ghost Security Secrets Scanner — Orchestrator
你是负责机密扫描的顶层协调器。你的唯一工作是调用 Task 工具,生成子 Agent 来完成实际工作。下面的每个步骤都给出了要使用的准确 Task 工具参数。不要亲自执行这些工作。
默认值
- repo_path:当前工作目录
- scan_dir:
~/.ghost/repos/<repo_id>/scans/<short_sha>/secrets - short_sha:
git rev-parse --short HEAD(对于非 Git 目录,则回退到YYYYMMDD)
$ARGUMENTS
上面提供的任何值都会覆盖默认值。
执行
- 设置 — 计算路径并创建输出目录
- 初始化 Poltergeist — 安装 poltergeist 二进制文件
- 扫描机密 — 使用 poltergeist 扫描代码库
- 分析候选项 — 评估每个候选项以确认其是否有效
- 汇总结果 — 生成最终扫描报告
第 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}/secrets" && cache_dir="${ghost_repo_dir}/cache" && mkdir -p "$scan_dir/findings" && skill_dir=$(find . -path '*skills/scan-secrets/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–4 中不得使用 Bash、Read、Grep、Glob 或任何其他工具。
第 1 步:初始化 Poltergeist
调用 Task 工具以初始化 poltergeist 二进制文件:
{
"description": "Initialize poltergeist 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 会将 poltergeist 安装到 ~/.ghost/bin/poltergeist(Windows 上则为 poltergeist.exe)。
第 2 步:扫描机密
调用 Task 工具运行 poltergeist 扫描器:
{
"description": "Scan for secret candidates",
"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 会返回候选项数量,并写入 <scan_dir>/candidates.json。
如果候选项数量为 0:跳至第 4 步(汇总),不报告任何发现。
第 3 步:分析候选项
调用 Task 工具分析候选项:
{
"description": "Analyze secret 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/。
第 4 步:汇总结果
调用 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 调用失败,请重试一次。如果再次失败,则停止并报告失败。