/ 目錄 / 演練場 / repo-forensics
● 社群 alexgreensh ⚡ 即開即用

repo-forensics

作者 alexgreensh · alexgreensh/repo-forensics

18 個防禦性掃描器,在安裝前對 repo、skill、MCP 伺服器或外掛程式進行提示注入、機密洩漏、生命週期鉤子、typosquat 和竄改痕跡的審查。

Repo-forensics 是一款針對「沒人在做」這個問題的防禦性審計工具:在以完整系統權限安裝第三方程式碼之前先進行審查。18 個並行掃描器涵蓋執行期動態行為、manifest 偏移、SKILL.md 中的提示注入、MCP 工具投毒、鉤子腳本的 DAST、機密洩漏、SAST、AST 分析、依賴套件 typosquat、生命週期鉤子、高熵酬載、IaC 錯誤設定、偽裝的二進位檔、事後入侵痕跡,以及 git commit 偽造。零依賴。

為什麼要用

核心特性

即時演示

實際使用效果

repo-forensics-skill.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "repo-forensics-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/alexgreensh/repo-forensics",
        "~/.claude/skills/repo-forensics"
      ],
      "_inferred": true
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "repo-forensics-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/alexgreensh/repo-forensics",
        "~/.claude/skills/repo-forensics"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "repo-forensics-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/alexgreensh/repo-forensics",
        "~/.claude/skills/repo-forensics"
      ],
      "_inferred": true
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "repo-forensics-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/alexgreensh/repo-forensics",
        "~/.claude/skills/repo-forensics"
      ],
      "_inferred": true
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "repo-forensics-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/alexgreensh/repo-forensics",
        "~/.claude/skills/repo-forensics"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "repo-forensics-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/alexgreensh/repo-forensics",
          "~/.claude/skills/repo-forensics"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add repo-forensics-skill -- git clone https://github.com/alexgreensh/repo-forensics ~/.claude/skills/repo-forensics

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: repo-forensics

在將第三方 skill clone 到 ~/.claude/skills 前先進行審計

👤 任何從 GitHub 上陌生人處安裝 skill 的使用者 ⏱ ~15 min beginner

何時使用: 有人傳給你一個看起來很酷的 skill 連結,在 clone 之前你想確認它是否安全。

前置條件
  • repo-forensics installed — git clone https://github.com/alexgreensh/repo-forensics ~/.claude/skills/repo-forensics
步驟
  1. 指定目標 repo 的 URL
    Use repo-forensics. Scan https://github.com/<author>/<skill> with the skill_threats, secrets, dataflow, and lifecycle scanners. Report findings.✓ 已複製
    → 包含嚴重性標記的逐掃描器報告
  2. 閱讀關聯發現結果
    Any correlations across scanners — e.g. a secret-leak path plus a lifecycle hook?✓ 已複製
    → 關聯摘要

結果: 基於掃描器輸出而非直覺的「可安裝 / 不可安裝」決策。

注意事項
  • 將掃描結果全綠視為安全的完整證明 — 掃描器提供的是強力的基準,而非上限——仍需親自閱讀 SKILL.md
搭配使用: github · filesystem

審計 MCP 伺服器是否存在工具投毒和 rug-pull 模式

👤 將新 MCP 導入正式環境代理人堆疊的團隊 ⏱ ~20 min intermediate

何時使用: 在將新的 MCP 伺服器加入具有實際權限的代理人之前。

步驟
  1. 執行 MCP 專屬掃描器
    Scan this MCP server repo with mcp_security, skill_threats, integrity, and dast.✓ 已複製
    → 聚焦於工具描述和安裝腳本的發現結果
  2. 檢查 git 歷史記錄是否有身分偽造
    Run git_forensics on the same repo — any spoofed commits?✓ 已複製
    → 作者 / 簽名分析

結果: 在將 MCP 接入代理人之前取得完整的安全審查報告。

在可疑安裝後執行事後掃描器

👤 剛執行完 npm/pip install 並感到不安的使用者 ⏱ ~15 min intermediate

何時使用: 安裝完成後出現非預期行為,你想確認是否有可疑內容落地。

步驟
  1. 執行 post_incident 和 entropy 掃描
    Run post_incident scanner on ~/.npm and the current project. Also entropy scan the installed packages.✓ 已複製
    → 標記可疑的快取產物或編碼酬載

結果: 取得是否需要輪換機密和重建環境的依據。

注意事項
  • 從可能已遭入侵的 shell 執行掃描 — 有疑慮時,從全新的 shell 或其他機器執行

組合

與其他 MCP 搭配,撬動十倍槓桿

repo-forensics-skill + github

取得 PR 的差異並僅掃描新增的檔案

Fetch PR #123 and run repo-forensics just on the files it adds.✓ 已複製
repo-forensics-skill + filesystem

掃描本地 clone 的 repo 並儲存 JSON 報告

Scan ./suspicious-repo and write findings.json next to it.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
skill_threats repo path 任何 skill 審計 0
mcp_security repo path MCP 審計 0
secrets repo path 任何情況下都應執行 0
dataflow repo path 懷疑有可疑對外連線時 0
lifecycle repo path 安裝前 0
git_forensics repo path 查驗維護者身分時 0
entropy repo path 懷疑有混淆處理時 0
sast repo path 一般程式碼風險評估 0

成本與限制

運行它的成本

API 配額
None
每次呼叫 Token 數
中等——掃描器輸出的摘要生成可能會增長
費用
Free
提示
僅執行與威脅模型相關的掃描器(skill 相關 → skill_threats;MCP 相關 → mcp_security)

安全

權限、密鑰、影響範圍

憑證儲存: 無——掃描器為唯讀操作
資料出站: 預設僅在本地執行,不對外傳送資料
切勿授予: Write access to the repo under audit

故障排查

常見錯誤與修復

Scanner reports 0 findings on obviously sketchy repo

確認你是對完整的 repo 路徑執行掃描,而非子集;並檢查掃描器的選擇是否正確

驗證: repo-forensics list-scanners
False positives flood the report

依嚴重性過濾;聚焦於 high/critical;使用關聯功能來排定優先順序

替代方案

repo-forensics 對比其他方案

替代方案何時用它替代權衡
claude-cybersecurity你的程式碼需要 OWASP 風格的應用程式安全審查,而非供應鏈審查關注點不同——應用程式邏輯 vs 安裝時的威脅
gitleaks / trufflehog你只需要機密掃描單一掃描器,不具關聯分析能力

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills