mcpField
G
ghost-scan-code

ghost-scan-code

github.com/ghostsecurity安全4275.3k 次安装4 周前更新
代码仓库

关于 ghost-scan-code

用于仓库安全扫描的技能,可规划漏洞检查、分析提名文件并验证发现。扫描深度可设为 quick、balanced 或 full。

主要功能

  1. 01按项目类型规划扫描
  2. 02支持三种扫描深度
  3. 03提名待分析文件
  4. 04验证安全发现
  5. 05保存扫描计划与结果

适用场景

  1. 01检查仓库中的漏洞
  2. 02确认后执行更深入扫描
  3. 03验证候选安全问题

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ghostsecurity/skills --skill ghost-scan-code

安装后在 Claude Code 中输入/ghost-scan-code确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

criteria/
backend.yaml
frontend.yaml
index.yaml
library.yaml
mobile.yaml
prompts/
analyzer.md
nominator.md
planner.md
template-finding.md
verifier.md
scripts/
loop.sh

详细介绍

查找问题

在代码仓库中查找安全问题。此技能会规划要扫描的漏洞向量,然后针对每个项目执行扫描。

输入

  • 深度:quick(默认)、balanced 或 full — 通过 $ARGUMENTS 覆盖

$ARGUMENTS

注意: 如果提供了参数,可用于自定义扫描工作流。例如,如果用户指定了特定的一组向量、向量数量、特定的候选文件、关注区域、候选文件数量等,请确保将相关详情传递给技能中的相应步骤。

支持文件


步骤 1:设置

计算特定于仓库的输出目录:

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}/code" && cache_dir="${ghost_repo_dir}/cache" && mkdir -p "$scan_dir" && echo "scan_dir=$scan_dir cache_dir=$cache_dir"
  1. 读取 $cache_dir/repo.md — 如果文件不存在,先运行 repo-context 技能,然后继续。
  2. 读取 criteria/index.yaml,获取每种项目类型的有效 Agent→向量映射
  3. 如果未提供 depth,将其设为 quick
  4. 如果 depth 为 full,请告知用户完整扫描会显著增加 token 消耗,并在继续前征求确认。如果用户拒绝,则改为 balanced。

步骤 2:规划扫描

如果 $scan_dir/plan.md 已存在,则跳到下一步。

否则,使用 scripts/loop.sh 运行规划器:

bash <path-to-loop.sh> $scan_dir planner.md "- depth: <depth>
- arguments: <relevant argument overrides if any, otherwise omit>" 1 $cache_dir

设置 10 分钟超时。如果命令超时,请重新运行 — 脚本会从中断处继续。如果连续 3 次因同一错误失败,请停止并报告失败。

验证: 确认 $scan_dir/plan.md 存在,并且至少包含一个 ## Project: 章节,然后再继续。


步骤 3:提名文件

如果 $scan_dir/nominations.md 不存在,请读取 $scan_dir/plan.md 并生成该文件;针对每个项目章节(## Project: <base_path> (<type>)),解析 Recommended Scans 表格。对每一行,提取 Agent 和 Vector 列。将结果写入 $scan_dir/nominations.md — 每个(项目、Agent、向量)组合占一行。跳过扫描表格为空的项目。

# Nominations

- [ ] <base_path> (<type>) | <agent> | <vector>
- [ ] <base_path> (<type>) | <agent> | <vector>
...

如果 $scan_dir/nominations.md 已存在,请将所有顶层任务 - [x] 改为 - [ ]。每个任务项下方的所有缩进行/子任务保持不变。

运行提名脚本

使用 scripts/loop.sh:

bash <path-to-loop.sh> $scan_dir nominator.md "- depth: <depth>
- arguments: <relevant argument overrides if any, otherwise omit>" 5 $cache_dir

设置 10 分钟超时。如果命令超时,请重新运行 — 脚本会从中断处继续。如果连续 3 次因同一错误失败,请停止并报告失败。

验证: 确认 $scan_dir/nominations.md 至少包含一行 - [x],然后再继续。


步骤 4:分析提名的文件

读取 $scan_dir/nominations.md。对于已勾选 - [x] 的行下列出的每个候选文件,将其追加到 $scan_dir/analyses.md(跳过 analyses.md 中已列出的候选文件)。

- [ ] <base_path> (<type>) | <agent> | <vector> | <candidate_file>

创建发现项目录:

mkdir -p $scan_dir/findings
运行分析脚本

使用 scripts/loop.sh:

bash <path-to-loop.sh> $scan_dir analyzer.md "" 5 $cache_dir

设置 10 分钟超时。如果命令超时,请重新运行 — 脚本会从中断处继续。如果连续 3 次因同一错误失败,请停止并报告失败。

验证: 确认 $scan_dir/analyses.md 至少包含一行 - [x],然后再继续。


步骤 5:验证发现项

列出 $scan_dir/findings/ 中的所有 .md 文件。如果没有文件,则写入 no-findings.md 摘要并停止。

使用 scripts/loop.sh:

bash <path-to-loop.sh> $scan_dir verifier.md "" 5 $cache_dir

设置 10 分钟超时。如果命令超时,请重新运行 — 脚本会从中断处继续。如果连续 3 次因同一错误失败,请停止并报告失败。


完成

完成所有步骤后,报告扫描结果:

  1. 列出 $scan_dir/findings/ 中的所有发现项文件
  2. 统计已验证与已驳回的发现项数量
  3. 向用户提供摘要

评论

支持 Markdown