@vibefoundry/vibe-shield 1.1.0 → 2.0.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.
Files changed (39) hide show
  1. package/README.md +74 -48
  2. package/SECURITY.md +1 -1
  3. package/SKILL.md +27 -94
  4. package/dist/bin/vibe-shield.d.ts +1 -1
  5. package/dist/bin/vibe-shield.js +572 -541
  6. package/dist/src/init/scaffold.d.ts +29 -31
  7. package/dist/src/init/scaffold.js +69 -153
  8. package/dist/src/mcp/server.js +6 -2
  9. package/dist/src/mcp-guard/skill-auditor.js +11 -3
  10. package/dist/src/reporter/console-reporter.js +17 -3
  11. package/dist/src/reporter/executive.d.ts +4 -0
  12. package/dist/src/reporter/executive.js +58 -0
  13. package/dist/src/reporter/formatters.d.ts +1 -1
  14. package/dist/src/reporter/formatters.js +10 -3
  15. package/dist/src/reporter/patch-prompt-writer.js +5 -5
  16. package/dist/src/scanner/attack-surface.d.ts +4 -0
  17. package/dist/src/scanner/attack-surface.js +50 -0
  18. package/dist/src/scanner/engine.d.ts +2 -3
  19. package/dist/src/scanner/engine.js +21 -35
  20. package/dist/src/scanner/mappings.d.ts +17 -0
  21. package/dist/src/scanner/mappings.js +39 -0
  22. package/dist/src/scanner/redact.d.ts +1 -0
  23. package/dist/src/scanner/redact.js +12 -0
  24. package/dist/src/scanner/rules/database-exposure.js +1 -1
  25. package/dist/src/scanner/rules/hardening.d.ts +5 -0
  26. package/dist/src/scanner/rules/hardening.js +116 -0
  27. package/dist/src/scanner/rules/helpers.js +2 -0
  28. package/dist/src/scanner/rules/index.js +6 -0
  29. package/dist/src/scanner/rules/response-hardening.d.ts +2 -0
  30. package/dist/src/scanner/rules/response-hardening.js +120 -0
  31. package/dist/src/scanner/rules/secret-entropy.js +0 -2
  32. package/dist/src/scanner/rules/shared.d.ts +1 -1
  33. package/dist/src/scanner/rules/shared.js +1 -1
  34. package/dist/src/scanner/types.d.ts +33 -1
  35. package/dist/src/scanner/types.js +6 -2
  36. package/dist/src/scanner/version.d.ts +2 -0
  37. package/dist/src/scanner/version.js +69 -0
  38. package/dist/src/secrets/patterns.js +40 -0
  39. package/package.json +99 -96
package/README.md CHANGED
@@ -8,17 +8,17 @@ Your agent ships fast. It also ships `NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY`, a
8
8
 
9
9
  vibe-shield is a **static security scanner built for that failure mode**, plus an **Agent Skill** that makes Claude Code, Codex, Cursor and Windsurf audit before they say *"done"*.
10
10
 
