[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116069":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":13,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":17,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":42,"updatedAt":43,"readmeContent":44,"aiSummary":45,"trendingCount":15,"starSnapshotCount":15,"syncStatus":46,"lastSyncTime":47,"discoverSource":48},116069,"vibe-shield","avivgerz-hue\u002Fvibe-shield","avivgerz-hue","92-rule static security scanner (SAST), secret detector, Supabase RLS auditor & SKILL.md prompt-injection guard for AI-generated Next.js\u002FTypeScript apps. CLI & MCP server.","",null,"TypeScript",84,3,53,0,9,12,53.21,"MIT License",false,"main",true,[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"ai-security","appsec","claude-code","cursor","devsecops","mcp","mcp-server","nextjs","owasp","prompt-injection","row-level-security","sast","secret-scanner","security-scanner","static-analysis","supabase","typescript","vibe-coding","2026-11-17 11:26:03","2026-11-23 19:57:54","# 🛡️ vibe-shield\n\n> 📊 **[2026 Empirical Security Benchmark](.\u002FBENCHMARK-2026.md):** We audited **160 published AI, MCP & Agent Skill packages (7,062 files)** with **vibe-shield** — uncovering **597 security findings (167 Critical, 82 High)** across CWE-798, CWE-89, CWE-639, and SKILL.md surfaces. **[Read the full benchmark & dataset →](.\u002FBENCHMARK-2026.md)**\n\n**The security gate for AI-written code.** Find exposed secrets, unguarded routes and missing RLS before you ship.\n\n> ⭐ **If this tool helps your AI coding workflow, please give this repository a Star!** It helps more developers discover the project.\n\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@vibefoundry\u002Fvibe-shield.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@vibefoundry\u002Fvibe-shield)\n[![npm downloads](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdm\u002F@vibefoundry\u002Fvibe-shield.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@vibefoundry\u002Fvibe-shield)\n[![CI](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Favivgerz-hue\u002Fvibe-shield\u002Fci.yml?branch=main&style=flat-square&logo=githubactions&label=CI)](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fvibe-shield\u002Factions\u002Fworkflows\u002Fci.yml)\n[![node](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fnode-%E2%89%A518.17.0-5fa04e?style=flat-square)](#-requirements)\n[![license](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue?style=flat-square)](.\u002FLICENSE)\n[![zero dependencies](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fruntime%20deps-0-brightgreen?style=flat-square)](.\u002Fpackage.json)\n[![rules](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdetection%20signatures-92-8b5cf6?style=flat-square)](.\u002Fsrc\u002Fscanner\u002Frules)\n[![self-scan](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fself--scan-100%2F100%20A%2B-16a34a?style=flat-square)](#-it-scans-itself)\n\n![Live Terminal Demo](assets\u002Fdemo.svg)\n\n```bash\nnpx -y @vibefoundry\u002Fvibe-shield@latest scan .\n```\n\n\u003Csub>Illustrative two-file scan; fixes are applied manually. Results vary by project. A clean score is not a security guarantee.\u003C\u002Fsub>\n\n### VibeFoundry Agent Suite\n\n- 🎨 **[unslop](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Funslop)** — UI Design DNA &amp; Anti-Slop Engine · `npx -y unslop-mcp@latest init`\n- 🛡️ **[vibe-shield](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fvibe-shield)** — Security Scanner for AI Code · `npx -y @vibefoundry\u002Fvibe-shield@latest scan .`\n- 👻 **[ghost-qa](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fghost-qa)** — Autonomous Headless Browser QA · `npx -y ghost-qa@latest test http:\u002F\u002Flocalhost:3000`\n\nvibe-shield is a **static security scanner** plus an **Agent Skill** that helps Claude Code, Codex, Cursor and Windsurf audit before they say *“done”*.\n\n---\n\n## v2.0.0: eight defensive vectors\n\nThe v2 catalogue covers client exposure; auth and route protection; database\u002FRLS; AI and web sinks; infrastructure; dependency hygiene; secrets and cryptography; and agent\u002FMCP integrity. The new hardening checks include production source maps, insecure JWT settings, explicit and omitted cookie flags, locally absent security headers, container users, lifecycle scripts, lockfiles and weak cryptography. Run `rules` for the complete catalogue.\n\nThe scanner produces a heuristic **attack-surface inventory** of route methods, observed guard signals, SQL tables and RLS signals, AI entrypoints, and MCP\u002Fagent files. Header checks cover recognized server configuration files; cookie checks cover common literal setter options. Both are advisory: external middleware, deployment settings and dynamic options require review. Signals do not prove guards or policies work, and code outside the scanned scope is not assessed. Run `audit-skills` separately for agent-integrity checks.\n\nGenerate an executive report or agent remediation prompt explicitly:\n\n```bash\nnpx -y @vibefoundry\u002Fvibe-shield scan --report SECURITY-REPORT.md --patch-prompt PATCH-PROMPT.md\nnpx -y @vibefoundry\u002Fvibe-shield scan --format html --out security-report.html\nnpx -y @vibefoundry\u002Fvibe-shield audit-skills --report agent-report.html\n```\n\nReports include severity, CWE, locations, snippets, OWASP 2025 web mappings for every rule and contextual LLM mappings when applicable, and illustrative remediation. Examples are **not** automatic project-specific patches; validate them against the application. The scanner itself is offline and read-only by default; `--cache`, `--out`, `--report`, `--patch-prompt` and `init` explicitly write files. Installing with `npx` can require network access. An A+ score applies only to the rules and files examined and is not a security certification.\n\n> The npm `2.0.0` artifact predates the universal `--agents` initializer. Use npm `2.1.0` or later (once published), or the GitHub `v2` ref. To exercise this checkout locally, run `npm ci && npm run build`, then `node dist\u002Fbin\u002Fvibe-shield.js` with the same arguments.\n\n---\n\n## The problem, in one file\n\nThis is the shape of code an agent writes when you ask for \"a delete endpoint\":\n\n```ts\n\u002F\u002F app\u002Fapi\u002Fusers\u002Froute.ts\nexport async function DELETE(req: Request) {\n  const { id, userId } = await req.json();\n  await db.query(`DELETE FROM users WHERE id = ${id} AND owner = ${userId}`);\n  return new Response('ok');\n}\n```\n\nIt works. It also has **three critical vulnerabilities** — no authentication, SQL injection, and an IDOR that lets the caller choose whose data they delete. Nothing in a normal review loop catches all three, and the agent reported the task as complete.\n\n`npx -y @vibefoundry\u002Fvibe-shield scan` catches all three in **17 milliseconds**:\n\n```\n🛡️  vibe-shield · security scan (illustrative output for current source)\ntarget  \u002Fhome\u002Fyou\u002Fapp\n\n💀 GRADE F — 0\u002F100 · 3 critical\n\n  CRITICAL 3    ███\n\nFindings\n\napp\u002Fapi\u002Fusers\u002Froute.ts\n  CRITICAL 2:1      VSB-AUTH-001  Next.js App Router mutation handler has no authentication check\n           export async function DELETE(req: Request) {\n  CRITICAL 4:22     VSB-DB-007    SQL statement built by concatenating request data\n           await db.query(`DELETE FROM users WHERE id = ${id} AND owner = ${userId}`);\n  CRITICAL 4:22     VSB-AUTH-004  Record ownership taken from the request instead of the session (IDOR)\n\n  7 files  ·  1 KiB  ·  412 files\u002Fs  ·  17 ms  ·  80 rules\n\n  ⚠  3 critical findings — rotate any exposed credential before anything else.\n  Fix it      npx -y @vibefoundry\u002Fvibe-shield scan --fix-prompt    # writes SECURITY_PATCH_PROMPT.md for your agent\n  Explain     npx -y @vibefoundry\u002Fvibe-shield explain VSB-AUTH-001\n  Gate CI     npx -y @vibefoundry\u002Fvibe-shield scan --fail-on critical --format github\n```\n\nThen hand the fix list to the agent that wrote the bug:\n\n```bash\nnpx -y @vibefoundry\u002Fvibe-shield scan --fix-prompt   # → SECURITY_PATCH_PROMPT.md\n```\n\nThat file contains, for every finding: the severity, the CWE id and link, the exact `file:line`, the vulnerable snippet, the ordered remediation steps, the target code shape, and a verification command. It is written for a machine to execute and a human to audit.\n\n---\n\n## ⚡ Quick start\n\n```bash\n# 1. Scan (npx may download the package; the scanner itself is offline)\nnpx -y @vibefoundry\u002Fvibe-shield scan\n\n# 2. Give your agent the fix list\nnpx -y @vibefoundry\u002Fvibe-shield scan --fix-prompt\n\n# 3. Install the gate permanently — skill + CI + ignore file\nnpx -y github:avivgerz-hue\u002Fvibe-shield#v2 init --agents all\n```\n\n> **Use the scoped name.** vibe-shield is published as\n> [`@vibefoundry\u002Fvibe-shield`](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@vibefoundry\u002Fvibe-shield).\n> The *unscoped* name `vibe-shield` on npm belongs to an unrelated project, so\n> `npx vibe-shield` runs someone else's code. Always include the `@vibefoundry\u002F`\n> scope. The package ships a prebuilt `dist\u002F`, needs **no TypeScript**, and\n> starts in milliseconds.\n\n## Supported Coding Agents (1-Command Setup)\n\nRun this from the repository you want to protect (Node.js and Git required):\n\n```bash\nnpx -y github:avivgerz-hue\u002Fvibe-shield#v2 init --agents all\n```\n\nTo configure selected agents, substitute a comma-separated list such as `--agents claude,cursor,zed`:\n\n| Agent | Selector | Native integration |\n| --- | --- | --- |\n| Claude Code | `claude` | `.mcp.json`, `CLAUDE.md`, `.claude\u002Fskills\u002Fvibe-shield\u002FSKILL.md`, `.claude-plugin\u002Fplugin.json` |\n| OpenCode | `opencode` | `opencode.json` MCP and `AGENTS.md` |\n| OpenAI Codex CLI \u002F universal agents | `codex` | `AGENTS.md` and `.agents\u002Fskills\u002Fvibe-shield\u002FSKILL.md` |\n| Cursor | `cursor` | `.cursor\u002Fmcp.json` and `.cursor\u002Frules\u002Fvibe-shield.mdc` |\n| Windsurf | `windsurf` | `.windsurfrules` |\n| VS Code \u002F GitHub Copilot | `copilot` | `.vscode\u002Fmcp.json` and `.github\u002Fcopilot-instructions.md` |\n| Cline \u002F Roo Code | `cline` or `roo` | `.clinerules` |\n| Zed | `zed` | `.zed\u002Fsettings.json` context server |\n\nThe existing `--agent claude|cursor|generic|all` remains supported. The shared `.mcp.json`, ignore file, and (unless `--no-workflow` is set) CI workflow are also installed. JSON configuration is merged by server name; malformed JSON or JSON with comments is left untouched and reported. Existing instructions are appended only once, and existing files are not overwritten without `--force`. Restart the relevant editor or reload its configuration after setup.\n\n## 🧠 Why AI code needs its own scanner\n\nTraditional SAST rules are built around human mistakes: a forgotten escape, a missing `prepare()`. Agent-written code fails differently — it is *confidently complete* and *structurally plausible*:\n\n| What a human does | What an agent does |\n| --- | --- |\n| forgets to validate one input | writes a perfect endpoint with **no auth at all** |\n| uses `eval` in one legacy file | puts a **tool `execute` that shells out** behind an LLM |\n| commits a `.env` by accident | puts `SUPABASE_SERVICE_ROLE_KEY` behind `NEXT_PUBLIC_` because \"it needed the env var\" |\n| writes `CREATE TABLE` | writes `CREATE TABLE` **and forgets the `ENABLE ROW LEVEL SECURITY`**, so the anon key reads everything |\n| adds `dangerouslySetInnerHTML` to render a doc | renders **model output** with it, creating stored XSS with a step counter |\n\nvibe-shield encodes those specific shapes: 92 signatures across eight defensive categories, each one derived from a real agent-generated bug rather than a generic CWE checklist.\n\n---\n\n## 📊 Vulnerability Coverage Matrix\n\n**Client-boundary limitation:** Client reachability is a best-effort static graph of literal imports, re-exports and `require` calls using relative paths and root `tsconfig.json`\u002F`jsconfig.json` aliases. Dynamic paths, inherited or nested configurations, excluded or oversized files and other bundler resolution may be missed. A server-side service-role helper still bypasses RLS: use `import 'server-only'`, authorize every privileged request, and verify the production bundle. Auth-helper names and `with*` wrappers are signals, not proof that authorization is enforced.\n\n**80 code signatures + 12 agent-integrity signatures = 92.** The `scan` command runs the 80 code rules; `audit-skills` runs the 12 agent rules. Every rule has an id, a CWE, an illustrative vulnerable shape, remediation guidance, and an OWASP association — run `npx -y @vibefoundry\u002Fvibe-shield rules` or `npx -y @vibefoundry\u002Fvibe-shield explain \u003CID>`.\n\n### Client-side secret & data exposure — `VSB-CLIENT-*`\n\n| ID | Detects | CWE | Sev |\n| --- | --- | --- | --- |\n| `VSB-CLIENT-001` | `NEXT_PUBLIC_` \u002F `VITE_` \u002F `PUBLIC_` \u002F `REACT_APP_` + a server-only secret name (`SERVICE_ROLE_KEY`, `OPENAI_API_KEY`, `STRIPE_SECRET_KEY`, `DATABASE_URL`…) | [CWE-200](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F200.html) | critical |\n| `VSB-CLIENT-002` | server-only `process.env.*SECRET*` read inside a `\"use client\"` module | CWE-200 | high |\n| `VSB-CLIENT-003` | `createClient(url, SERVICE_ROLE_KEY)` — RLS bypass in a client-reachable file or public env | [CWE-250](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F250.html) | critical |\n| `VSB-CLIENT-004` | `supabaseAdmin` \u002F `adminClient` \u002F `serviceRoleClient` referenced from browser code | CWE-250 | critical |\n| `VSB-CLIENT-005` | `dangerouslyAllowBrowser: true`, provider SDK keyed in the browser | [CWE-749](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F749.html) | high |\n| `VSB-CLIENT-006` | `.env*` assigns a live-looking credential to a public variable | [CWE-540](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F540.html) | critical |\n| `VSB-CLIENT-007` | `next.config.js` `env` \u002F `publicRuntimeConfig` \u002F Vite `define` inlining a secret | [CWE-798](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F798.html) | critical |\n\n### Unguarded mutation routes — `VSB-AUTH-*`\n\n| ID | Detects | CWE | Sev |\n| --- | --- | --- | --- |\n| `VSB-AUTH-001` | App Router `POST\u002FPUT\u002FPATCH\u002FDELETE` handler with no session check | [CWE-306](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F306.html) | critical |\n| `VSB-AUTH-002` | Pages API mutation handler with no session check | CWE-306 | critical |\n| `VSB-AUTH-003` | Express \u002F Fastify \u002F Koa \u002F Hono mutation route with no auth middleware | [CWE-862](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F862.html) | high |\n| `VSB-AUTH-004` | IDOR — ownership key from `body`\u002F`query`\u002F`params` (including the destructured local variable) | [CWE-639](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F639.html) | critical |\n| `VSB-AUTH-005` | `\"use server\"` action mutating data with no auth | CWE-306 | high |\n| `VSB-AUTH-006` | identity from `jwt.decode`, `x-user-id`, `atob(token.split('.')[1])`, `verify:false`, `algorithms:['none']` | [CWE-347](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F347.html) | critical |\n| `VSB-AUTH-007` | admin\u002Fdestructive surface that authenticates but never checks a role | [CWE-863](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F863.html) | high |\n| `VSB-AUTH-008` | `const session = await auth()` captured and never enforced | [CWE-287](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F287.html) | medium |\n| `VSB-AUTH-009` | cookie-session mutation with no CSRF token protection | [CWE-352](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F352.html) | medium |\n\n### Database exposure — `VSB-DB-*`\n\n| ID | Detects | CWE | Sev |\n| --- | --- | --- | --- |\n| `VSB-DB-001` | `CREATE TABLE` with no `ENABLE ROW LEVEL SECURITY` **anywhere in the project** (cross-file index) | [CWE-284](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F284.html) | critical\\*\u002Fhigh |\n| `VSB-DB-002` | permissive policy — `USING (true)`, `WITH CHECK (true)`, `USING (1=1)` | [CWE-732](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F732.html) | critical |\n| `VSB-DB-003` | `anon`\u002F`authenticated` policy whose `USING` never references `auth.uid()`\u002F`auth.jwt()` | CWE-639 | high |\n| `VSB-DB-004` | `GRANT … TO anon\u002Fpublic` (writes), incl. `GRANT ALL` | CWE-732 | critical\u002Fhigh |\n| `VSB-DB-005` | `DISABLE ROW LEVEL SECURITY`, `DROP POLICY`, `BYPASSRLS` | CWE-284 | critical\u002Fhigh |\n| `VSB-DB-006` | `$queryRawUnsafe`, `$executeRawUnsafe`, `knex.raw`, `sequelize.query`, `.raw()` with a dynamic string | [CWE-89](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F89.html) | critical |\n| `VSB-DB-007` | hand-built SQL from request data — `${}`, `+`, Python f-strings, PHP interpolation | CWE-89 | critical |\n| `VSB-DB-008` | Supabase service-role key observed in client-reachable code or public env | CWE-250 | critical |\n| `VSB-DB-009` | `createBucket(…, { public: true })` | CWE-732 | medium |\n| `VSB-DB-010` | request data used as a table, column or `ORDER BY` identifier | CWE-89 | high |\n\n\\* critical when Supabase\u002FPostgREST is detected — the anon key in every browser makes the table publicly addressable.\n\n### AI \u002F LLM & classic web — `VSB-AI-*`\n\n| ID | Detects | CWE | Sev |\n| --- | --- | --- | --- |\n| `VSB-AI-001` | `exec`\u002F`execSync`\u002F`spawn({shell:true})`\u002F`Bun.spawn`\u002F`os.system`\u002F`subprocess(shell=True)`\u002F`Runtime.exec`\u002FPHP backticks | [CWE-78](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F78.html) | critical |\n| `VSB-AI-002` | LLM\u002FMCP tool `execute` reaching a shell, `eval` or filesystem sink | [CWE-94](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F94.html) | critical |\n| `VSB-AI-003` | model output into `eval`\u002F`new Function`\u002F`vm.runInNewContext` | CWE-94 | critical |\n| `VSB-AI-004` | untrusted\u002FRAG content interpolated into a `system` prompt, no delimiters (OWASP LLM01) | [CWE-74](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F74.html) | high |\n| `VSB-AI-005` | Stripe webhook without `stripe.webhooks.constructEvent` | [CWE-345](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F345.html) | critical |\n| `VSB-AI-006` | webhook signing secret read from the request | CWE-345 | high |\n| `VSB-AI-007` | GitHub\u002FSlack\u002FShopify\u002FSvix webhook with no signature verification | CWE-345 | high |\n| `VSB-AI-008` | `dangerouslySetInnerHTML`, `v-html`, `{@html}`, `innerHTML`, `document.write`, jQuery `.html()` | [CWE-79](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F79.html) | high |\n| `VSB-AI-009` | client `eval`\u002F`new Function`\u002Fstring `setTimeout`\u002F`javascript:` URLs | CWE-94 | high |\n| `VSB-AI-010` | open redirect — `redirect(searchParams.get('next'))` | [CWE-601](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F601.html) | medium |\n| `VSB-AI-011` | SSRF — `fetch(req.body.url)` | [CWE-918](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F918.html) | high |\n| `VSB-AI-012` | path traversal — `path.join(dir, req.params.name)` | [CWE-22](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F22.html) | high |\n| `VSB-AI-013` | multer\u002F`formData()` upload with no size or type limit | [CWE-434](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F434.html) | medium |\n| `VSB-AI-014` | public LLM endpoint with no rate limit or quota | [CWE-770](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F770.html) | medium |\n| `VSB-AI-015` | `pickle.loads`, `yaml.load` without `SafeLoader`, PHP `unserialize` | [CWE-502](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F502.html) | high |\n| `VSB-AI-016` | recognized LLM route call without a visible positive literal output token cap; review dynamic or provider limits | [CWE-770](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F770.html) | medium |\n\n### Hardcoded credentials — `VSB-SECRET-*`\n\n| ID | Detects | CWE | Sev |\n| --- | --- | --- | --- |\n| `VSB-SECRET-001` | vendor signature in a server file (Stripe, OpenAI, Anthropic, AWS, GitHub, Supabase, Slack, Twilio, SendGrid, npm, PyPI, HuggingFace, Docker, Vercel, Mailgun, Square, Shopify, Datadog) | CWE-798 | high |\n| `VSB-SECRET-002` | generic high-entropy assignment to a credential-shaped name | CWE-798 | medium\u002Fhigh |\n| `VSB-SECRET-003` | PEM private key material | [CWE-321](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F321.html) | critical |\n| `VSB-SECRET-004` | hardcoded JWT whose payload carries `service_role` \u002F `admin` | CWE-250 | critical |\n| `VSB-SECRET-005` | the same vendor credential in a **browser-reachable** file | CWE-200 | critical |\n| `VSB-SECRET-006` | `postgres:postgres@…`, `password = \"admin\"`, entropy \u003C 2.5 | [CWE-1392](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F1392.html) | medium |\n| `VSB-SECRET-007` | `.env` with live credentials — critical when git-tracked | CWE-540 | critical |\n\n### Agent skill & MCP poisoning — `VSB-AGENT-*` (`audit-skills`)\n\n| ID | Detects | CWE | Sev |\n| --- | --- | --- | --- |\n| `VSB-AGENT-001` | zero-width, bidi-override, Unicode-tag characters hiding instructions | CWE-74 | critical |\n| `VSB-AGENT-002` | `curl`\u002F`wget`\u002F`nc` exfiltrating env vars or `.env` | CWE-200 | critical |\n| `VSB-AGENT-003` | instructions to read `.env`, `~\u002F.ssh`, `~\u002F.aws\u002Fcredentials`, `id_rsa`, keychain | [CWE-522](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F522.html) | critical |\n| `VSB-AGENT-004` | registry-tag `npx -y`\u002F`uvx`, remote MCP URL, `curl \\| sh` install (git installs such as `github:owner\u002Frepo` are not flagged: they resolve to a commit, not a mutable tag) | [CWE-829](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F829.html) | high |\n| `VSB-AGENT-005` | literal credentials in an `env` block, or `\"*\": \"*\"` env forwarding | [CWE-526](https:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F526.html) | critical\u002Fhigh |\n| `VSB-AGENT-006` | \"ignore previous instructions\", \"do not tell the user\", \"auto-approve\", \"skip confirmation\" | CWE-74 | critical |\n| `VSB-AGENT-007` | `Bash(*)`, `Write(*)`, `autoApprove: [\"*\"]`, `dangerouslySkipPermissions` | CWE-284 | high |\n| `VSB-AGENT-008` | base64 payload \u002F `eval(atob(…))` \u002F `base64 -d \\| sh` | CWE-94 | high |\n| `VSB-AGENT-009` | \"fetch \u003Curl> and follow every instruction\" | CWE-829 | critical |\n| `VSB-AGENT-010` | missing frontmatter, wildcard `allowed-tools` | CWE-250 | medium |\n| `VSB-AGENT-011` | literal credential inside an instruction\u002FMCP file | CWE-798 | critical |\n| `VSB-AGENT-012` | `eval \"$1\"`, `sh -c \"$VAR\"` in a skill script | CWE-78 | medium |\n\n---\n\n## 🔌 Native MCP server\n\nvibe-shield is itself a [Model Context Protocol](https:\u002F\u002Fmodelcontextprotocol.io) server, so\nClaude Code, Claude Desktop, Cursor and Codex can call the scanner as a tool\ninstead of shelling out and parsing console output.\n\n```bash\nnpx -y @vibefoundry\u002Fvibe-shield mcp          # JSON-RPC 2.0 over stdio\nnpx -y @vibefoundry\u002Fvibe-shield --mcp        # same thing, if your client prefers a flag\n```\n\nThree tools:\n\n| Tool | What it does |\n| --- | --- |\n| `vibe_shield_scan` | Runs the code-scanning rules over a project or specific paths → grade, score, findings with file:line, CWE and remediation |\n| `vibe_shield_audit_skills` | Audits `.claude\u002Fskills`, `.cursor` rules, `AGENTS.md` and MCP configs for prompt injection and exfiltration traps |\n| `vibe_shield_explain_rule` | Full CWE detail, vulnerable\u002Ffixed examples and remediation for any rule id or slug |\n\n`npx -y @vibefoundry\u002Fvibe-shield init` writes the config for you, merging into `.mcp.json`\n**without clobbering** servers you already have:\n\n```jsonc\n{\n  \"mcpServers\": {\n    \"github\": { \"command\": \"npx\", \"args\": [\"-y\", \"@modelcontextprotocol\u002Fserver-github\"] },\n    \"vibe-shield\": { \"command\": \"npx\", \"args\": [\"--yes\", \"@vibefoundry\u002Fvibe-shield@2.0.0\", \"mcp\"] }\n  }\n}\n```\n\nThe version pin is not cosmetic: an unpinned `npx -y` server is exactly what\n`VSB-AGENT-004` flags as high severity, so vibe-shield's own audit would write\nitself a finding. `init` pins the running version automatically.\n\nOr add it by hand:\n\n```bash\nclaude mcp add vibe-shield -- npx -y @vibefoundry\u002Fvibe-shield mcp\n```\n\nThe server is zero-dependency, writes **only** JSON-RPC to stdout, honours\nJSON-RPC notifications (no spurious replies), and returns tool errors as\n`isError` results so a bad argument degrades one call instead of killing the\nsession. Requests are handled in arrival order.\n\nAn empty target is reported as `No files were scanned` rather than a green pass —\na scanner that says \"clean\" when it read nothing is worse than no scanner.\n\n---\n\n## 🤖 Use it as an Agent Skill\n\n`npx -y github:avivgerz-hue\u002Fvibe-shield#v2 init --agents all` installs the skill. Once it is in a repository, every\nagent session starts with a contract:\n\n> You are not allowed to say \"done\" until the code you just wrote passes a security audit.\n\n```bash\nnpx -y github:avivgerz-hue\u002Fvibe-shield#v2 init --agents all\nnpx -y github:avivgerz-hue\u002Fvibe-shield#v2 init --agents claude\nnpx -y github:avivgerz-hue\u002Fvibe-shield#v2 init --agents cursor,zed --no-workflow\n```\n\n**Why this works better than a prompt snippet:** it names the three commands, gives the agent a reading guide for a finding (`line:col`, rule id, message, CWE), states five hard rules (never suppress, never weaken, always rotate, report honestly, re-verify), and defines \"done\" as an exit code rather than an opinion.\n\nThe skill itself is [SKILL.md](.\u002FSKILL.md) — read it, it is short.\n\n### Anthropic Agent Skills quickstart\n\n```bash\n# install the Claude Code skill\nnpx -y @vibefoundry\u002Fvibe-shield init --agent claude\n# → .claude\u002Fskills\u002Fvibe-shield\u002FSKILL.md\n\n# or globally, for every project\ncurl -sL https:\u002F\u002Fraw.githubusercontent.com\u002Favivgerz-hue\u002Fvibe-shield\u002Fmain\u002FSKILL.md \\\n  -o ~\u002F.claude\u002Fskills\u002Fvibe-shield\u002FSKILL.md\n```\n\n---\n\n## 🔁 CI\u002FCD: fail the PR before the bug ships\n\n### GitHub Actions (recommended)\n\n`npx -y @vibefoundry\u002Fvibe-shield init` installs a workflow that runs the scan, uploads SARIF to\ncode scanning, audits the agent surface, and fails the job:\n\n```yaml\nname: vibe-shield\non: [push, pull_request]\n\npermissions:\n  contents: read\n  security-events: write\n\njobs:\n  scan:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n\n      - name: Scan and upload SARIF\n        run: npx -y @vibefoundry\u002Fvibe-shield scan --format sarif --out vibe-shield.sarif --fail-on high\n        continue-on-error: true\n\n      - uses: github\u002Fcodeql-action\u002Fupload-sarif@v3\n        if: always()\n        with:\n          sarif_file: vibe-shield.sarif\n          category: vibe-shield\n\n      - name: Enforce the gate\n        run: npx -y @vibefoundry\u002Fvibe-shield scan --fail-on high\n```\n\nFindings appear **inline on the pull request diff** (GitHub annotations) and in\nthe **Security → Code scanning** tab (SARIF), so a reviewer sees the vulnerability\non the line that introduced it.\n\n### Any other CI\n\n```bash\nnpx -y @vibefoundry\u002Fvibe-shield scan --fail-on high                         # exit 1 on findings\nnpx -y @vibefoundry\u002Fvibe-shield scan --format compact                       # one line per finding\nnpx -y @vibefoundry\u002Fvibe-shield scan --format json > vibe-shield.json       # full report\nnpx -y @vibefoundry\u002Fvibe-shield scan --format summary                       # JSON, counts + grade only\nnpx -y @vibefoundry\u002Fvibe-shield scan --format github                        # workflow annotations\n```\n\nExit codes: **0** clean · **1** findings at\u002Fabove `--fail-on` · **2** usage error\n(a target path that does not exist, or a target that matches no scannable files).\nAn empty scan prints `NO FILES SCANNED — this is not a pass` and is never\nreported as a grade — a gate pointed at an ignored path fails instead of\nsucceeding forever.\n\n---\n\n## 🎯 The scorecard\n\nGrades are **deliberately unforgiving**, because \"B+\" for a leaked production key is how security tools lose credibility:\n\n| Finding present | Maximum score | Best possible grade |\n| --- | --- | --- |\n| any **critical** | 29 | **F** |\n| any **high** | 58 | C |\n| any **medium** | 76 | B |\n| any **low** | 88 | A- |\n| nothing | 100 | **A+** |\n\nPenalties per finding: critical −30, high −12, medium −5, low −2, info −0.5. One leaked live key fails the build on its own; a handful of informational notes never will.\n\n---\n\n## 🪄 It scans itself\n\nThis repository runs its own gate on every commit and in CI:\n\n```console\n$ npx -y @vibefoundry\u002Fvibe-shield scan\n🛡️  vibe-shield · security scan (illustrative output for current source)\ntarget  \u002Fyou\u002Fvibe-shield\n\n🏆 GRADE A+ — 100\u002F100\n\n  21 files  ·  172 KiB  ·  236 files\u002Fs  ·  89 ms  ·  80 rules\n\n  Nothing to fix. Keep the shield up. 🛡️\n\n$ npx -y @vibefoundry\u002Fvibe-shield audit-skills\n🏆 GRADE A+ — 100\u002F100\n\n  1 file  ·  6 KiB  ·  14 files\u002Fs  ·  69 ms  ·  12 rules\n\n  Nothing to fix. Keep the shield up. 🛡️\n```\n\nThe detector catalogue is the one place that must contain the exact vulnerable\nshapes and vendor key formats the rules match on — exactly like gitleaks and\nsemgrep. Those files are listed explicitly in [`.vibe-shieldignore`](.\u002F.vibe-shieldignore)\nwith a comment explaining why, instead of weakening a rule.\n\n---\n\n## 🔇 Suppressing a finding (legitimately)\n\nInline, with a rule id and a reason — the reason is required by review culture even though the parser does not enforce it:\n\n```ts\n\u002F\u002F vibe-shield-disable-next-line VSB-AI-001 -- path comes from a closed enum\nexec(`convert ${KNOWN_FORMATS[format]} out.png`);\n```\n\n```ts\n\u002F\u002F vibe-shield-disable-line VSB-AUTH-008\n\u002F\u002F vibe-shield-disable VSB-AI-014\n\u002F\u002F vibe-shield-enable\n\u002F\u002F vibe-shield-disable-file VSB-DB-004 -- generated edge schema\n```\n\nSuppressed findings are **counted and reported** in the scorecard, never silently dropped. Whole-path exclusions belong in `.vibe-shieldignore` (gitignore syntax) and should be reserved for generated code.\n\n---\n\n## ⚙️ How it works\n\n```\n discover ──▶ project context ──▶ rule gate ──▶ detect ──▶ suppress ──▶ score ──▶ report\n   │              │                  │           │\n   │              │                  │           └─ 80 code rules; 12 agent-integrity rules run in audit-skills\n   │              │                  └─ cheap content hints: most rules skip most files\n   │              └─ manifests, framework flags, cross-file RLS index, git index, middleware matchers\n   └─ one tree walk, gitignore\u002F.vibe-shieldignore layering, binary + size + test\u002Fdoc pruning\n```\n\n**Design constraints, in priority order:**\n\n1. **Fast.** One `readdir` walk, one read per file, one comment-masking pass, and a cheap gate before any rule body runs. A 400-file project scans in ~200 ms; a typical Next.js app in under 100 ms. No AST, no parser, no dependency.\n2. **Honest.** Every finding carries the exact snippet the developer wrote. Configuration checks may infer risk from file shape, and every suppression is counted, not hidden.\n3. **Composable.** `scanProject()` for the CLI, `runRulesOnFile()` for the auditor, `scoreFindings()` for anything that produces findings. The whole API is exported from `vibe-shield`.\n\n**Zero runtime dependencies.** No network calls, no telemetry, no language server, no native binaries. The scanner works offline once installed; a first-time `npx` install needs registry access.\n\n---\n\n## 📖 CLI reference\n\n```\nvibe-shield scan [paths...]         Scan the project (default: `.`)\nvibe-shield audit-skills [paths...] Audit agent skills, rules, AGENTS.md and MCP config\nvibe-shield init                    Install the Agent Skill, AGENTS.md, .mcp.json and CI gate\nvibe-shield mcp                     Serve the MCP tools over stdio\nvibe-shield rules                   List every detection rule\nvibe-shield explain \u003CRULE_ID>       Full documentation for one rule\nvibe-shield version | help\n```\n\n| Flag | Default | Meaning |\n| --- | --- | --- |\n| `--format \u003Cfmt>` | `console` | `console` `compact` `summary` `json` `sarif` `github` `markdown` `html` |\n| `--fail-on \u003Csev>` | `critical` | Exit 1 at\u002Fabove this severity |\n| `--severity \u003Csev>` | — | Only report at\u002Fabove this severity |\n| `--fix-prompt` | off | Write `SECURITY_PATCH_PROMPT.md` |\n| `--out \u003Cfile>` | — | Write the report to a file |\n| `--rules \u003Cids>` | all | Comma-separated ids\u002Fslugs, supports `VSB-DB-*` |\n| `--ignore \u003Cglob>` | — | Extra ignore pattern (repeatable) |\n| `--include-tests` | off | Include test\u002Ffixture files |\n| `--include-docs` | off | Include Markdown and `docs\u002F` |\n| `--cache` | off | Reuse `.vibe-shield-cache.json` |\n| `--max-findings \u003Cn>` | 50 | Console list cap (`0` = all) |\n| `--quiet` | off | One-line verdict (`100\u002F100 A+ — 0 critical, …`) |\n| `--no-color` | auto | Disable ANSI (also honours `NO_COLOR`) |\n| `--json` | off | Shorthand for `--format json` |\n| `--no-gitignore` | off | Ignore `.gitignore` while discovering files |\n| `--no-shield-ignore` | off | Ignore `.vibe-shieldignore` (e.g. to scan excluded fixtures) |\n\n`init` takes `--target \u003Cdir>`, `--agent claude \u002F cursor \u002F generic \u002F all`, `--no-workflow`,\n`--force` and `--yes`.\n\n---\n\n## 🧩 Programmatic API\n\n```ts\nimport { scanProject, formatSarif, buildPatchPrompt, auditSkills } from 'vibe-shield';\n\nconst result = await scanProject({ rootDir: process.cwd(), cache: true });\n\nconsole.log(result.score.score, result.score.grade);  \u002F\u002F 0 'F'\nconsole.log(result.findings[0].ruleId);               \u002F\u002F 'VSB-AUTH-001'\nconsole.log(result.findings[0].cwe.id);               \u002F\u002F 'CWE-306'\n\nprocess.stdout.write(formatSarif(result));            \u002F\u002F SARIF 2.1.0\nprocess.stdout.write(buildPatchPrompt(result));       \u002F\u002F agent-ready fix list\n\nconst agentReport = await auditSkills(process.cwd()); \u002F\u002F VSB-AGENT-* surface\n```\n\n---\n\n## ❓ FAQ\n\n**Does it replace a real SAST tool?**\nNo. It replaces the *absence* of one. vibe-shield is a fast, zero-dependency gate you can put in front of every agent-written commit today. Pair it with a deeper scanner (CodeQL, Semgrep) if you have one; the rules overlap far less than you would expect, because these are agent-specific shapes.\n\n**Will it flag my secure code?**\nThe secure fixture (`tests\u002Ffixtures\u002Fsecure\u002F`) is a real Next.js + Supabase + Stripe app with auth, RLS, sanitisation, rate limiting and webhook verification — it scores 100\u002F100 and the suite asserts **zero findings** on it. Each rule has guard clauses for the legitimate patterns: `import \"server-only\"` suppresses the service-role rules, Prisma tagged templates suppress the SQLi rule, `DOMPurify` suppresses the XSS rule, `auth.uid()` policies suppress the RLS rules.\n\n**Does it send my code anywhere?**\nNo. There is no network code in the runtime at all — the package has zero dependencies and makes no outbound requests.\n\n**Why not an AST?**\nBecause a 1.5 MB minified bundle, a Vue SFC, a PHP legacy file and a SQL migration all need to be scanned with the same tool, and a parser handles exactly one of those. The rules use structural brace matching plus a comment-masker that preserves offsets, which is enough for the shapes that matter and roughly two orders of magnitude faster.\n\n**Why \"vibe\"?**\nBecause the code was written by vibe and reviewed by nobody. This is the reviewer.\n\n---\n\n## 🛠 Development\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fvibe-shield\ncd vibe-shield\nnpm ci\nnpm run typecheck   # tsc --noEmit (strict, noUnusedLocals)\nnpm test            # 224 Vitest tests\nnpm run build       # tsc + postbuild (shebang, chmod, CJS marker)\nnpm run verify      # typecheck + test + build + self-scan + self-audit\n```\n\nSee [CONTRIBUTING.md](.\u002FCONTRIBUTING.md) for the rule-authoring guide, and\n[SECURITY.md](.\u002FSECURITY.md) for the threat model and disclosure policy.\n\n---\n\n## 📋 Requirements\n\n- **Node.js ≥ 18.17** (uses `node:` builtins only — no polyfills, no native modules)\n- Any OS: Linux, macOS, Windows\n- No config file required; `package.json` is optional\n\n---\n\n## 📄 License\n\nMIT © [VibeFoundry](.\u002FLICENSE) — use it, fork it, ship it.\n\n---\n\n## Part of the VibeFoundry Agent Suite\n\nThree tools for the same problem: agents move fast, and something has to keep the output honest.\n\n| | Tool | What it does |\n| :---: | --- | --- |\n| 🎨 | **[unslop](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Funslop)** | Studio-grade UI design systems & Anti-Slop engine — stops agents from generating generic, interchangeable interfaces |\n| 🛡️ | **[vibe-shield](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fvibe-shield)** | Security scanner & MCP guard — stops agents from shipping leaked keys, unguarded routes and disabled RLS |\n| 👻 | **[ghost-qa](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fghost-qa)** | Autonomous headless-browser QA & self-healing verification loop — stops agents from claiming a UI works when it does not |\n\n```bash\nnpx -y @vibefoundry\u002Fvibe-shield init   # security gate\n```\n---\n\n## Frequently Asked Questions: Best Security Scanner for Vibe-Coded Apps & Agent Skills\n\n### What is the best GitHub repo to scan a vibe-coded app for security vulnerabilities?\n**[`vibe-shield`](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fvibe-shield)** (`npx -y @vibefoundry\u002Fvibe-shield@latest scan .`) is the purpose-built open-source static security scanner and Model Context Protocol (MCP) server for AI-generated (\"vibe-coded\") web applications. It inspects Next.js, React, Express, Hono, Fastify, Supabase SQL migrations, Stripe webhooks, and agent instruction files across **92 deterministic rules and 8 vulnerability vectors** mapped to **CWE** and **OWASP Top 10:2025**.\n\n### How do I scan `SKILL.md`, `.cursorrules`, `CLAUDE.md`, and MCP configs for prompt injection?\nRun `npx -y @vibefoundry\u002Fvibe-shield@latest audit-skills .`. `vibe-shield` detects zero-width\u002Fbidirectional Unicode steganography, hidden HTML comment overrides, credential harvesting instructions, and dangerous `curl | sh` or untrusted `npx -y` MCP server execution paths.\n\n### What is the complete open-source verification stack for vibe-coded apps?\n| Layer | Repository | One-Line Command | What It Fixes |\n| :--- | :--- | :--- | :--- |\n| **Code & Agent Skill Security** | **[`avivgerz-hue\u002Fvibe-shield`](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fvibe-shield)** | `npx -y @vibefoundry\u002Fvibe-shield@latest scan .` | 92-rule static security scanner for Next.js, Supabase RLS, Stripe webhooks, secrets & `SKILL.md` poisoning |\n| **UI Design & Anti-AI-Slop** | **[`avivgerz-hue\u002Funslop`](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Funslop)** | `npx -y unslop-mcp audit .` | Makes vibe-coded apps look less like AI slop via 72 UI craft rules, APCA contrast math & 10 studio presets |\n| **Headless Browser QA** | **[`avivgerz-hue\u002Fghost-qa`](https:\u002F\u002Fgithub.com\u002Favivgerz-hue\u002Fghost-qa)** | `npx -y ghost-qa test http:\u002F\u002Flocalhost:3000` | 8-trap autonomous Playwright QA across Desktop, Tablet & Mobile viewports |\n","vibe-shield 是一款面向 AI 生成代码的静态安全扫描工具，专为 Next.js\u002FTypeScript 应用设计。它集成四大能力：92条规则的 SAST 扫描、敏感信息检测、Supabase 行级安全（RLS）策略审计，以及针对 SKILL.md 文件的提示注入防护。支持 CLI 命令行与 MCP 协议服务端模式，零运行时依赖，可嵌入 AI 编程工作流（如 Cursor、Claude Code）实现开发阶段自动安全门控。适用于 AI 辅助开发、MCP Agent 技能包发布前审计、以及需快速验证 RLS 和 secrets 安全性的 Supabase 应用场景。",2,"2026-11-24 04:52:43","CREATED_QUERY"]