guardvibe 3.0.31 → 3.0.33
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.
|
@@ -29,7 +29,7 @@ export const dockerfileRules = [
|
|
|
29
29
|
severity: "medium",
|
|
30
30
|
owasp: "A03:2025 Software Supply Chain Failures",
|
|
31
31
|
description: "Using :latest tag or no tag makes builds non-reproducible and vulnerable to supply chain attacks.",
|
|
32
|
-
pattern:
|
|
32
|
+
pattern: /^FROM\s+[^\s:@]+(?::latest)?(?=\s)/gim,
|
|
33
33
|
languages: ["dockerfile"],
|
|
34
34
|
fix: "Pin to a specific version tag: FROM node:20-alpine instead of FROM node:latest.",
|
|
35
35
|
fixCode: "# Pin to specific version\nFROM node:20-alpine\n# Not: FROM node:latest\n# Not: FROM node",
|
|
@@ -179,7 +179,7 @@ export const webSecurityRules = [
|
|
|
179
179
|
severity: "high",
|
|
180
180
|
owasp: "A05:2021 Security Misconfiguration",
|
|
181
181
|
description: "Response serving user-uploaded files does not set X-Content-Type-Options: nosniff. Browsers may MIME-sniff the content and execute uploaded files as HTML/JavaScript, enabling stored XSS via file uploads.",
|
|
182
|
-
pattern: /(?:createReadStream|
|
|
182
|
+
pattern: /(?:res\.sendFile|res\.download|createReadStream|getSignedUrl|getPublicUrl|\.pipe\s*\(\s*res)[\s\S]{0,500}?(?:(?!X-Content-Type-Options|nosniff)[\s\S]){10,}?(?:res\.end|\.pipe|return|response)/gi,
|
|
183
183
|
languages: ["javascript", "typescript"],
|
|
184
184
|
fix: "Set X-Content-Type-Options: nosniff on all responses serving user-uploaded content.",
|
|
185
185
|
fixCode: '// Set nosniff header for uploaded file responses\nres.setHeader("X-Content-Type-Options", "nosniff");\nres.setHeader("Content-Disposition", "attachment"); // force download for unknown types\nres.sendFile(filePath);',
|
|
@@ -335,6 +335,15 @@ export function analyzeCode(code, language, framework, filePath, configDir, rule
|
|
|
335
335
|
const isWebhookRoute = filePath && /webhook/i.test(filePath);
|
|
336
336
|
const isCronRoute = filePath && /(?:cron|scheduled|jobs?)\//i.test(filePath);
|
|
337
337
|
const isAdminRoute = filePath && /\/admin\//i.test(filePath);
|
|
338
|
+
// Skip rate-limit rules when the file installs a global rate limiter via app.use().
|
|
339
|
+
// Covers `app.use(rateLimit({...}))`, `app.use(limiter)`, `app.use('/api', rateLimit({...}))`,
|
|
340
|
+
// and named middleware vars matching limiter naming conventions.
|
|
341
|
+
if (rateLimitRuleIds.has(rule.id)) {
|
|
342
|
+
const hasGlobalRateLimit = /(?:app|router)\.use\s*\(\s*(?:[^,)]*,\s*)?(?:rateLimit|slowDown|expressRateLimit|expressSlowDown|RateLimit|Throttle|throttle)\s*\(/i.test(code) ||
|
|
343
|
+
/(?:app|router)\.use\s*\(\s*(?:[^,)]*,\s*)?\w*(?:[Ll]imiter|[Tt]hrottle|[Rr]ate[Ll]imit|[Ss]low[Dd]own|[Bb]rute)\w*\s*\)/.test(code);
|
|
344
|
+
if (hasGlobalRateLimit)
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
338
347
|
// Skip auth rules when code has any auth guard pattern (naming-agnostic)
|
|
339
348
|
if (codeHasAuthGuard && authRuleIds.has(rule.id))
|
|
340
349
|
continue;
|
|
@@ -597,7 +606,8 @@ export function analyzeCode(code, language, framework, filePath, configDir, rule
|
|
|
597
606
|
const hasPublishingFields = /"(?:bin|exports|module|types|typings)"\s*:/i.test(code);
|
|
598
607
|
const mainPointsToBuild = /"main"\s*:\s*"(?:dist|build|lib|out)\//i.test(code);
|
|
599
608
|
const runtimeNames = "node|nodemon|tsx|ts-node|next|nest|vite|remix|astro";
|
|
600
|
-
|
|
609
|
+
// Allow leading env-var assignments: NODE_OPTIONS=..., NODE_ENV=production, PORT=3000, etc.
|
|
610
|
+
const startsAsApp = new RegExp('"start"\\s*:\\s*"(?:[A-Z_][A-Z0-9_]*=\\S+\\s+)*(?:' + runtimeNames + ')\\b', "i").test(code);
|
|
601
611
|
if (!hasPublishingFields && !mainPointsToBuild && startsAsApp)
|
|
602
612
|
continue;
|
|
603
613
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "guardvibe",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.33",
|
|
4
4
|
"mcpName": "io.github.goklab/guardvibe",
|
|
5
5
|
"description": "Security MCP for vibe coding. 365 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",
|