11
- [![version](https://img.shields.io/github/package-json/v/avivgerz-hue/vibe-shield?style=flat-square&label=version&color=cb3837)](https://github.com/avivgerz-hue/vibe-shield/blob/main/package.json)
12
- [![install](https://img.shields.io/badge/install-github%3Aavivgerz--hue%2Fvibe--shield-cb3837?style=flat-square&logo=npm)](#-quick-start)
11
+ [![npm version](https://img.shields.io/npm/v/@vibefoundry/vibe-shield.svg)](https://www.npmjs.com/package/@vibefoundry/vibe-shield)
12
+ [![npm downloads](https://img.shields.io/npm/dm/@vibefoundry/vibe-shield.svg)](https://www.npmjs.com/package/@vibefoundry/vibe-shield)
13
13
  [![CI](https://img.shields.io/github/actions/workflow/status/avivgerz-hue/vibe-shield/ci.yml?branch=main&style=flat-square&logo=githubactions&label=CI)](https://github.com/avivgerz-hue/vibe-shield/actions/workflows/ci.yml)
14
14
  [![node](https://img.shields.io/badge/node-%E2%89%A518.17.0-5fa04e?style=flat-square&logo=nodedotjs)](#-requirements)
15
15
  [![license](https://img.shields.io/github/license/avivgerz-hue/vibe-shield?style=flat-square&color=blue)](./LICENSE)
16
16
  [![zero dependencies](https://img.shields.io/badge/runtime%20deps-0-brightgreen?style=flat-square)](./package.json)
17
- [![rules](https://img.shields.io/badge/detection%20signatures-60-8b5cf6?style=flat-square)](./src/scanner/rules)
17
+ [![rules](https://img.shields.io/badge/detection%20signatures-91-8b5cf6?style=flat-square)](./src/scanner/rules)
18
18
  [![self-scan](https://img.shields.io/badge/self--scan-100%2F100%20A%2B-16a34a?style=flat-square)](#-it-scans-itself)
19
19
 
20
20
  ```bash
21
- npx github:avivgerz-hue/vibe-shield scan
21
+ npx -y @vibefoundry/vibe-shield scan
22
22
  ```
23
23
 
24
24
  ![vibe-shield terminal preview](./assets/hero-terminal.svg)
@@ -27,6 +27,26 @@ npx github:avivgerz-hue/vibe-shield scan
27
27
 
28
28
  ---
29
29
 
30
+ ## v2.0.0: eight defensive vectors
31
+
32
+ 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.
33
+
34
+ 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.
35
+
36
+ Generate an executive report or agent remediation prompt explicitly:
37
+
38
+ ```bash
39
+ npx -y @vibefoundry/vibe-shield scan --report SECURITY-REPORT.md --patch-prompt PATCH-PROMPT.md
40
+ npx -y @vibefoundry/vibe-shield scan --format html --out security-report.html
41
+ npx -y @vibefoundry/vibe-shield audit-skills --report agent-report.html
42
+ ```
43
+
44
+ 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.
45
+
46
+ > The source tree targets v2.0.0; the npm commands acquire the published version, which may lag this branch until a release is published. To exercise this checkout locally, run `npm ci && npm run build`, then `node dist/bin/vibe-shield.js` with the same arguments.
47
+
48
+ ---
49
+
30
50
  ## The problem, in one file
31
51
 
32
52
  This is the shape of code an agent writes when you ask for "a delete endpoint":
@@ -42,10 +62,10 @@ export async function DELETE(req: Request) {
42
62
 
43
63
  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.
44
64
 
45
- `npx github:avivgerz-hue/vibe-shield scan` catches all three in **17 milliseconds**:
65
+ `npx -y @vibefoundry/vibe-shield scan` catches all three in **17 milliseconds**:
46
66
 
47
67
  ```
48
- 🛡️ vibe-shield v1.0.0 · security scan
68
+ 🛡️ vibe-shield · security scan (illustrative output)
49
69
  target /home/you/app
50
70
 
51
71
  💀 GRADE F — 0/100 · 3 critical
@@ -61,18 +81,18 @@ app/api/users/route.ts
61
81
  await db.query(`DELETE FROM users WHERE id = ${id} AND owner = ${userId}`);
62
82
  CRITICAL 4:22 VSB-AUTH-004 Record ownership taken from the request instead of the session (IDOR)
63
83
 
64
- 7 files · 1 KiB · 412 files/s · 17 ms · 48 rules
84
+ 7 files · 1 KiB · 412 files/s · 17 ms · 79 rules
65
85
 
66
86
  ⚠ 3 critical findings — rotate any exposed credential before anything else.
67
- Fix it npx github:avivgerz-hue/vibe-shield scan --fix-prompt # writes SECURITY_PATCH_PROMPT.md for your agent
68
- Explain npx github:avivgerz-hue/vibe-shield explain VSB-AUTH-001
69
- Gate CI npx github:avivgerz-hue/vibe-shield scan --fail-on critical --format github
87
+ Fix it npx -y @vibefoundry/vibe-shield scan --fix-prompt # writes SECURITY_PATCH_PROMPT.md for your agent
88
+ Explain npx -y @vibefoundry/vibe-shield explain VSB-AUTH-001
89
+ Gate CI npx -y @vibefoundry/vibe-shield scan --fail-on critical --format github
70
90
  ```
71
91
 
72
92
  Then hand the fix list to the agent that wrote the bug:
73
93
 
74
94
  ```bash
75
- npx github:avivgerz-hue/vibe-shield scan --fix-prompt # → SECURITY_PATCH_PROMPT.md
95
+ npx -y @vibefoundry/vibe-shield scan --fix-prompt # → SECURITY_PATCH_PROMPT.md
76
96
  ```
77
97
 
78
98
  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.
@@ -83,22 +103,23 @@ That file contains, for every finding: the severity, the CWE id and link, the ex
83
103
 
84
104
  ```bash
85
105
  # 1. Scan (no install, no config, no network calls)
86
- npx github:avivgerz-hue/vibe-shield scan
106
+ npx -y @vibefoundry/vibe-shield scan
87
107
 
88
108
  # 2. Give your agent the fix list
89
- npx github:avivgerz-hue/vibe-shield scan --fix-prompt
109
+ npx -y @vibefoundry/vibe-shield scan --fix-prompt
90
110
 
91
111
  # 3. Install the gate permanently — skill + CI + ignore file
92
- npx github:avivgerz-hue/vibe-shield init
112
+ npx -y @vibefoundry/vibe-shield init
93
113
  ```
94
114
 
95
- > **Why GitHub and not `npx vibe-shield`?** The name `vibe-shield` on the npm
96
- > registry belongs to a different project with no connection to this one. Running
97
- > `npx vibe-shield` installs *their* package, not this repository's. Install from
98
- > GitHub — the compiled CLI is committed, so it needs **no TypeScript** and starts
99
- > in milliseconds. A scoped npm release (`@vibefoundry/vibe-shield`) may follow.
115
+ > **Use the scoped name.** vibe-shield is published as
116
+ > [`@vibefoundry/vibe-shield`](https://www.npmjs.com/package/@vibefoundry/vibe-shield).
117
+ > The *unscoped* name `vibe-shield` on npm belongs to an unrelated project, so
118
+ > `npx vibe-shield` runs someone else's code. Always include the `@vibefoundry/`
119
+ > scope. The package ships a prebuilt `dist/`, needs **no TypeScript**, and
120
+ > starts in milliseconds.
100
121
 
101
- `npx github:avivgerz-hue/vibe-shield init` writes:
122
+ `npx -y @vibefoundry/vibe-shield init` writes:
102
123
 
103
124
  | File | What it does |
104
125
  | --- | --- |
@@ -125,13 +146,13 @@ Traditional SAST rules are built around human mistakes: a forgotten escape, a mi
125
146
  | writes `CREATE TABLE` | writes `CREATE TABLE` **and forgets the `ENABLE ROW LEVEL SECURITY`**, so the anon key reads everything |
126
147
  | adds `dangerouslySetInnerHTML` to render a doc | renders **model output** with it, creating stored XSS with a step counter |
127
148
 
128
- vibe-shield encodes those specific shapes: 60 signatures across five families, each one derived from a real agent-generated bug rather than a generic CWE checklist.
149
+ vibe-shield encodes those specific shapes: 91 signatures across eight defensive categories, each one derived from a real agent-generated bug rather than a generic CWE checklist.
129
150
 
130
151
  ---
131
152
 
132
153
  ## 📊 Vulnerability Coverage Matrix
133
154
 
134
- **48 code signatures + 12 agent-integrity signatures = 60.** Every rule has an id, a CWE, a vulnerable example, a fixed example, and ordered remediation steps — run `npx github:avivgerz-hue/vibe-shield rules` or `npx github:avivgerz-hue/vibe-shield explain <ID>`.
155
+ **79 code signatures + 12 agent-integrity signatures = 91.** 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>`.
135
156
 
136
157
  ### Client-side secret & data exposure — `VSB-CLIENT-*`
137
158
 
@@ -234,33 +255,38 @@ Claude Code, Claude Desktop, Cursor and Codex can call the scanner as a tool
234
255
  instead of shelling out and parsing console output.
235
256
 
236
257
  ```bash
237
- npx github:avivgerz-hue/vibe-shield mcp # JSON-RPC 2.0 over stdio
258
+ npx -y @vibefoundry/vibe-shield mcp # JSON-RPC 2.0 over stdio
259
+ npx -y @vibefoundry/vibe-shield --mcp # same thing, if your client prefers a flag
238
260
  ```
239
261
 
240
262
  Three tools:
241
263
 
242
264
  | Tool | What it does |
243
265
  | --- | --- |
244
- | `vibe_shield_scan` | Runs the 60 rules over a project or specific paths → grade, score, findings with file:line, CWE and remediation |
266
+ | `vibe_shield_scan` | Runs the code-scanning rules over a project or specific paths → grade, score, findings with file:line, CWE and remediation |
245
267
  | `vibe_shield_audit_skills` | Audits `.claude/skills`, `.cursor` rules, `AGENTS.md` and MCP configs for prompt injection and exfiltration traps |
246
268
  | `vibe_shield_explain_rule` | Full CWE detail, vulnerable/fixed examples and remediation for any rule id or slug |
247
269
 
248
- `npx github:avivgerz-hue/vibe-shield init` writes the config for you, merging into `.mcp.json`
270
+ `npx -y @vibefoundry/vibe-shield init` writes the config for you, merging into `.mcp.json`
249
271
  **without clobbering** servers you already have:
250
272
 
251
273
  ```jsonc
252
274
  {
253
275
  "mcpServers": {
254
276
  "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"] },
255
- "vibe-shield": { "command": "npx", "args": ["--yes", "github:avivgerz-hue/vibe-shield", "mcp"] }
277
+ "vibe-shield": { "command": "npx", "args": ["--yes", "@vibefoundry/vibe-shield@1.1.1", "mcp"] }
256
278
  }
257
279
  }
258
280
  ```
259
281
 
282
+ The version pin is not cosmetic: an unpinned `npx -y` server is exactly what
283
+ `VSB-AGENT-004` flags as high severity, so vibe-shield's own audit would write
284
+ itself a finding. `init` pins the running version automatically.
285
+
260
286
  Or add it by hand:
261
287
 
262
288
  ```bash
263
- claude mcp add vibe-shield -- npx --yes github:avivgerz-hue/vibe-shield mcp
289
+ claude mcp add vibe-shield -- npx -y @vibefoundry/vibe-shield mcp
264
290
  ```
265
291
 
266
292
  The server is zero-dependency, writes **only** JSON-RPC to stdout, honours
@@ -275,15 +301,15 @@ a scanner that says "clean" when it read nothing is worse than no scanner.
275
301
 
276
302
  ## 🤖 Use it as an Agent Skill
277
303
 
278
- `npx github:avivgerz-hue/vibe-shield init` installs the skill. Once it is in a repository, every
304
+ `npx -y @vibefoundry/vibe-shield init` installs the skill. Once it is in a repository, every
279
305
  agent session starts with a contract:
280
306
 
281
307
  > You are not allowed to say "done" until the code you just wrote passes a security audit.
282
308
 
283
309
  ```bash
284
- npx github:avivgerz-hue/vibe-shield init # Claude Code + Cursor + AGENTS.md + CI
285
- npx github:avivgerz-hue/vibe-shield init --agent claude # just the skill
286
- npx github:avivgerz-hue/vibe-shield init --no-workflow # skip the GitHub Action
310
+ npx -y @vibefoundry/vibe-shield init # Claude Code + Cursor + AGENTS.md + CI
311
+ npx -y @vibefoundry/vibe-shield init --agent claude # just the skill
312
+ npx -y @vibefoundry/vibe-shield init --no-workflow # skip the GitHub Action
287
313
  ```
288
314
 
289
315
  **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.
@@ -294,7 +320,7 @@ The skill itself is [SKILL.md](./SKILL.md) — read it, it is short.
294
320
 
295
321
  ```bash
296
322
  # marketplace-style install
297
- npx github:avivgerz-hue/vibe-shield init --agent claude
323
+ npx -y @vibefoundry/vibe-shield init --agent claude
298
324
  # → .claude/skills/vibe-shield/SKILL.md
299
325
 
300
326
  # or globally, for every project
@@ -308,7 +334,7 @@ curl -sL https://raw.githubusercontent.com/avivgerz-hue/vibe-shield/main/SKILL.m
308
334
 
309
335
  ### GitHub Actions (recommended)
310
336
 
311
- `npx github:avivgerz-hue/vibe-shield init` installs a workflow that runs the scan, uploads SARIF to
337
+ `npx -y @vibefoundry/vibe-shield init` installs a workflow that runs the scan, uploads SARIF to
312
338
  code scanning, audits the agent surface, and fails the job:
313
339
 
314
340
  ```yaml
@@ -329,7 +355,7 @@ jobs:
329
355
  node-version: 20
330
356
 
331
357
  - name: Scan and upload SARIF
332
- run: npx --yes github:avivgerz-hue/vibe-shield scan --format sarif --out vibe-shield.sarif --fail-on high
358
+ run: npx -y @vibefoundry/vibe-shield scan --format sarif --out vibe-shield.sarif --fail-on high
333
359
  continue-on-error: true
334
360
 
335
361
  - uses: github/codeql-action/upload-sarif@v3
@@ -339,7 +365,7 @@ jobs:
339
365
  category: vibe-shield
340
366
 
341
367
  - name: Enforce the gate
342
- run: npx --yes github:avivgerz-hue/vibe-shield scan --fail-on high
368
+ run: npx -y @vibefoundry/vibe-shield scan --fail-on high
343
369
  ```
344
370
 
345
371
  Findings appear **inline on the pull request diff** (GitHub annotations) and in
@@ -349,11 +375,11 @@ on the line that introduced it.
349
375
  ### Any other CI
350
376
 
351
377
  ```bash
352
- npx github:avivgerz-hue/vibe-shield scan --fail-on high # exit 1 on findings
353
- npx github:avivgerz-hue/vibe-shield scan --format compact # one line per finding
354
- npx github:avivgerz-hue/vibe-shield scan --format json > vibe-shield.json # full report
355
- npx github:avivgerz-hue/vibe-shield scan --format summary # JSON, counts + grade only
356
- npx github:avivgerz-hue/vibe-shield scan --format github # workflow annotations
378
+ npx -y @vibefoundry/vibe-shield scan --fail-on high # exit 1 on findings
379
+ npx -y @vibefoundry/vibe-shield scan --format compact # one line per finding
380
+ npx -y @vibefoundry/vibe-shield scan --format json > vibe-shield.json # full report
381
+ npx -y @vibefoundry/vibe-shield scan --format summary # JSON, counts + grade only
382
+ npx -y @vibefoundry/vibe-shield scan --format github # workflow annotations
357
383
  ```
358
384
 
359
385
  Exit codes: **0** clean · **1** findings at/above `--fail-on` · **2** usage error
@@ -385,17 +411,17 @@ Penalties per finding: critical −30, high −12, medium −5, low −2, info
385
411
  This repository runs its own gate on every commit and in CI:
386
412
 
387
413
  ```console
388
- $ npx github:avivgerz-hue/vibe-shield scan
389
- 🛡️ vibe-shield v1.0.0 · security scan
414
+ $ npx -y @vibefoundry/vibe-shield scan
415
+ 🛡️ vibe-shield · security scan (illustrative output)
390
416
  target /you/vibe-shield
391
417
 
392
418
  🏆 GRADE A+ — 100/100
393
419
 
394
- 21 files · 172 KiB · 236 files/s · 89 ms · 48 rules
420
+ 21 files · 172 KiB · 236 files/s · 89 ms · 79 rules
395
421
 
396
422
  Nothing to fix. Keep the shield up. 🛡️
397
423
 
398
- $ npx github:avivgerz-hue/vibe-shield audit-skills
424
+ $ npx -y @vibefoundry/vibe-shield audit-skills
399
425
  🏆 GRADE A+ — 100/100
400
426
 
401
427
  1 file · 6 KiB · 14 files/s · 69 ms · 12 rules
@@ -435,7 +461,7 @@ Suppressed findings are **counted and reported** in the scorecard, never silentl
435
461
  ```
436
462
  discover ──▶ project context ──▶ rule gate ──▶ detect ──▶ suppress ──▶ score ──▶ report
437
463
  │ │ │ │
438
- │ │ │ └─ 60 rules, each a pure (FileContext) => RuleHit[]
464
+ │ │ │ └─ 91 rules, each a pure (FileContext) => RuleHit[]
439
465
  │ │ └─ cheap content hints: most rules skip most files
440
466
  │ └─ manifests, framework flags, cross-file RLS index, git index, middleware matchers
441
467
  └─ one tree walk, gitignore/.vibe-shieldignore layering, binary + size + test/doc pruning
@@ -447,7 +473,7 @@ Suppressed findings are **counted and reported** in the scorecard, never silentl
447
473
  2. **Honest.** Every finding carries the exact snippet the developer wrote. Nothing is inferred from a filename alone, and every suppression is counted, not hidden.
448
474
  3. **Composable.** `scanProject()` for the CLI, `runRulesOnFile()` for the auditor, `scoreFindings()` for anything that produces findings. The whole API is exported from `vibe-shield`.
449
475
 
450
- **Zero runtime dependencies.** No network calls, no telemetry, no language server, no native binaries. `npx github:avivgerz-hue/vibe-shield scan` works offline and in an air-gapped CI runner.
476
+ **Zero runtime dependencies.** No network calls, no telemetry, no language server, no native binaries. `npx -y @vibefoundry/vibe-shield scan` works offline and in an air-gapped CI runner.
451
477
 
452
478
  ---
453
479
 
@@ -465,7 +491,7 @@ vibe-shield version | help
465
491
 
466
492
  | Flag | Default | Meaning |
467
493
  | --- | --- | --- |
468
- | `--format <fmt>` | `console` | `console` `compact` `summary` `json` `sarif` `github` |
494
+ | `--format <fmt>` | `console` | `console` `compact` `summary` `json` `sarif` `github` `markdown` `html` |
469
495
  | `--fail-on <sev>` | `critical` | Exit 1 at/above this severity |
470
496
  | `--severity <sev>` | — | Only report at/above this severity |
471
497
  | `--fix-prompt` | off | Write `SECURITY_PATCH_PROMPT.md` |
@@ -567,5 +593,5 @@ Three tools for the same problem: agents move fast, and something has to keep th
567
593
  | 👻 | **[ghost-qa](https://github.com/avivgerz-hue/ghost-qa)** | Autonomous headless-browser QA & self-healing verification loop — stops agents from claiming a UI works when it does not |
568
594
 
569
595
  ```bash
570
- npx github:avivgerz-hue/vibe-shield init # security gate
596
+ npx -y @vibefoundry/vibe-shield init # security gate
571
597
  ```
package/SECURITY.md CHANGED
@@ -14,7 +14,7 @@
14
14
  Email **security@vibefoundry.dev** with:
15
15
 
16
16
  - a description of the issue and its impact
17
- - the affected version (`npx github:avivgerz-hue/vibe-shield version`)
17
+ - the affected version (`npx -y @vibefoundry/vibe-shield version`)
18
18
  - a minimal reproduction (a snippet, a repository, or a failing test)
19
19
  - whether you intend to publish, and any deadline you are working to
20
20
 
package/SKILL.md CHANGED
@@ -1,124 +1,57 @@
1
1
  ---
2
2
  name: vibe-shield
3
- description: Audit any change for AI-introduced security bugs (leaked keys, unguarded API routes, disabled Row Level Security, SQL injection, prompt injection, poisoned MCP servers) and fix them before reporting a task as done. Use whenever you write or modify application code, API routes, server actions, database migrations, auth logic, environment variables, LLM calls, webhook handlers, agent skills or MCP configuration.
4
- allowed-tools: Bash(npx github:avivgerz-hue/vibe-shield scan*), Bash(npx github:avivgerz-hue/vibe-shield audit-skills*), Bash(npx github:avivgerz-hue/vibe-shield explain*), Read(./**), Grep, Glob
3
+ description: Apply a six-phase defensive security review to changes affecting applications, APIs, data, AI agents, and MCP configuration. Use static evidence, preserve behavior, and report limitations.
4
+ allowed-tools: Bash(npx -y @vibefoundry/vibe-shield scan*), Bash(npx -y @vibefoundry/vibe-shield audit-skills*), Bash(npx -y @vibefoundry/vibe-shield explain*), Read(./**), Grep, Glob
5
5
  license: MIT
6
6
  metadata:
7
7
  author: VibeFoundry
8
8
  homepage: https://github.com/avivgerz-hue/vibe-shield
9
- version: 1.0.0
9
+ version: 2.0.0
10
10
  ---
11
11
 
12
- # vibe-shield
12
+ # Defensive AppSec architect protocol
13
13
 
14
- You are not allowed to say "done" until the code you just wrote passes a security audit.
14
+ Work only within the authorized project. Static findings are evidence for review, not proof of exploitability or a guarantee of safety. Do not transmit source code or secrets. Ask before changing production services, rotating credentials, or making destructive changes.
15
15
 
16
- AI coding agents ship a specific, repeatable class of vulnerability: a `SUPABASE_SERVICE_ROLE_KEY` behind a `NEXT_PUBLIC_` prefix, a `DELETE` route handler with no session check, a `CREATE TABLE` with no `ENABLE ROW LEVEL SECURITY`, a tool whose `execute` forwards model output into `exec`. These are not exotic — they are the default shape of code written quickly by something optimising for "it works". This skill is the second pair of eyes.
16
+ ## Phase 1: Attack-surface reconnaissance
17
17
 
18
- ## When to run
18
+ Map entrypoints and trust boundaries: API methods, authentication and authorization, middleware matchers, database tables and policies, storage, LLM inputs and tools, webhooks, and agent/MCP configuration. Check deployment configuration and exclusions. Identify what the scanner cannot see.
19
19
 
20
- Run the audit **after every change that touches**:
21
-
22
- - an API route, route handler, server action, RPC endpoint or GraphQL mutation
23
- - authentication, session, role, permission or ownership logic
24
- - a database migration, policy, grant, schema or Supabase table
25
- - an environment variable, config file, `.env*` file or build config
26
- - anything calling an LLM, a tool, a webhook, a shell command or the filesystem
27
- - `.claude/`, `.cursor/`, `AGENTS.md`, `mcp.json` or any skill/config file
28
-
29
- If you did not touch any of those, you do not need to run it.
30
-
31
- ## The loop
20
+ ## Phase 2: Automated static scan and skill audit
32
21
 
33
22
  ```bash
34
- # 1. Scan (a whole-repo scan finishes in well under a second)
35
- npx github:avivgerz-hue/vibe-shield scan --fail-on high
36
-
37
- # 2. If it fails, generate the machine-readable fix list
38
- npx github:avivgerz-hue/vibe-shield scan --fix-prompt
39
-
40
- # 3. Read SECURITY_PATCH_PROMPT.md and fix every finding, critical first
41
- # Each entry has the exact file:line, the vulnerable snippet, the CWE and
42
- # the required change. Apply it literally.
43
-
44
- # 4. Re-run until it exits 0
45
- npx github:avivgerz-hue/vibe-shield scan --fail-on high
23
+ npx -y @vibefoundry/vibe-shield scan . --format json
24
+ npx -y @vibefoundry/vibe-shield audit-skills . --format json
46
25
  ```
47
26
 
48
- `--fail-on high` exits non-zero while any high or critical finding exists. That is the gate.
49
-
50
- ## Reading a finding
27
+ Inspect findings, inventory, ignored paths, and the files scanned. The explicit `.` includes test and documentation files: review fixtures as examples rather than blindly changing them. Use `explain <RULE_ID>` to investigate a rule. These commands run locally; first-time installation with npx requires registry access.
51
28
 
52
- ```
53
- CRITICAL 47:15 VSB-CLIENT-001 Server-only secret exposed through a public environment prefix
54
- const key = process.env.NEXT_PUBLIC_OPENAI_API_KEY;
55
- ```
29
+ ## Phase 3: Deep contextual threat modeling
56
30
 
57
- | Part | Meaning |
58
- | --- | --- |
59
- | `47:15` | exact line and column to edit |
60
- | `VSB-CLIENT-001` | rule id — use it with `explain` for full docs |
61
- | message | why this specific line is exploitable |
62
- | `(CWE-200)` | bug class, for a deeper search if the fix is unclear |
31
+ Trace untrusted input through authentication, ownership checks and tenant boundaries to database, filesystem, network, HTML, and LLM sinks. Inspect IDOR, business-logic bypasses, webhook signature verification and asynchronous jobs. Check cross-file guards and deployed database policies; absence of a static finding is not evidence of protection.
63
32
 
64
- Need the full picture? `npx github:avivgerz-hue/vibe-shield explain VSB-CLIENT-001` prints the vulnerable shape, the fixed shape, remediation steps and references.
33
+ ## Phase 4: Surgical zero-regression remediation
65
34
 
66
- ## Hard rules
35
+ - On Next.js mutation routes, authenticate the session on the server and authorize the target resource against the session principal before writes. Do not trust identity from request bodies.
36
+ - Enable Supabase RLS and write action-specific policies using the authenticated principal; test both permitted and denied tenants before deploying migrations.
37
+ - Validate inputs at the boundary with a schema such as Zod, then use parameterized database queries. Treat LLM output as untrusted.
38
+ - Use explicit CORS allowlists, secure cookie flags and a CSP appropriate for the application. Test login, redirects, and browser behavior.
39
+ - Report exposed credentials to the owner for provider-side rotation; avoid reproducing their values in reports. Do not suppress findings or weaken controls to obtain a higher score. Ask for missing business or deployment decisions.
67
40
 
68
- 1. **Fix the root cause.** Never delete an auth check, disable RLS, silence a log or add a catch-all `catch {}` to make the finding disappear.
69
- 2. **Never suppress.** Do not add `// vibe-shield-disable`, do not edit `.vibe-shieldignore`, do not pass `--ignore`. Suppression is a decision for the human.
70
- 3. **Rotate exposed credentials.** If the scan reported a live key, tell the user to rotate it at the provider in the same message. Removing the line does not un-leak it — the value may already be in a bundle, a cache or a git history.
71
- 4. **Report honestly.** If you cannot fix a finding (you need a decision, a credential or a provider change), say so explicitly, name the rule id, and stop.
72
- 5. **Re-verify.** A fix is not finished until the gate exits 0.
41
+ ## Phase 5: Verification gate
73
42
 
74
- ## Agent surface audit
75
-
76
- When you add or modify a skill, rule file, MCP server or instruction file, also run:
43
+ Run project tests and both audits again. Aim for 100/100 Grade A+ with no high or critical findings, but report any unresolved finding, exclusion, false positive, or verification limitation honestly rather than claiming success. Never equate a clean score with a complete security assessment.
77
44
 
78
45
  ```bash
79
- npx github:avivgerz-hue/vibe-shield audit-skills
46
+ npx -y @vibefoundry/vibe-shield scan --fail-on high
47
+ npx -y @vibefoundry/vibe-shield audit-skills --fail-on high
80
48
  ```
81
49
 
82
- Twelve `VSB-AGENT-*` rules check for hidden Unicode (zero-width and bidi characters used to smuggle instructions past review), `curl`/`wget` exfiltration of environment variables, credential-harvesting instructions (`.env`, `~/.ssh`, `~/.aws`), registry-tag or remote MCP servers, literal tokens in an `env` block, safety-override language, over-broad tool permissions, base64 `eval` payloads, remote-instruction fetching, wildcard `allowed-tools`, and shell injection in skill scripts.
83
-
84
- Each finding carries a `triage` field: `block` means refuse and escalate, `review` means ask the user, `report` means mention it and continue. Do not blanket-refuse a repository because a rule fired — read the triage.
85
-
86
- ## Flags worth knowing
87
-
88
- | Flag | Effect |
89
- | --- | --- |
90
- | `--format json` | full machine-readable report (schemaVersion 1) |
91
- | `--format sarif` | SARIF 2.1.0 for GitHub code scanning |
92
- | `--format compact` | one line per finding |
93
- | `--format github` | inline GitHub Actions annotations |
94
- | `--severity high` | only report high and critical |
95
- | `--fail-on medium` | stricter gate |
96
- | `--include-tests` | include test and fixture files |
97
- | `--cache` | reuse results between runs |
98
- | `--quiet` | one-line verdict (ideal for piping) |
99
- | `rules` | list every rule |
100
- | `explain <RULE_ID>` | full documentation for one rule |
50
+ ## Phase 6: Executive security sign-off
101
51
 
102
- If the repository has a `.mcp.json`, the same three capabilities are also
103
- available as MCP tools — `vibe_shield_scan`, `vibe_shield_audit_skills` and
104
- `vibe_shield_explain_rule`. Prefer those when they are listed, because they
105
- return structured findings instead of text you have to parse.
106
-
107
- ## Definition of done
108
-
109
- - [ ] `npx github:avivgerz-hue/vibe-shield scan --fail-on high` exits `0`
110
- - [ ] `npx github:avivgerz-hue/vibe-shield audit-skills` exits `0` if you touched agent files
111
- - [ ] every credential the scan surfaced has been flagged to the user for rotation
112
- - [ ] no suppression directive was added
113
- - [ ] the feature still works and the existing tests still pass
114
-
115
- ## Install it into a repository
52
+ Produce a Markdown or HTML report with scope, inventory, risks prioritized by severity, evidence, actions, test results and remaining uncertainty. Illustrative code examples are not project-specific patches; review and adapt them. Obtain human approval before deployment or provider-side action.
116
53
 
117
54
  ```bash
118
- npx github:avivgerz-hue/vibe-shield init
55
+ npx -y @vibefoundry/vibe-shield scan --report SECURITY-REPORT.md --patch-prompt PATCH-PROMPT.md
56
+ npx -y @vibefoundry/vibe-shield audit-skills --report AGENT-REPORT.html
119
57
  ```
120
-
121
- That writes this file to `.claude/skills/vibe-shield/SKILL.md`, appends a security
122
- gate section to `AGENTS.md`, adds a `.cursor/rules/vibe-shield.mdc`, and installs a
123
- GitHub Actions workflow that fails the pull request on new high or critical
124
- findings. Every future task in that repository starts guarded.
@@ -32,7 +32,7 @@ export declare const defaultIo: () => CliIo;
32
32
  export declare const EXIT_OK = 0;
33
33
  export declare const EXIT_FINDINGS = 1;
34
34
  export declare const EXIT_USAGE = 2;
35
- declare const HELP = "vibe-shield \u2014 security scanner for AI-generated code\n\nUSAGE\n vibe-shield <command> [options]\n\nCOMMANDS\n scan [paths...] Scan the project (default: current directory).\n audit-skills [paths...] Audit agent skills, Cursor rules, AGENTS.md and MCP configs.\n init Install the Agent Skill, AGENTS.md section and CI workflow.\n rules List every detection rule.\n explain <RULE_ID> Show full documentation for a rule.\n mcp Serve the Model Context Protocol tools over stdio.\n version Print the version.\n help Print this help.\n\nSCAN OPTIONS\n --format <fmt> console | compact | summary | json | sarif | github (console)\n --out <file> Write the report to a file instead of stdout.\n --fix-prompt Write SECURITY_PATCH_PROMPT.md with exact fix instructions.\n --fail-on <severity> Exit 1 when a finding at/above this severity exists. (critical)\n --severity <severity> Only report findings at/above this severity.\n --rules <ids> Comma-separated rule ids/slugs (supports VSB-DB-*).\n --ignore <glob> Extra gitignore-style pattern (repeatable).\n --include-tests Include test, spec and fixture files.\n --include-docs Include Markdown and docs/.\n --cache Reuse .vibe-shield-cache.json between runs.\n --max-findings <n> Limit the console list (0 = all). (50)\n --quiet Print only the verdict line and the exit code.\n --no-color Disable ANSI colour.\n --no-shield-ignore Ignore .vibe-shieldignore (e.g. to scan excluded fixtures).\n --json Shorthand for --format json.\n\nINIT OPTIONS\n --target <dir> Repository to install into. (cwd)\n --agent <kind> claude | cursor | generic | all. (all)\n --no-workflow Skip the GitHub Actions workflow.\n --force Overwrite existing files.\n --yes Accepted for non-interactive CI use (init never prompts).\n\nEXAMPLES\n npx github:avivgerz-hue/vibe-shield scan\n npx github:avivgerz-hue/vibe-shield scan --fail-on high --format github\n npx github:avivgerz-hue/vibe-shield scan --fix-prompt\n npx github:avivgerz-hue/vibe-shield init\n npx github:avivgerz-hue/vibe-shield explain VSB-DB-001\n npx github:avivgerz-hue/vibe-shield audit-skills .claude\n";
35
+ declare const HELP = "vibe-shield \u2014 security scanner for AI-generated code\n\nUSAGE\n vibe-shield <command> [options]\n\nCOMMANDS\n scan [paths...] Scan the project (default: current directory).\n audit-skills [paths...] Audit agent skills, Cursor rules, AGENTS.md and MCP configs.\n init Install the Agent Skill, AGENTS.md section and CI workflow.\n rules List every detection rule.\n explain <RULE_ID> Show full documentation for a rule.\n mcp Serve the Model Context Protocol tools over stdio.\n version Print the version.\n help Print this help.\n\nSCAN OPTIONS\n --format <fmt> console | compact | summary | json | sarif | github | markdown | html\n --out <file> Write the report to a file.\n --report <file> Write a report (format inferred from extension).\n --patch-prompt <file> Write a remediation prompt to this file.\n --fix-prompt Write SECURITY_PATCH_PROMPT.md with exact fix instructions.\n --fail-on <severity> Exit 1 when a finding at/above this severity exists. (critical)\n --severity <severity> Only report findings at/above this severity.\n --rules <ids> Comma-separated rule ids/slugs (supports VSB-DB-*).\n --ignore <glob> Extra gitignore-style pattern (repeatable).\n --include-tests Include test, spec and fixture files.\n --include-docs Include Markdown and docs/.\n --cache Reuse .vibe-shield-cache.json between runs.\n --max-findings <n> Limit the console list (0 = all). (50)\n --quiet Print only the verdict line and the exit code.\n --no-color Disable ANSI colour.\n --no-shield-ignore Ignore .vibe-shieldignore (e.g. to scan excluded fixtures).\n --json Shorthand for --format json.\n\nINIT OPTIONS\n --target <dir> Repository to install into. (cwd)\n --agent <kind> claude | cursor | generic | all. (all)\n --no-workflow Skip the GitHub Actions workflow.\n --force Overwrite existing files.\n --yes Accepted for non-interactive CI use (init never prompts).\n\nEXAMPLES\n npx -y @vibefoundry/vibe-shield scan\n npx -y @vibefoundry/vibe-shield scan --fail-on high --format github\n npx -y @vibefoundry/vibe-shield scan --fix-prompt\n npx -y @vibefoundry/vibe-shield init\n npx -y @vibefoundry/vibe-shield explain VSB-DB-001\n npx -y @vibefoundry/vibe-shield audit-skills .claude\n";
36
36
  interface ParsedArgs {
37
37
  command: string;
38
38
  positionals: string[];