badchars/github-security-mcp
GitHub: badchars/github-security-mcp
面向 AI 代理的 GitHub 安全态势分析工具,通过 MCP 协议提供 39 个工具和 45 项检查,覆盖组织、仓库、Actions、secrets、供应链和访问控制六大领域的安全审计。
Stars: 0 | Forks: 0
面向 AI 代理的 GitHub 安全态势分析。
GitHub Enterprise 安全功能的费用为 $21/用户/月。
这为您的 AI 代理提供了 免费的同等可见性 —— 包括组织、仓库、Actions、secrets、供应链。
问题背景 • 独特之处 • 快速开始 • AI 能力 • 工具 • 检查项 • 架构
## 问题背景 GitHub 安全功能是碎片化的。针对组织设置、仓库配置、Actions 工作流分析、secret 扫描、供应链和访问控制,您需要使用各自独立的工具。没有单一工具能涵盖所有内容,而且没有一种工具能与 AI 代理协同工作。 ``` Traditional workflow: manually check org settings → click through 15 pages run github-advisory-db for each repo → one at a time grep workflows for script injection → miss half the patterns review collaborator access → spreadsheet hell check secret scanning alerts → another dashboard ────────────────────────────────────────── Total: hours of manual work per org ``` **github-security-mcp** 通过 [Model Context Protocol](https://modelcontextprotocol.io) 为您的 AI 代理提供 39 个工具和 45 项安全检查。代理直接调用 GitHub API,理解其发现的内容,并准确告诉您需要修复什么。 ``` With github-security-mcp: You: "Audit my GitHub org for security issues and prioritize the fixes" Agent: → checks org settings (2FA, SSO, member privileges) → scans repos (branch protection, secret scanning, Dependabot) → analyzes workflows (script injection, unpinned actions, OIDC) → reviews access (teams, collaborators, PATs, GitHub Apps) → "12 critical, 8 high — here are the top 5 to fix now" ``` ## 独特之处 现有工具仅关注 GitHub 安全的某一个切片。github-security-mcp 覆盖完整的技术栈,并可与任何 AI 代理配合使用。| 现有工具 | github-security-mcp | |
|---|---|---|
| 接口 | CLI / GitHub UI / 仪表盘 | MCP — AI 代理实时调用工具 |
| 范围 | 单一领域 (Actions, 或 secrets, 或仓库) | 全栈: 组织 + 仓库 + Actions + secrets + 供应链 + 访问控制 |
| 关联分析 | 无 — 孤立的发现结果 | 代理链式推理: "此未固定的 action + 写入权限 + 无环境保护 = 供应链风险" |
| 修复建议 | 通用文档链接 | 代理针对您的具体配置生成特定的修复指南 |
| Actions 分析 | 大多数工具跳过工作流 | 8 项检查: 脚本注入、PR target、OIDC、版本固定、secrets、runners、环境、权限 |
| Enterprise 功能 | 需要 GitHub Enterprise ($21/用户/月) | 免费 — 使用公开 API,并对 Enterprise 专属功能进行优雅降级 |
与热门工具的具体对比
| 工具 | 功能 | 局限性 | |---|---|---| | [Allstar](https://github.com/ossf/allstar) | 通过 GitHub App 强制执行仓库设置 | 无 Actions 分析,无 secret 扫描,无访问审计 | | [Scorecard](https://github.com/ossf/scorecard) | 仓库的 OpenSSF 安全评分 | 聚焦单仓库,无组织级检查,无实时交互 | | [Legitify](https://github.com/Legit-Labs/legitify) | 组织 + 仓库策略强制执行 | CLI 输出,无 AI 集成,Actions 分析有限 | | [step-security/harden-runner](https://github.com/step-security/harden-runner) | 运行时 Actions 安全 | 仅限 Actions,无组织/仓库/访问检查 | | [GitGuardian](https://www.gitguardian.com/) | 提交中的 Secret 检测 | 仅 SaaS,无自托管,仅限于 secrets 领域 | | [Socket](https://socket.dev/) | 供应链风险分析 | 聚焦包管理,无组织/Actions/访问分析 | 所有这些都是优秀的工具。github-security-mcp 并不取代它们 — 它填补了为 AI 代理提供跨所有 GitHub 安全领域的**统一、交互式访问**的空白。
Claude Code
``` claude mcp add github-security -- bun run /path/to/github-security-mcp/src/index.ts ```Claude Desktop
添加到 `~/Library/Application Support/Claude/claude_desktop_config.json`: ``` { "mcpServers": { "github-security": { "command": "bun", "args": ["run", "/path/to/github-security-mcp/src/index.ts"], "env": { "GITHUB_TOKEN": "ghp_your_token_here" } } } } ```Cursor / Windsurf / 其他 MCP 客户端
使用相同的 JSON 配置格式。将命令指向您的安装路径。组织 (7)
| 工具 | 描述 | |------|-------------| | `github_check_org_security` | 2FA 强制执行、默认仓库可见性、成员创建权限 | | `github_check_org_sso` | 通过 GraphQL 获取 SSO/SAML 配置 | | `github_check_org_members` | 外部协作者、僵尸成员检测 | | `github_check_org_apps` | OAuth 凭证授权、GitHub App 安装权限 | | `github_check_org_webhooks` | 不安全的 webhook URL (HTTP, 无 secret) | | `github_check_org_audit_log` | 可疑的审计日志活动 (Enterprise) | | `github_list_org_repos` | 列出组织中的所有仓库及安全元数据 |仓库 (8)
| 工具 | 描述 | |------|-------------| | `github_check_repo_branch_protection` | 默认分支的分支保护规则 | | `github_check_repo_secrets` | Secret 扫描和推送保护启用状态 | | `github_check_repo_code_scanning` | CodeQL / 代码扫描启用状态及未关闭的警报 | | `github_check_repo_dependabot` | Dependabot 启用状态、严重警报分级 | | `github_check_repo_settings` | SECURITY.md、私有漏洞报告、Fork 限制 | | `github_check_repo_webhooks` | 不安全的仓库级 webhook URL | | `github_check_repo_deploy_keys` | 部署密钥权限 (只读 vs 读写) | | `github_check_repo_codeowners` | CODEOWNERS 文件存在性及强制执行 |Actions (8)
| 工具 | 描述 | |------|-------------| | `github_check_workflow_injection` | `run:` 块中通过 `${{ github.event.* }}` 进行的脚本注入 | | `github_check_workflow_pr_target` | `pull_request_target` + checkout 模式 (严重) | | `github_check_workflow_permissions` | GITHUB_TOKEN 默认权限范围 | | `github_check_workflow_pinning` | 未固定的第三方操作 (标签 vs SHA) | | `github_check_workflow_runners` | 自托管 Runner 暴露风险 | | `github_check_workflow_environments` | 缺失的环境保护规则 | | `github_check_workflow_secrets` | 工作流中的 Secret 窃取模式 | | `github_check_workflow_oidc` | OIDC 主题声明自定义 |Secrets (4)
| 工具 | 描述 | |------|-------------| | `github_check_secret_scanning` | 覆盖范围缺口及未解决的警报 | | `github_check_push_protection` | 推送保护绕过追踪 | | `github_check_secret_patterns` | 自定义 Secret 模式配置 | | `github_check_secret_scoping` | 环境、仓库和组织级的 Secret 作用域 |供应链 (4)
| 工具 | 描述 | |------|-------------| | `github_check_dependency_graph` | 依赖图启用状态 | | `github_check_dependabot_updates` | Dependabot 安全更新配置 | | `github_check_sbom` | SBOM 生成能力 | | `github_check_vulnerabilities` | 已知漏洞、超过 90 天未修复的严重漏洞 |访问控制 (4)
| 工具 | 描述 | |------|-------------| | `github_check_team_permissions` | 团队在各仓库的权限级别 | | `github_check_collaborators` | 外部协作者访问审计 | | `github_check_app_permissions` | GitHub App 权限范围审查 | | `github_check_pat_usage` | Classic vs Fine-grained PAT 使用情况 |元数据 (4)
| 工具 | 描述 | |------|-------------| | `github_list_checks` | 浏览所有 45 项检查,按类别/严重程度筛选 | | `github_audit_summary` | 按类别、严重程度、状态聚合发现结果 | | `github_audit_report` | 完整的 Markdown 或 JSON 审计报告 | | `github_run_all` | 对组织/仓库执行所有检查 |组织 (ORG-001 至 ORG-010)
| ID | 检查项 | 严重程度 | |---|---|---| | ORG-001 | 未强制执行 2FA | CRITICAL | | ORG-002 | 默认仓库可见性为公开 | HIGH | | ORG-003 | 成员可创建公开仓库 | MEDIUM | | ORG-004 | 未配置 SSO/SAML | HIGH | | ORG-005 | 有访问权限的外部协作者 | MEDIUM | | ORG-006 | 僵尸组织成员 | LOW | | ORG-007 | 有风险的 OAuth App 授权 | HIGH | | ORG-008 | 权限过大的 GitHub App 安装 | HIGH | | ORG-009 | 不安全的 Webhook URL | MEDIUM | | ORG-010 | 可疑的审计日志活动 | INFO |仓库 (REPO-001 至 REPO-013)
| ID | 检查项 | 严重程度 | |---|---|---| | REPO-001 | 缺失或薄弱的分支保护 | CRITICAL | | REPO-002 | 未启用 Secret 扫描 | HIGH | | REPO-003 | 未启用推送保护 | HIGH | | REPO-004 | 未启用代码扫描 | MEDIUM | | REPO-005 | 存在未关闭的代码扫描警报 | HIGH | | REPO-006 | 未启用 Dependabot | MEDIUM | | REPO-007 | 严重 Dependabot 警报 | CRITICAL | | REPO-008 | 无 SECURITY.md 策略文件 | LOW | | REPO-009 | 私有漏洞报告已关闭 | LOW | | REPO-010 | 无限制的 Fork 设置 | LOW | | REPO-011 | 不安全的仓库 Webhook | MEDIUM | | REPO-012 | 读写型部署密钥 | HIGH | | REPO-013 | 缺少 CODEOWNERS 文件 | LOW |Actions (ACT-001 至 ACT-008)
| ID | 检查项 | 严重程度 | |---|---|---| | ACT-001 | 通过不可信输入进行脚本注入 | CRITICAL | | ACT-002 | pull_request_target 配合 checkout | CRITICAL | | ACT-003 | 权限过大的 GITHUB_TOKEN | HIGH | | ACT-004 | 未固定的第三方 Actions | MEDIUM | | ACT-005 | 自托管 Runner 暴露 | HIGH | | ACT-006 | 缺失环境保护规则 | MEDIUM | | ACT-007 | Secret 窃取模式 | HIGH | | ACT-008 | OIDC 配置错误 | MEDIUM |Secrets (SEC-001 至 SEC-005)
| ID | 检查项 | 严重程度 | |---|---|---| | SEC-001 | Secret 扫描覆盖缺口 | HIGH | | SEC-002 | 未解决的 Secret 扫描警报 | CRITICAL | | SEC-003 | 推送保护绕过 | HIGH | | SEC-004 | 无自定义 Secret 模式 | LOW | | SEC-005 | Secret 作用域过宽 | MEDIUM |供应链 (SUP-001 至 SUP-005)
| ID | 检查项 | 严重程度 | ---|---|---| | SUP-001 | 未启用依赖图 | MEDIUM | | SUP-002 | Dependabot 安全更新已关闭 | HIGH | | SUP-003 | 无 SBOM 生成 | LOW | | SUP-004 | 严重已知漏洞 | CRITICAL | | SUP-005 | 陈旧未修复漏洞 (>90 天) | HIGH |访问控制 (ACC-001 至 ACC-004)
| ID | 检查项 | 严重程度 | |---|---|---| | ACC-001 | 权限过大的团队访问 | HIGH | | ACC-002 | 外部协作者拥有写权限及以上 | MEDIUM | | ACC-003 | 权限范围过大的 GitHub Apps | HIGH | | ACC-004 | 拥有广泛范围的 Classic PAT | HIGH |
仅用于授权的安全测试和评估。
在审计任何组织之前,请务必确保您已获得适当的授权。
MIT License • 使用 Bun + TypeScript 构建
标签:AI安全, Bun, Chat Copilot, CISA项目, DevSecOps, GitHub Actions, GitHub安全, HTTP/HTTPS抓包, LLM工具, Secrets扫描, Streamlit, StruQ, 上游代理, 代码安全, 反取证, 大模型MCP, 安全评估, 态势感知, 文档安全, 漏洞枚举, 结构化查询, 自动化安全, 自动化攻击, 自动笔记, 访问控制