vibesafeio/vibesafe-action

GitHub: vibesafeio/vibesafe-action

专为 AI 辅助编程打造的免费安全扫描 GitHub Action,30 秒完成配置,自动检测 PR 中的 500+ 种漏洞模式并生成 AI 可直接理解的修复指令。

Stars: 0 | Forks: 0

# VibeSafe — Vibe 编码应用的安全扫描器 VibeSafe 会扫描每个 PR 中的硬编码机密、SQL 注入、缺失的 Supabase RLS 以及 500 多种漏洞模式。它会告诉你确切的文件、行号以及修复方法。 ![VibeSafe PR Comment](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/0153f08f7b141501.png) **免费。开源。30 秒设置。** [![GitHub Action](https://img.shields.io/badge/GitHub%20Action-vibesafe--action-blue?logo=github)](https://github.com/vibesafeio/vibesafe-action) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) ## 适用人群 当你添加注册表单、接受支付或存储用户数据的那一刻起——**这些数据就是你的责任。** 如果发生泄露,责无旁贷。 VibeSafe 专为追求快速交付且需要不拖慢进度的安全网的开发者而设计。 ## 立即体验(无需安装) 即时扫描任意 GitHub 仓库: ``` git clone https://github.com/vibesafeio/vibesafe-action.git python3 vibesafe-action/tools/cli_scanner.py https://github.com/YOUR/REPO ``` 30 秒内获取你的评分。无需注册,无需 API key,无需配置。 **希望在每次 PR 时都自动运行?** 请继续阅读。↓ ## 查看工作原理 1. 复制下方的 YAML → 创建一个 PR 2. 20 秒后,会出现此评论: ![VibeSafe PR Comment](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/0153f08f7b141501.png) 3. 展开 **"Fix with AI"** → 复制提示词 → 粘贴到 Cursor 中 4. 你的 AI 会修复所有问题 5. 再次推送 → **100/100 Grade A ✅ Certified** ## 安装(30 秒) 将此文件复制到 `.github/workflows/vibesafe-scan.yml`: ``` name: VibeSafe Security Scan on: pull_request: types: [opened, synchronize, reopened] permissions: contents: read pull-requests: write jobs: vibesafe: name: Security Scan runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Run VibeSafe scan uses: vibesafeio/vibesafe-action@v0 with: domain: auto ``` PR 评论会自动发布。无需额外配置。 ## 如果不扫描会发生什么 这些是来自 vibe 编码应用的真实事件: - **[Moltbook](https://www.theregister.com/2026/02/27/lovable_app_vulnerabilities/)** — 150 万个身份验证令牌 + 35,000 封电子邮件泄露。应用运行完美。安全却并非如此。 - **[Lovable app](https://www.theregister.com/2026/02/27/lovable_app_vulnerabilities/)** — 一款应用因 Supabase RLS 配置错误导致 18,000 名用户的数据泄露。 - **[Escape research](https://escape.tech/blog/methodology-how-we-discovered-vulnerabilities-apps-built-with-vibe-coding/)** — 扫描了 5,600 个 vibe 编码的应用 → 发现 2,000+ 个漏洞,400+ 个暴露的机密,175 个 PII 泄露。 你的应用可能是下一个。也可能没事。**唯一的方法就是扫描它。**
VibeSafe 与其他工具相比如何? | | VibeSafe | Snyk | CodeQL | Dependabot | |---|---|---|---|---| | 设置时间 | **30 秒** | 30分钟+ | 15分钟+ | 自动(仅限依赖) | | 成本 | **免费** | $35K+/年 | 免费(公开) | 免费 | | 带修复指南的 PR 评论 | ✅ | 部分 | ❌ | ❌ | | AI 代码模式 | ✅ | ❌ | ❌ | ❌ | | 阻止合并 | ✅ | ✅ | ✅ | ❌ | 但老实说——如果你正在读这个,你可能没有使用其中任何一个。这就是 VibeSafe 解决的问题。
### OWASP Juice Shop 基准测试 我们扫描了 [OWASP Juice Shop](https://github.com/juice-shop/juice-shop)(故意设计的易受攻击应用):**36 个发现,0/100 Grade F。** 复现:`./test/benchmark_juiceshop.sh` ## 扫描内容 | 层级 | AI 易错点 | VibeSafe 捕获项 | |-------|-------------------|------------------| | **代码** | `eval()`, f-string SQL, `shell=True`, XSS | SAST — OWASP Top 10 + 6 条 vibe 编码规则 | | **机密** | 硬编码 API key,前端的令牌 | 15 种机密模式 + `.env.example` 生成 | | **配置** | 无 RLS 的 Supabase,Firebase 测试模式 | 配置扫描器 — 检查 DB 安全策略 | | **依赖** | 未固定的版本,已知 CVE | SCA — pip-audit + npm audit | | **Header** | 缺失 CORS, CSRF, Helmet | 针对 Express/Flask/Next.js 的自定义规则 | 支持的语言:JavaScript · TypeScript · Python · Java · Go · Ruby · PHP · Kotlin ## 🤖 AI 修复提示词 — vibe 编码者真正需要的功能 其他扫描器会说“你有 10 个漏洞”。VibeSafe 会说**“把这个粘贴到 Cursor 里,它们都会被修复。”** 每条 PR 评论都包含一个可折叠的 **"Fix with AI"** 部分: ``` Fix these security issues in my code: - CRITICAL: config.py:5 — Store API key in .env: os.environ.get('OPENAI_API_KEY') - HIGH: app.py:24 — Use parameterized queries: cursor.execute("SELECT ... WHERE id = ?", (param,)) - HIGH: app.py:67 — Remove shell=True: subprocess.run(shlex.split(cmd)) Move all hardcoded secrets to environment variables. Generate a .env.example with placeholder values. ``` 复制。粘贴到你的 AI。完成。**你不需要修复代码 —— 你的 AI 来做。VibeSafe 告诉它该修复什么。** ## 领域选项 ``` domain: auto # Auto-detect from code analysis (default) domain: ecommerce # Payments/orders — PCI DSS rules domain: fintech # Banking/transfers — AML rules domain: healthcare # Patient data — HIPAA rules domain: platform # SaaS/multi-tenant — JWT, RBAC domain: game # Game servers — WebSocket, client tampering domain: education # Student data — FERPA, COPPA ``` ## 仅差异扫描 **VibeSafe 自动仅扫描 PR 引入的新代码** —— 而不是整个仓库。这意味着: - 更快的扫描(几秒钟,而不是几分钟) - 没有来自既有问题的干扰 - 仅显示你引入的漏洞 - 在 `pull_request` 事件触发时自动工作 这与 Semgrep 付费层使用的 `--baseline-commit` 方法相同,但是免费的。 ## 自定义规则 在 VibeSafe 默认规则之上添加你自己的 Semgrep 规则: ``` - uses: vibesafeio/vibesafe-action@v0 with: domain: auto custom-rules: "./my-rules.yml,p/react,https://example.com/team-rules.yml" ``` 与社区分享规则 —— 只需要一个 YAML 文件。示例: - `p/react` — Semgrep registry 中特定于 React 的规则 - `./security/fintech-rules.yml` — 你团队的自定义规则 - 共享规则集的 URL ## README 动态徽章 在你的 README 中添加自动更新的 VibeSafe 徽章。在 VibeSafe 扫描后添加此步骤: ``` - name: Update VibeSafe badge if: github.ref == 'refs/heads/main' uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.GIST_SECRET }} gistID: YOUR_GIST_ID filename: vibesafe-badge.json label: VibeSafe message: "${{ steps.vibesafe.outputs.score }}/100 ${{ steps.vibesafe.outputs.grade }}" color: ${{ steps.vibesafe.outputs.grade == 'A' && 'brightgreen' || steps.vibesafe.outputs.grade == 'B' && 'green' || steps.vibesafe.outputs.grade == 'C' && 'yellow' || 'red' }} ``` 然后在你的 README 中: ``` ![VibeSafe](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/YOUR_USER/YOUR_GIST_ID/raw/vibesafe-badge.json) ``` ## 评分 | 等级 | 分数 | 含义 | |-------|-------|---------| | 🟢 **A** + ✅ Certified | 85 – 100 | 无严重或高危发现 | | 🟢 **A** | 85 – 100 | 良好 | | 🟡 **B** | 70 – 84 | 轻微漏洞 | | 🟠 **C** | 50 – 69 | 多个中等发现 | | 🔴 **D / F** | 0 – 49 | 存在严重或高危发现 | **✅ Certified** 徽章在 Critical = 0, High = 0 且分数 >= 85 时颁发。 ## 输出 在后续步骤中使用扫描结果: ``` - run: echo "Score: ${{ steps.vibesafe.outputs.score }}" ``` | 输出 | 描述 | 示例 | |--------|-------------|---------| | `score` | 安全评分 (0-100) | `82` | | `grade` | 等级 (A-F) | `B` | | `domain` | 检测到的领域 | `fintech` | | `certified` | 已颁发 Certified 徽章 | `true` | | `critical` | 严重数量 | `0` | | `high` | 高危数量 | `2` | | `medium` | 中危数量 | `5` | | `low` | 低危数量 | `3` | | `total` | 总发现数 | `10` | ## 阻止合并 **默认情况下,当发现严重漏洞时,VibeSafe 会使检查失败 (exit 1)。** GitHub 分支保护将自动阻止合并。 ``` - uses: vibesafeio/vibesafe-action@v0 with: domain: auto fail-on: high # Block on high or critical (default: critical) # fail-on: none # Never block, comment only ``` | `fail-on` | 阻止合并条件 | |-----------|-------------------| | `critical` (默认) | Critical >= 1 | | `high` | High >= 1 或 Critical >= 1 | | `medium` | Medium >= 1 或更高 | | `low` | 任何发现 | | `none` | 从不(仅评论) | 启用方法:`Settings → Branches → Branch protection rules → Require status checks` → 添加 **`Security Scan`** ## Pre-commit 钩子(可选) 在硬编码的 API key 或令牌进入 git 历史之前,在本地捕获它们: ``` cp tools/pre_commit_hook.py .git/hooks/pre-commit chmod +x .git/hooks/pre-commit ``` 阻止包含硬编码 API key 或令牌的提交。如果安装了 Semgrep,SAST 也会运行。 强制提交:`git commit --no-verify` ## MCP 服务器 — 实时 IDE 安全(可选) 在 Claude Code 或 Cursor 中编码时实时检测机密。 **Claude Code:** ``` claude mcp add vibesafe -- python /path/to/vibesafe/tools/mcp_server.py ``` **Cursor** (`.cursor/mcp.json`): ``` { "mcpServers": { "vibesafe": { "command": "python", "args": ["/path/to/vibesafe/tools/mcp_server.py"] } } } ``` 工具:`vibesafe_check_secret`(文本扫描)和 `vibesafe_scan_file`(带修复建议的文件扫描)。 ## 常见问题 **我的代码会离开我的环境吗?** 不会。所有扫描都在 GitHub Actions runner 内部运行。没有代码被发送到 VibeSafe 服务器。 **费用是多少?** 免费。仅消耗 GitHub Actions 分钟数(每次扫描约 20 秒)。公开仓库有无限的免费分钟数。 **支持哪些语言?** Semgrep 支持的所有语言 —— JavaScript/TypeScript, Python, Java, Go, Ruby, PHP, Kotlin 等。 由 [VibeSafe](https://vibesafe.dev) 提供支持 · 基于 [Semgrep](https://semgrep.dev) 构建
标签:AI 代码生成, CI/CD 安全, Cursor, DevSecOps, GitHub Actions, RLS 检测, SAST, SQL 注入检测, Supabase 安全, Vibe Coding, 上游代理, 代码安全, 加密, 安全合规, 开源安全工具, 拉取请求检查, 数据投毒防御, 漏洞扫描器, 漏洞枚举, 盲注攻击, 硬编码密钥, 秘密检测, 网络代理, 自动化安全扫描, 自动笔记, 逆向工具, 逆向工程平台