Jaden-JJH/trust-security-scanner
GitHub: Jaden-JJH/trust-security-scanner
AI 原生安全扫描器,自动化发现漏洞并生成修复代码与修复 PR。
Stars: 2 | Forks: 1
# Trust - AI 原生安全扫描器
[](https://smithery.ai/servers/trust-security/scanner)
扫描网站和 GitHub 仓库的安全漏洞。AI 分析根本原因,生成修复代码(包含前后对比差异),并一键创建修复 Pull Request。
**在线体验**: [https://www.trust-scan.me](https://www.trust-scan.me)
## 功能特性
### URL 安全扫描
- 基于 5,000+ Nuclei 模板的 DAST 漏洞检测
- 运行时检查 HTTP 头、SSL、CORS、Cookie 设置等
- 扫描完成时间低于 30 秒
### GitHub 仓库扫描
- **SAST**:使用 Semgrep 进行代码级漏洞检测(XSS、SQL 注入、硬编码密钥等)
- **Secrets**:使用 Gitleaks 检测 API 密钥、令牌、密码等泄露
- **SCA**:使用 npm audit 检测依赖项 CVE
- 加权评分系统(A+ 到 F 等级)
### AI 分析(Pro)
- 使用 Claude Sonnet 对每个漏洞进行根因分析
- **前后对比代码**:自动生成实际修复代码的差异
- 分步骤修复指南
### 自动修复 PR(Pro)
- 一键从 AI 分析结果创建 GitHub PR
- 自动创建分支、修改文件并打开 PR
- 支持 package.json 版本更新
### 使用 AI 修复(Pro)
- 为所有漏洞生成修复提示
- 可直接在 Cursor、Claude Code 及其他 IDE 中应用
### 附加功能
- **Trust 徽章**:基于安全评分的 README 徽章
- **基准对比**:与其他网站的安全评分进行比较
- **共享报告**:分享扫描结果链接(无需登录即可查看)
- **MCP 服务器**:在 Claude Code 和 Cursor 中进行内联安全扫描(8 个工具 + 3 个资源)
- **GitHub Action**:在 CI/CD 流水线中自动执行安全扫描并评论 PR
- **定时扫描**:按小时/每日/每周自动执行安全扫描并通过邮件/Slack 提醒
- **每周摘要**:每周发送安全报告邮件(评分趋势、漏洞汇总)
- **推送通知**:扫描完成时的 Web Push 通知
### 订阅计划
| | 免费 | 专业版($9.9/月) |
|---|---|---|
| URL 扫描 | 每月 5 次 | 无限制 |
| 仓库扫描 | 每月 3 次 | 无限制 |
| AI 分析 | 每次扫描 2 次 | 无限制 |
| 自动修复 PR | — | 是 |
| 定时扫描 | — | 是 |
| PDF/CSV 导出 | — | 是 |
## MCP 服务器(模型上下文协议)
在 Claude Code、Cursor IDE 及其他 MCP 客户端中通过单个命令安装,编码时可获得实时安全反馈。
### 安装(Claude Code)
```
claude mcp add --transport http trust-security "https://trust-mcp-144011703035.asia-northeast3.run.app/mcp"
```
### 安装(Claude Desktop / Cursor)
将以下内容添加到配置文件:
```
{
"mcpServers": {
"trust-security": {
"type": "http",
"url": "https://trust-mcp-144011703035.asia-northeast3.run.app/mcp"
}
}
}
```
### 可用工具(8 个工具)
| 工具 | 描述 | 示例 |
|------|------|------|
| `scan_and_wait` | 扫描网站并等待结果(推荐) | "Scan https://my-app.com" |
| `scan_url` | 启动网站扫描(异步) | "Start a scan" |
| `get_scan_result` | 获取 URL 扫描结果 | "Show scan results" |
| `scan_repo_and_wait` | 扫描 GitHub 仓库并等待结果(推荐) | "Security scan this repo" |
| `scan_repo` | 启动仓库扫描(异步) | "Start repo scan" |
| `get_repo_scan_result` | 获取仓库扫描结果 | "Show repo scan results" |
| `analyze_code_security` | 分析代码漏洞与密钥(37+ 模式) | "Check this code for security issues" |
| `check_secrets` | 检测 API 密钥/密码(20+ 模式) | "Any exposed keys in this code?" |
### MCP 资源(3 个资源)
AI 代理自动读取的上下文资源。
| 资源 URI | 描述 |
|----------|------|
| `trust://scans/latest` | 最新扫描结果(评分、等级、漏洞数量) |
| `trust://scans/history` | 最近 10 次扫描记录 |
| `trust://security/posture` | 安全态势摘要(平均评分、趋势、等级分布) |
## 技术栈
| 领域 | 技术 |
|------|------|
| **前端** | Next.js 16、React 19、TailwindCSS 4、Framer Motion |
| **后端** | FastAPI、Python 3.11+、Nuclei、Semgrep、Gitleaks |
| **数据库** | Supabase(PostgreSQL + 认证 + RLS) |
| **AI** | Claude API(Anthropic)——Sonnet 用于分析 |
| **支付** | Paddle(专业版订阅) |
| **部署** | Vercel(前端)、Cloud Run(后端 + MCP) |
## 项目结构
```
.
├── app/ # Next.js App Router
│ ├── page.tsx # Landing (URL / Repo scan)
│ ├── report/[scanId]/ # Scan report page
│ ├── history/ # Scan history
│ ├── pricing/ # Pricing
│ ├── why-trust/ # Why Trust marketing
│ ├── auth/ # OAuth callbacks (Supabase, GitHub)
│ ├── mcp/ # MCP setup guide
│ ├── error.tsx # Error boundary
│ └── not-found.tsx # 404 page
├── components/
│ ├── trust/ # Main view components
│ │ ├── client-app.tsx # Main app state management
│ │ ├── dashboard-view.tsx # Scan result dashboard
│ │ ├── landing-view.tsx # Landing view
│ │ ├── scanning-view.tsx # Scan progress view
│ │ ├── UpgradeModal.tsx # Go Pro modal
│ │ ├── NotificationToggle.tsx # Push notification toggle
│ │ ├── OnboardingTour.tsx # Onboarding tour
│ │ └── dashboard/
│ │ ├── CreateFixPRModal.tsx # Fix PR modal
│ │ ├── FixPromptModal.tsx # Fix Prompt modal
│ │ ├── ScheduleSection.tsx # Scheduled scan management
│ │ ├── DigestSection.tsx # Weekly digest settings
│ │ ├── BadgeSection.tsx # Trust Badge
│ │ ├── VulnerabilityList.tsx # Vulnerability list
│ │ └── ExportPanel.tsx # PDF/CSV export
│ └── ui/ # Shared UI (shadcn/ui)
├── lib/
│ ├── api.ts # Backend API client
│ ├── types.ts # TypeScript type definitions
│ ├── supabase.ts # Supabase client
│ └── subscription.ts # Pro subscription state management
│
├── backend/ # FastAPI Backend
│ ├── app/
│ │ ├── main.py # FastAPI entrypoint
│ │ ├── config.py # Configuration
│ │ ├── limiter.py # Rate limiting
│ │ ├── api/routes/
│ │ │ ├── scan.py # URL scan API
│ │ │ ├── repo_scan.py # GitHub repo scan API
│ │ │ ├── analyze.py # AI analysis API
│ │ │ ├── github.py # GitHub integration + Fix PR API
│ │ │ ├── github_webhook.py # GitHub webhook handler
│ │ │ ├── badge.py # Trust Badge API
│ │ │ ├── billing_webhook.py # Paddle billing webhook
│ │ │ ├── notifications.py # Notification settings API
│ │ │ └── scheduled_scans.py # Scheduled scan API
│ │ └── services/
│ │ ├── nuclei_scanner.py
│ │ ├── semgrep_scanner.py
│ │ ├── gitleaks_scanner.py
│ │ ├── repo_scanner.py # Unified repo scanner
│ │ ├── claude_analyzer.py # AI analysis (Claude)
│ │ ├── github_service.py # GitHub API service
│ │ ├── supabase_client.py # DB service
│ │ ├── scheduler.py # Scheduled scan scheduler
│ │ └── notifier.py # Email/Slack/digest notifications
│ ├── Dockerfile
│ └── requirements.txt
│
├── mcp-server/ # MCP Server (standalone service)
│ ├── server.py
│ ├── Dockerfile
│ └── requirements.txt
│
├── public/
│ └── sw.js # Push Notification Service Worker
│
└── docs/ # Documentation
├── README.ko.md # Korean documentation
├── ROADMAP.md
├── HANDOVER_CONTEXT_AWARE_FIX.md
└── REQUIREMENTS_UNIVERSAL_AUTO_FIX.md
```
## API 接口
### URL 扫描
| 方法 | 端点 | 描述 |
|------|------|------|
| `POST` | `/api/scan` | 启动 URL 扫描 |
| `GET` | `/api/scan/{scan_id}` | 获取扫描状态/结果 |
| `GET` | `/api/scan/{scan_id}/export` | 导出 PDF/CSV |
### 仓库扫描
| 方法 | 端点 | 描述 |
|------|------|------|
| `POST` | `/api/repo-scan` | 启动 GitHub 仓库扫描 |
| `GET` | `/api/repo-scan/{scan_id}` | 获取仓库扫描状态/结果 |
| `POST` | `/api/repo-scan/{scan_id}/analyze` | 运行 AI 分析 |
| `POST` | `/api/repo-scan/{scan_id}/fix-prompt` | 生成修复提示 |
### GitHub 集成
| 方法 | 端点 | 描述 |
|------|------|------|
| `GET` | `/api/github/connection` | 检查 GitHub 连接状态 |
| `POST` | `/api/github/connect` | 连接 GitHub OAuth |
| `POST` | `/api/github/create-fix-pr` | 创建修复 PR |
| `POST` | `/api/github/fix-feedback` | 提交修复质量反馈 |
| `DELETE` | `/api/github/connection` | 断开 GitHub 连接 |
### AI 分析
| 方法 | 端点 | 描述 |
|------|------|------|
| `POST` | `/api/analyze/{scan_id}` | 启动 AI 分析 |
| `GET` | `/api/analyze/{vuln_id}` | 获取分析结果 |
### 徽章
| 方法 | 端点 | 描述 |
|------|------|------|
| `POST` | `/api/badge/{scan_id}` | 颁发徽章 |
| `GET` | `/api/badge/{badge_id}` | 获取徽章 SVG |
### 定时扫描
| 方法 | 端点 | 描述 |
|------|------|------|
| `POST` | `/api/scheduled-scans` | 创建定时扫描 |
| `GET` | `/api/scheduled-scans` | 列出定时扫描 |
| `DELETE` | `/api/scheduled-scans/{id}` | 删除定时扫描 |
| `POST` | `/api/cron/run-schedules` | 执行定时任务(Cloud Scheduler) |
### 历史记录 / 通知
| 方法 | 端点 | 描述 |
|------|------|------|
| `GET` | `/api/scans/history` | 获取扫描历史 |
| `GET` | `/api/notifications/settings` | 获取通知设置 |
| `PUT` | `/api/notifications/settings` | 更新通知设置 |
### Webhook
| 方法 | 端点 | 描述 |
|------|------|------|
| `POST` | `/api/billing/webhook` | Paddle 计费 Webhook |
| `POST` | `/webhooks/github` | GitHub PR 事件 Webhook |
## 快速开始
###置条件
- Node.js 20+
- Python 3.11+
- Nuclei、Semgrep、Gitleaks(安全扫描工具)
- Supabase 账户
- Anthropic API 密钥
### 1. 克隆仓库
```
git clone --recurse-submodules https://github.com/Jaden-JJH/trust-security-scanner.git
cd trust-security-scanner
```
### 2. 前端配置
```
npm install
cp .env.example .env.local
npm run dev
```
**环境变量(.env.local)**
```
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_GITHUB_APP_CLIENT_ID=your-github-app-client-id
```
### 3. 后端配置
```
cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
uvicorn app.main:app --reload --port 8000
```
## 部署
### 前端(Vercel)
推送至 `main` 分支后自动部署(通过 GitHub 集成)。
### 后端(Cloud Run)
```
cd backend
gcloud builds submit --tag gcr.io/[PROJECT_ID]/trust-backend
gcloud run deploy trust-backend \
--image gcr.io/[PROJECT_ID]/trust-backend \
--platform managed --region asia-northeast3 \
--allow-unauthenticated
```
## 许可证
MIT License
标签:AI修复, AI安全扫描, DAST, GitHub Action, GitHub仓库扫描, Gitleaks, Google, MCP服务器, npm audit, Nuclei, SAST, Semgrep, SEO, WordPress安全扫描, 一键修复PR, 信任徽章, 前后对比, 安全报告, 安全评分, 定时扫描, 恶意软件分析, 推送通知, 漏洞修复, 盲注攻击, 结构化查询, 网站漏洞扫描, 网络安全培训, 自动化安全, 自动化攻击, 自动生成修复代码, 逆向工具