guardvibe 3.0.18 → 3.0.20

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
@@ -6,7 +6,7 @@
6
6
  [![npm provenance](https://img.shields.io/badge/provenance-verified-brightgreen)](https://www.npmjs.com/package/guardvibe)
7
7
  [![codecov](https://codecov.io/gh/goklab/guardvibe/graph/badge.svg)](https://codecov.io/gh/goklab/guardvibe)
8
8
 
9
- **The security MCP built for vibe coding.** 335 security rules, 34 tools covering the entire AI-generated code journey — from first line to production deployment.
9
+ **The security MCP built for vibe coding.** 335 security rules, 36 tools covering the entire AI-generated code journey — from first line to production deployment.
10
10
 
11
11
  Works with **Claude Code, Cursor, Gemini CLI, Codex, VS Code (Copilot), Windsurf**, and any MCP-compatible coding agent.
12
12
 
@@ -14,7 +14,7 @@ Works with **Claude Code, Cursor, Gemini CLI, Codex, VS Code (Copilot), Windsurf
14
14
 
15
15
  Most security tools are built for enterprise security teams. GuardVibe is built for **you** — the developer using AI to build and ship web apps fast.
16
16
 
17
- - **335 security rules, 34 tools** purpose-built for the stacks AI agents generate
17
+ - **335 security rules, 36 tools** purpose-built for the stacks AI agents generate
18
18
  - **Zero setup friction** — `npx guardvibe` and you're scanning
19
19
  - **No account required** — runs 100% locally, no API keys, no cloud
20
20
  - **Understands your stack** — not generic SAST, but rules that know Next.js, Supabase, Stripe, Clerk, and the tools you actually use
@@ -26,6 +26,15 @@ Most security tools are built for enterprise security teams. GuardVibe is built
26
26
  - **Agent-friendly output** — JSON format for AI agents, Markdown for humans, SARIF for CI/CD
27
27
  - **Plugin system** — extend with community or premium rule packs
28
28
 
29
+ ## New in v3
30
+
31
+ - **Inline suppress** — `// guardvibe-ignore VG001` silences individual findings per-line
32
+ - **CLI-first approach** — `npx guardvibe audit`, `npx guardvibe scan`, `npx guardvibe doctor` all work standalone without MCP
33
+ - **Embedded remediation plan** — `remediation_plan` generates a section-by-section fix checklist after every audit
34
+ - **Score reflects all sections** — security score now factors code, dependencies, config, secrets, auth coverage, and taint analysis
35
+ - **Gitignored secrets excluded** — files matched by `.gitignore` are automatically skipped during secret scanning
36
+ - **Taint sanitizer recognition** — dataflow analysis recognizes common sanitizers (DOMPurify, escape functions, parameterized queries) and stops propagation
37
+
29
38
  ## How GuardVibe Compares
30
39
 
31
40
  GuardVibe is purpose-built for the AI coding workflow. Traditional tools are excellent for enterprise CI/CD pipelines — GuardVibe fills a different gap.
@@ -183,7 +192,7 @@ Maps security findings to SOC2, PCI-DSS, HIPAA, GDPR, ISO27001, and EU AI Act (E
183
192
  ### Supply Chain
184
193
  Malicious postinstall scripts, unpinned GitHub Actions, typosquat detection
185
194
 
186
- ## Tools (33 MCP tools)
195
+ ## Tools (36 MCP tools)
187
196
 
188
197
  | Tool | What it does |
189
198
  |------|-------------|
@@ -221,6 +230,8 @@ Malicious postinstall scripts, unpinned GitHub Actions, typosquat detection
221
230
  | `auth_coverage` | **Auth coverage map** — enumerate routes, parse middleware matchers, detect auth guards, report coverage % |
222
231
  | `deep_scan` | **LLM-powered deep analysis** — IDOR, business logic, race conditions, privilege escalation (requires API key) |
223
232
  | `full_audit` | **Single source of truth** — runs ALL checks in one call, returns PASS/FAIL/WARN verdict + score + coverage % + deterministic result hash |
233
+ | `remediation_plan` | **Remediation plan** — generates section-by-section fix checklist after audit |
234
+ | `verify_remediation` | **Remediation verification** — compares before/after audit, flags skipped sections |
224
235
 
225
236
  All scanning tools support `format: "json"` for machine-readable output.
226
237
 
package/build/cli/hook.js CHANGED
@@ -11,7 +11,7 @@ const HOOK_SCRIPT = `#!/bin/sh
11
11
  echo "🔒 GuardVibe: scanning staged files..."
12
12
 
13
13
  # Run guardvibe scan on staged files
14
- RESULT=$(npx -y guardvibe-scan 2>&1)
14
+ RESULT=$(npx -y guardvibe scan --staged 2>&1)
15
15
  EXIT_CODE=$?
16
16
 
17
17
  if [ $EXIT_CODE -ne 0 ]; then
@@ -304,7 +304,7 @@ export const advancedSecurityRules = [
304
304
  severity: "medium",
305
305
  owasp: "A04:2025 Insecure Design",
306
306
  description: "Regular expression contains nested quantifiers ((a+)+), overlapping alternation with quantifiers (([a-z]+)*), or other patterns that cause catastrophic backtracking. Attackers can send crafted input to freeze the event loop.",
307
- pattern: /\/(?:[^/\\]|\\.)*(?:\([^)]*[+*][^)]*\)[+*]|\(\?:[^)]*[+*][^)]*\)[+*]|\[[^\]]*\][+*][^/]*[+*])(?:[^/\\]|\\.)*\//g,
307
+ pattern: /\/(?:[^/\\]|\\.)*(?:\([^)]*[+*][^)]*\)\s*[+*]|\(\?:[^)]*[+*][^)]*\)\s*[+*])(?:[^/\\]|\\.)*\//g,
308
308
  languages: ["javascript", "typescript"],
309
309
  fix: "Rewrite the regex to avoid nested quantifiers. Use atomic groups or possessive quantifiers if available, or use the 'safe-regex' library to validate patterns.",
310
310
  fixCode: '// BAD: catastrophic backtracking\nconst re = /(a+)+$/;\n\n// GOOD: no nested quantifiers\nconst re = /a+$/;\n\n// GOOD: validate with safe-regex\nimport safe from "safe-regex";\nif (!safe(pattern)) throw new Error("Unsafe regex");',
@@ -330,7 +330,7 @@ export const advancedSecurityRules = [
330
330
  severity: "medium",
331
331
  owasp: "A01:2025 Broken Access Control",
332
332
  description: "POST/PUT/PATCH/DELETE route handler performs database mutations without CSRF token verification. Cross-site requests from malicious pages can trick authenticated users into performing unwanted actions.",
333
- pattern: /export\s+(?:async\s+)?function\s+(?:POST|PUT|PATCH|DELETE)\s*\([^)]*\)\s*\{(?:(?!csrf|csrfToken|CSRF|x-csrf|verifyCsrf|validateCsrf|anti.?forgery|requireAdmin|requireAuth|checkAuth|withAuth|protectRoute|authenticate|x-csrf-protection)[\s\S]){10,}?(?:\.create\s*\(|\.update\s*\(|\.delete\s*\(|\.insert\s*\(|\.upsert\s*\()/g,
333
+ pattern: /export\s+(?:async\s+)?function\s+(?:POST|PUT|PATCH|DELETE)\s*\([^)]*\)\s*\{(?:(?!csrf|csrfToken|CSRF|x-csrf|verifyCsrf|validateCsrf|anti.?forgery|requireAdmin|requireAuth|checkAuth|withAuth|protectRoute|authenticate|x-csrf-protection|getAuth|currentUser|clerkClient|createServerClient|createServerSupabaseClient|getServerSession|getSession|auth\(\)|getToken|verifyToken|clerkMiddleware)[\s\S]){10,}?(?:\.create\s*\(|\.update\s*\(|\.delete\s*\(|\.insert\s*\(|\.upsert\s*\()/g,
334
334
  languages: ["javascript", "typescript"],
335
335
  fix: "Add CSRF token verification to state-changing endpoints.",
336
336
  fixCode: '// Verify CSRF token from header\nexport async function POST(req: Request) {\n const csrfToken = req.headers.get("x-csrf-token");\n if (!verifyCsrfToken(csrfToken)) {\n return new Response("CSRF validation failed", { status: 403 });\n }\n}',
@@ -356,7 +356,7 @@ export const advancedSecurityRules = [
356
356
  severity: "high",
357
357
  owasp: "A04:2025 Insecure Design",
358
358
  description: "Rate limiting catch block returns a permissive result (limited: false, success: true) when the rate limit backend (Redis) fails. If Redis goes down, all rate limits are disabled.",
359
- pattern: /catch\s*\([^)]*\)\s*\{[\s\S]{0,200}?(?:limited\s*:\s*false|success\s*:\s*true|allowed\s*:\s*true|return\s+(?:false|null|undefined)\s*;?\s*\})/g,
359
+ pattern: /(?:rateLimit|rateLimiter|limiter|Ratelimit)[\s\S]{0,500}?catch\s*\([^)]*\)\s*\{[\s\S]{0,200}?(?:limited\s*:\s*false|success\s*:\s*true|allowed\s*:\s*true)/g,
360
360
  languages: ["javascript", "typescript"],
361
361
  fix: "Fail closed: when the rate limiter backend is unavailable, deny the request.",
362
362
  fixCode: '// BAD: fail-open\ncatch (error) { return { limited: false }; }\n\n// GOOD: fail-closed\ncatch (error) {\n console.error("Rate limiter unavailable:", error);\n return { limited: true };\n}',
@@ -527,7 +527,7 @@ export const modernStackRules = [
527
527
  severity: "critical",
528
528
  owasp: "A03:2025 Injection",
529
529
  description: "User input is interpolated into a Supabase .or() filter string via template literal or concatenation. This is equivalent to SQL injection for PostgREST — attackers can modify filter logic to access unauthorized data.",
530
- pattern: /\.or\s*\(\s*(?:`[^`]*\$\{)|\.or\s*\(\s*\w+\s*\)|["'][^"']*["']\s*\+\s*\w+(?:Id|Name|Term|Input)\b[\s\S]{0,100}?\.or\s*\(/gi,
530
+ pattern: /\.or\s*\(\s*(?:`[^`]*\$\{(?!(?:sfv|sanitize|escape|validate|encodeURIComponent)\s*\())|\.or\s*\(\s*\w+\s*\)|["'][^"']*["']\s*\+\s*\w+(?:Id|Name|Term|Input)\b[\s\S]{0,100}?\.or\s*\(/gi,
531
531
  languages: ["javascript", "typescript"],
532
532
  fix: "Never interpolate user input into .or() strings. Use separate .eq() filters or build the filter from validated enum values.",
533
533
  fixCode: '// BAD: filter injection\n.or(`sender_id.eq.${userId},receiver_id.eq.${userId}`)\n\n// GOOD: use server-verified auth ID\nconst { data: { user } } = await supabase.auth.getUser();\n.or(`sender_id.eq.${user.id},receiver_id.eq.${user.id}`)\n\n// BEST: use RLS policies instead of client-side filtering',
@@ -5,18 +5,23 @@ import { loadIgnoreFile, isIgnored } from "../utils/ignore.js";
5
5
  import { securityBanner } from "../utils/banner.js";
6
6
  function parseSuppressionsFromCode(lines) {
7
7
  const suppressions = [];
8
- const pattern = /(?:\/\/|#|<!--)\s*guardvibe-ignore(?:-next-line)?\s*(VG\d+)?\s*(?:-->)?/i;
8
+ const pattern = /(?:\/\/|#|<!--)\s*guardvibe-ignore(?:-next-line)?\s*(VG\d+)?(?:\s.*)?(?:-->)?/i;
9
9
  for (let i = 0; i < lines.length; i++) {
10
10
  const match = pattern.exec(lines[i]);
11
11
  if (!match)
12
12
  continue;
13
13
  const ruleId = match[1] || null;
14
14
  const isNextLine = lines[i].includes("guardvibe-ignore-next-line");
15
+ const isCommentOnlyLine = /^\s*(?:\/\/|#|<!--)/.test(lines[i]);
15
16
  if (isNextLine) {
16
- suppressions.push({ line: i + 2, ruleId }); // next line (1-indexed)
17
+ suppressions.push({ line: i + 2, ruleId });
18
+ }
19
+ else if (isCommentOnlyLine) {
20
+ suppressions.push({ line: i + 1, ruleId });
21
+ suppressions.push({ line: i + 2, ruleId });
17
22
  }
18
23
  else {
19
- suppressions.push({ line: i + 1, ruleId }); // same line (1-indexed)
24
+ suppressions.push({ line: i + 1, ruleId });
20
25
  }
21
26
  }
22
27
  return suppressions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guardvibe",
3
- "version": "3.0.18",
3
+ "version": "3.0.20",
4
4
  "mcpName": "io.github.goklab/guardvibe",
5
5
  "description": "Security MCP for vibe coding. 335 rules, 36 tools, CLI + doctor. Host security, auth coverage mapping, LLM-powered deep scan (IDOR/business logic), taint analysis. Plus Next.js, Supabase, Clerk, Stripe, Prisma, tRPC, Hono, GraphQL, Convex, Turso, Uploadthing, AI SDK, and the full AI-generated stack.",
6
6
  "type": "module",