使用说明
🛡️ 哨兵MCP扫描仪
模型上下文协议服务器的安全扫描程序
Sentinel扫描MCP服务器配置、实时端点和Docker容器是否存在安全配置错误,并显示严重性评级、补救指南和CI/CD集成的发现。
Sentinel检测到配置错误。有关360°企业运行时保护,请参阅 Helixar.
特性
- 🔍 配置扫描程序 --MCP服务器配置文件的静态分析(10次检查)
- 🌐 探头扫描仪 --实时端点安全分析(8次检查)
- 🐳 集装箱扫描仪 --Docker容器/镜像检查(8次检查)
- 📋 26条检测规则 跨所有模块
- 🎨 4种输出格式 --终端(富)、HTML、JSON、SARIF 2.1
- ⚙️ GitHub行动 --插入CI集成,支持SARIF上传
- 🚦 阈值失败 --阻断高/关键发现的PR
安装
pip install helixar-sentinel
或来源:
git clone https://github.com/Helixar-AI/sentinel
cd sentinel
pip install -e ".[dev]"
快速开始
# Scan a config file
sentinel config mcp.json
# Probe a live endpoint
sentinel probe https://your-mcp-server.example.com
# Inspect a Docker container
sentinel container my-mcp-image:latest
# Run all scanners in one pass
sentinel scan --config mcp.json --endpoint https://mcp.example.com --container my-image:latest
# Output as SARIF for GitHub Code Scanning
sentinel config mcp.json --format sarif --output sentinel.sarif.json
GitHub操作
- uses: Helixar-AI/sentinel@v1
with:
config: ./mcp.json
endpoint: ${{ secrets.MCP_ENDPOINT }}
container: my-mcp-image:latest
fail-on: high
format: sarif
output: sentinel.sarif.json
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: sentinel.sarif.json
输入
| 输入 | 必填 | 默认 | 说明 |
|---|---|---|---|
config |
否 | -- | MCP服务器配置文件的路径 |
endpoint |
没有 | -- | 要探测的实时MCP端点URL |
container |
否 | -- | Docker容器名称或映像 |
fail-on |
没有 | high |
构建失败的最低严重程度 |
format |
没有 | sarif |
输出格式(terminal/json/sarif/html) |
output |
没有 | sentinel.sarif.json |
报告输出路径 |
输出格式
| 格式 | 标志 | 用例 |
|---|---|---|
| 航站楼 | --format terminal (默认) |
本地开发 |
| JSON | --format json |
定制工具 |
| 萨里夫 | --format sarif |
GitHub代码扫描 |
| HTML | --format html |
利益相关者报告 |
检测规则
配置模块——10条规则
| ID | 严重性 | 检查 |
|---|---|---|
| CFG-001 | 🔴 关键 | 未配置身份验证 |
| CFG-002 | 🔴 CRITICAL | 配置中的明文机密 |
| CFG-003 | 🟠 HIGH | 通配符工具权限 |
| CFG-004 | 🟠 高 | 无速率限制 |
| CFG-005 | 🟡 MEDIUM | 调试模式已启用 |
| CFG-006 | 🟠 HIGH | 无TLS配置 |
| CFG-007🟠 HIGH | 通配符CORS来源 | |
| CFG-008 | 🟡 中等 | 无输入验证 |
| CFG-009 | 🟡 中等 | 敏感数据记录 |
| CFG-010 | 🔵 LOW | 无请求超时 |
探头模块——8条规则
| ID | 严重性 | 检查 |
|---|---|---|
| PRB-001 | 🔴 关键 | TLS证书无效/已过期 |
| PRB-002 | 🟠 高 | 弱TLS版本(<TLS 1.2) |
| PRB-003 | 🔴 关键 | 无需身份验证 |
| PRB-004 | 🟡 MEDIUM | 标头中披露的服务器版本 |
| PRB-005 | 🟡 MEDIUM | 缺少安全标头 |
| PRB-006 | 🟠 HIGH | 工具列表公开 |
| PRB-007🔵 LOW | 详细错误消息 | |
| PRB-008 | 🟠 HIGH | 未检测到速率限制 |
容器模块——8条规则
| ID | 严重性 | 检查 |
|---|---|---|
| CTR-001 | 🟠 HIGH | 以root身份运行的容器 |
| CTR-002 | 🔴 关键 | 特权集装箱模式 |
| CTR-003 | 🟡 中等 | 没有CPU/内存资源限制 |
| CTR-004 | 🟠 高 | 敏感环境变量暴露 |
| CTR-005 | 🟡 MEDIUM | 可写根文件系统 |
| CTR-006 | 🔵 低 | 未配置健康检查 |
| CTR-007 | 🟡 中等 | 基础图像已过时 |
| CTR-008 | 🟠 高 | 危险端口暴露 |
阈值失败
sentinel config mcp.json --fail-on critical # exit 1 on CRITICAL only
sentinel config mcp.json --fail-on high # exit 1 on HIGH+ (default)
sentinel config mcp.json --fail-on medium # exit 1 on MEDIUM+
sentinel config mcp.json --fail-on low # exit 1 on any finding
添加新规则
规则是数据,而不是代码——添加一个规则需要三个步骤:
1. 添加 sentinel/rules/rules.yaml
2. 添加a _check_<key> 相关模块扫描仪中的方法
3. 添加测试
看 贡献.md 完整的工作流程。
运行测试
python -m pytest tests/unit/ -v
python -m pytest tests/ --cov=sentinel --cov-report=html
路线图
- [ ]
sentinel watch--连续监测模式 - []Kubernetes清单扫描
- []JWT算法混淆+重放攻击探测检查
- [ ]
--diff跨运行回归检测标志 - []附加输出:用于遗留CI系统的JUnitXML
许可证
建造于 Helixar安全研究 •运行时保护: helixar.ai公司
⭐ 标记此回购 如果哨兵对你有用,它会帮助别人找到它。
