
vibe-shield — security scanner for AI-generated code
io.github.avivgerz-huePublished by GitHub account avivgerz-huev2.1.2Updated Nov 11, 2026
Scans AI-written code for leaked secrets, unguarded routes and missing RLS.
Overview
vibe-shield — security scanner for AI-generated code's local MCP server; no sign-in required; STDIO.
No AI overview yet: these facts come from the registry entry and the server itself.
Installation
In SourceWeft
- Open vibe-shield — security scanner for AI-generated code in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
🛡️ vibe-shield
The security gate for AI-written code. Find exposed secrets, unguarded routes and missing RLS before you ship.
⭐ If this tool helps your AI coding workflow, please give this repository a Star! It helps more developers discover the project.
[npm version] [npm downloads] [CI] [node] [license] [zero dependencies] [rules] [self-scan]
Illustrative two-file scan; fixes are applied manually. Results vary by project. A clean score is not a security guarantee.
VibeFoundry Agent Suite
- 🎨 unslop — UI Design DNA & Anti-Slop Engine ·
npx -y unslop-mcp@latest init - 🛡️ vibe-shield — Security Scanner for AI Code ·
npx -y @vibefoundry/vibe-shield@latest scan . - 👻 ghost-qa — Autonomous Headless Browser QA ·
npx -y ghost-qa@latest test http://localhost:3000
vibe-shield is a static security scanner plus an Agent Skill that helps Claude Code, Codex, Cursor and Windsurf audit before they say “done”.
v2.0.0: eight defensive vectors
The v2 catalogue covers client exposure; auth and route protection; database/RLS; AI and web sinks; infrastructure; dependency hygiene; secrets and cryptography; and agent/MCP 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.
The scanner produces a heuristic attack-surface inventory of route methods, observed guard signals, SQL tables and RLS signals, AI entrypoints, and MCP/agent 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.
Generate an executive report or agent remediation prompt explicitly:
Reports 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.
The npm
2.0.0artifact predates the universal--agentsinitializer. Use npm2.1.0or later (once published), or the GitHubv2ref. To exercise this checkout locally, runnpm ci && npm run build, thennode dist/bin/vibe-shield.jswith the same arguments.
The problem, in one file
This is the shape of code an agent writes when you ask for "a delete endpoint":
It 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.
npx -y @vibefoundry/vibe-shield scan catches all three in 17 milliseconds:
Then hand the fix list to the agent that wrote the bug:
That 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.
⚡ Quick start
Use the scoped name. vibe-shield is published as
@vibefoundry/vibe-shield. The unscoped namevibe-shieldon npm belongs to an unrelated project, sonpx vibe-shieldruns someone else's code. Always include the@vibefoundry/scope. The package ships a prebuiltdist/, needs no TypeScript, and starts in milliseconds.
Supported Coding Agents (1-Command Setup)
Run this from the repository you want to protect (Node.js and Git required):
To configure selected agents, substitute a comma-separated list such as --agents claude,cursor,zed:
The 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.
🧠 Why AI code needs its own scanner
Traditional 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:
vibe-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.
📊 Vulnerability Coverage Matrix
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/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.
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/vibe-shield rules or npx -y @vibefoundry/vibe-shield explain <ID>.
Client-side secret & data exposure — VSB-CLIENT-*
Unguarded mutation routes — VSB-AUTH-*
Database exposure — VSB-DB-*
* critical when Supabase/PostgREST is detected — the anon key in every browser makes the table publicly addressable.
AI / LLM & classic web — VSB-AI-*
Hardcoded credentials — VSB-SECRET-*
Agent skill & MCP poisoning — VSB-AGENT-* (audit-skills)
🔌 Native MCP server
vibe-shield is itself a Model Context Protocol server, so Claude Code, Claude Desktop, Cursor and Codex can call the scanner as a tool instead of shelling out and parsing console output.
Three tools:
npx -y @vibefoundry/vibe-shield init writes the config for you, merging into .mcp.json
without clobbering servers you already have:
The version pin is not cosmetic: an unpinned npx -y server is exactly what
VSB-AGENT-004 flags as high severity, so vibe-shield's own audit would write
itself a finding. init pins the running version automatically.
Or add it by hand:
The server is zero-dependency, writes only JSON-RPC to stdout, honours
JSON-RPC notifications (no spurious replies), and returns tool errors as
isError results so a bad argument degrades one call instead of killing the
session. Requests are handled in arrival order.
An empty target is reported as No files were scanned rather than a green pass —
a scanner that says "clean" when it read nothing is worse than no scanner.
🤖 Use it as an Agent Skill
npx -y github:avivgerz-hue/vibe-shield#v2 init --agents all installs the skill. Once it is in a repository, every
agent session starts with a contract:
You are not allowed to say "done" until the code you just wrote passes a security audit.
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.
The skill itself is SKILL.md — read it, it is short.
Anthropic Agent Skills quickstart
🔁 CI/CD: fail the PR before the bug ships
GitHub Actions (recommended)
npx -y @vibefoundry/vibe-shield init installs a workflow that runs the scan, uploads SARIF to
code scanning, audits the agent surface, and fails the job:
Findings appear inline on the pull request diff (GitHub annotations) and in the Security → Code scanning tab (SARIF), so a reviewer sees the vulnerability on the line that introduced it.
Any other CI
Exit codes: 0 clean · 1 findings at/above --fail-on · 2 usage error
(a target path that does not exist, or a target that matches no scannable files).
An empty scan prints NO FILES SCANNED — this is not a pass and is never
reported as a grade — a gate pointed at an ignored path fails instead of
succeeding forever.
🎯 The scorecard
Grades are deliberately unforgiving, because "B+" for a leaked production key is how security tools lose credibility:
Penalties 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.
🪄 It scans itself
This repository runs its own gate on every commit and in CI:
The detector catalogue is the one place that must contain the exact vulnerable
shapes and vendor key formats the rules match on — exactly like gitleaks and
semgrep. Those files are listed explicitly in .vibe-shieldignore
with a comment explaining why, instead of weakening a rule.
🔇 Suppressing a finding (legitimately)
Inline, with a rule id and a reason — the reason is required by review culture even though the parser does not enforce it:
Suppressed 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.
⚙️ How it works
Design constraints, in priority order:
- Fast. One
readdirwalk, 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. - 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.
- Composable.
scanProject()for the CLI,runRulesOnFile()for the auditor,scoreFindings()for anything that produces findings. The whole API is exported fromvibe-shield.
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.
📖 CLI reference
init takes --target <dir>, --agent claude / cursor / generic / all, --no-workflow,
--force and --yes.
🧩 Programmatic API
❓ FAQ
Does it replace a real SAST tool? No. 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.
Will it flag my secure code?
The secure fixture (tests/fixtures/secure/) is a real Next.js + Supabase + Stripe app with auth, RLS, sanitisation, rate limiting and webhook verification — it scores 100/100 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.
Does it send my code anywhere? No. There is no network code in the runtime at all — the package has zero dependencies and makes no outbound requests.
Why not an AST? Because 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.
Why "vibe"? Because the code was written by vibe and reviewed by nobody. This is the reviewer.
🛠 Development
See CONTRIBUTING.md for the rule-authoring guide, and SECURITY.md for the threat model and disclosure policy.
📋 Requirements
- Node.js ≥ 18.17 (uses
node:builtins only — no polyfills, no native modules) - Any OS: Linux, macOS, Windows
- No config file required;
package.jsonis optional
📄 License
MIT © VibeFoundry — use it, fork it, ship it.
Part of the VibeFoundry Agent Suite
Three tools for the same problem: agents move fast, and something has to keep the output honest.
Source: README.md at commit 64b8d46
Tools
0Version history
1- v2.1.2LatestNov 11, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts