guardvibe 0.4.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/LICENSE +21 -0
- package/README.md +205 -0
- package/build/cli.d.ts +3 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +118 -0
- package/build/cli.js.map +1 -0
- package/build/data/framework-guides.d.ts +8 -0
- package/build/data/framework-guides.d.ts.map +1 -0
- package/build/data/framework-guides.js +500 -0
- package/build/data/framework-guides.js.map +1 -0
- package/build/data/owasp-rules.d.ts +12 -0
- package/build/data/owasp-rules.d.ts.map +1 -0
- package/build/data/owasp-rules.js +469 -0
- package/build/data/owasp-rules.js.map +1 -0
- package/build/data/rules/core.d.ts +3 -0
- package/build/data/rules/core.d.ts.map +1 -0
- package/build/data/rules/core.js +245 -0
- package/build/data/rules/core.js.map +1 -0
- package/build/data/rules/go.d.ts +3 -0
- package/build/data/rules/go.d.ts.map +1 -0
- package/build/data/rules/go.js +64 -0
- package/build/data/rules/go.js.map +1 -0
- package/build/data/rules/index.d.ts +3 -0
- package/build/data/rules/index.d.ts.map +1 -0
- package/build/data/rules/index.js +13 -0
- package/build/data/rules/index.js.map +1 -0
- package/build/data/rules/java.d.ts +3 -0
- package/build/data/rules/java.d.ts.map +1 -0
- package/build/data/rules/java.js +64 -0
- package/build/data/rules/java.js.map +1 -0
- package/build/data/rules/php.d.ts +3 -0
- package/build/data/rules/php.d.ts.map +1 -0
- package/build/data/rules/php.js +54 -0
- package/build/data/rules/php.js.map +1 -0
- package/build/data/rules/ruby.d.ts +3 -0
- package/build/data/rules/ruby.d.ts.map +1 -0
- package/build/data/rules/ruby.js +54 -0
- package/build/data/rules/ruby.js.map +1 -0
- package/build/data/rules/types.d.ts +11 -0
- package/build/data/rules/types.d.ts.map +1 -0
- package/build/data/rules/types.js +2 -0
- package/build/data/rules/types.js.map +1 -0
- package/build/data/secret-patterns.d.ts +9 -0
- package/build/data/secret-patterns.d.ts.map +1 -0
- package/build/data/secret-patterns.js +87 -0
- package/build/data/secret-patterns.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +117 -0
- package/build/index.js.map +1 -0
- package/build/tools/check-code.d.ts +9 -0
- package/build/tools/check-code.d.ts.map +1 -0
- package/build/tools/check-code.js +125 -0
- package/build/tools/check-code.js.map +1 -0
- package/build/tools/check-deps.d.ts +8 -0
- package/build/tools/check-deps.d.ts.map +1 -0
- package/build/tools/check-deps.js +57 -0
- package/build/tools/check-deps.js.map +1 -0
- package/build/tools/check-project.d.ts +7 -0
- package/build/tools/check-project.d.ts.map +1 -0
- package/build/tools/check-project.js +134 -0
- package/build/tools/check-project.js.map +1 -0
- package/build/tools/get-security-docs.d.ts +2 -0
- package/build/tools/get-security-docs.d.ts.map +1 -0
- package/build/tools/get-security-docs.js +61 -0
- package/build/tools/get-security-docs.js.map +1 -0
- package/build/tools/scan-dependencies.d.ts +2 -0
- package/build/tools/scan-dependencies.d.ts.map +1 -0
- package/build/tools/scan-dependencies.js +69 -0
- package/build/tools/scan-dependencies.js.map +1 -0
- package/build/tools/scan-directory.d.ts +2 -0
- package/build/tools/scan-directory.d.ts.map +1 -0
- package/build/tools/scan-directory.js +120 -0
- package/build/tools/scan-directory.js.map +1 -0
- package/build/tools/scan-secrets.d.ts +11 -0
- package/build/tools/scan-secrets.d.ts.map +1 -0
- package/build/tools/scan-secrets.js +150 -0
- package/build/tools/scan-secrets.js.map +1 -0
- package/build/utils/manifest-parser.d.ts +7 -0
- package/build/utils/manifest-parser.d.ts.map +1 -0
- package/build/utils/manifest-parser.js +102 -0
- package/build/utils/manifest-parser.js.map +1 -0
- package/build/utils/osv-client.d.ts +37 -0
- package/build/utils/osv-client.d.ts.map +1 -0
- package/build/utils/osv-client.js +78 -0
- package/build/utils/osv-client.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// Security detection patterns - these RegExps match VULNERABLE code patterns
|
|
2
|
+
// that VibeGuard flags to users. The patterns themselves are safe detectors.
|
|
3
|
+
export const coreRules = [
|
|
4
|
+
{
|
|
5
|
+
id: "VG001",
|
|
6
|
+
name: "Hardcoded credentials",
|
|
7
|
+
severity: "critical",
|
|
8
|
+
owasp: "A01:2025 Broken Access Control",
|
|
9
|
+
description: "Hardcoded passwords, API keys, or secrets detected in source code.",
|
|
10
|
+
pattern: /(?:secret_?key|api_?key|api_?secret|private_?key|access_?key|password|passwd|pwd|secret|token|auth_?token)\w*\s*[:=]\s*['"][^'"]{3,}['"]/gi,
|
|
11
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
12
|
+
fix: "Use environment variables (process.env.SECRET) or a secrets manager. Never commit credentials to source code.",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "VG003",
|
|
16
|
+
name: "Cloud provider API key",
|
|
17
|
+
severity: "critical",
|
|
18
|
+
owasp: "A01:2025 Broken Access Control",
|
|
19
|
+
description: "Cloud provider API key or token pattern detected in source code (AWS, GitHub, OpenAI, Stripe).",
|
|
20
|
+
pattern: /(?:AKIA[0-9A-Z]{16}|(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}|sk-[A-Za-z0-9]{20,}|sk_live_[A-Za-z0-9]{20,})/g,
|
|
21
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby", "html", "shell"],
|
|
22
|
+
fix: "Remove hardcoded keys immediately. Use environment variables or a secrets manager (AWS Secrets Manager, Vault). Rotate any compromised keys.",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "VG002",
|
|
26
|
+
name: "Missing authentication check",
|
|
27
|
+
severity: "high",
|
|
28
|
+
owasp: "A01:2025 Broken Access Control",
|
|
29
|
+
description: "API route handler without authentication middleware or auth check.",
|
|
30
|
+
pattern: /(?:app|router)\.(get|post|put|delete|patch)\s*\(\s*['"][^'"]*['"]\s*,\s*(?:async\s+)?\(?(?:req|request)/gi,
|
|
31
|
+
languages: ["javascript", "typescript"],
|
|
32
|
+
fix: "Add authentication middleware before route handlers: app.get('/api/data', authMiddleware, handler). Use frameworks like Passport.js, Clerk, or Auth0.",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "VG005",
|
|
36
|
+
name: "Missing authentication check",
|
|
37
|
+
severity: "high",
|
|
38
|
+
owasp: "A01:2025 Broken Access Control",
|
|
39
|
+
description: "Python API route without authentication dependency or decorator.",
|
|
40
|
+
pattern: /@app\.(?:get|post|put|delete|patch)\s*\(\s*['"]\/(?:api|users|admin|account|dashboard|settings|login)/gi,
|
|
41
|
+
languages: ["python"],
|
|
42
|
+
fix: "Add authentication dependency: async def route(user = Depends(get_current_user)). Use FastAPI's Depends() or Flask-Login for auth checks.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "VG010",
|
|
46
|
+
name: "SQL injection risk",
|
|
47
|
+
severity: "critical",
|
|
48
|
+
owasp: "A02:2025 Injection",
|
|
49
|
+
description: "String concatenation, template literals, or f-strings used in SQL queries. This allows SQL injection attacks.",
|
|
50
|
+
pattern: /(?:query|execute|raw|sql)\s*\(\s*(?:`[^`]*\$\{|['"][^'"]*['"]\s*\+\s*|f"[^"]*\{|f'[^']*\{|['"][^'"]*['"]\s*%\s*|['"][^'"]*['"]\s*\.format\s*\(|['"][^'"]*['"]\s*,\s*(?:req\.|request\.|params\.|body\.|args))/gi,
|
|
51
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
52
|
+
fix: "Use parameterized queries: db.query('SELECT * FROM users WHERE id = $1', [userId]). Python: cursor.execute('SELECT * FROM users WHERE id = %s', (user_id,)). Never concatenate user input into SQL strings.",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "VG011",
|
|
56
|
+
name: "Command injection risk",
|
|
57
|
+
severity: "critical",
|
|
58
|
+
owasp: "A02:2025 Injection",
|
|
59
|
+
description: "User input passed to shell command functions. This allows arbitrary command execution.",
|
|
60
|
+
pattern: /(?:exec(?:Sync)?|spawn(?:Sync)?|system|popen|subprocess\.(?:call|run|Popen))\s*\(\s*(?:`[^`]*\$\{|['"][^'"]*['"]\s*\+|f['"][^'"]*\{|.*(?:req\.|request\.|params\.|body\.|input|argv))/gi,
|
|
61
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby", "shell"],
|
|
62
|
+
fix: "Avoid shell commands with user input. Use allowlists and input validation. Prefer spawn() with array arguments. Python: use subprocess.run([...]) with list arguments, never shell=True with user input.",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "VG012",
|
|
66
|
+
name: "XSS via innerHTML",
|
|
67
|
+
severity: "high",
|
|
68
|
+
owasp: "A02:2025 Injection",
|
|
69
|
+
description: "Setting innerHTML with dynamic content enables Cross-Site Scripting (XSS) attacks.",
|
|
70
|
+
pattern: /(?:innerHTML|outerHTML|dangerouslySetInnerHTML)\s*(?:=|:)\s*(?!['"]<)/gi,
|
|
71
|
+
languages: ["javascript", "typescript", "html"],
|
|
72
|
+
fix: "Use textContent instead of innerHTML. Sanitize with DOMPurify if HTML rendering is needed. In React, avoid dangerouslySetInnerHTML.",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "VG015",
|
|
76
|
+
name: "XSS via server response",
|
|
77
|
+
severity: "high",
|
|
78
|
+
owasp: "A02:2025 Injection",
|
|
79
|
+
description: "User input embedded in HTML response via template literals or string concatenation enables Cross-Site Scripting.",
|
|
80
|
+
pattern: /res\.(?:send|write|end)\s*\(\s*(?:`[^`]*\$\{|['"][^'"]*['"]\s*\+)/gi,
|
|
81
|
+
languages: ["javascript", "typescript"],
|
|
82
|
+
fix: "Use a template engine with auto-escaping (EJS, Handlebars), or sanitize output with the 'escape-html' package. Never embed user input directly in HTML responses.",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "VG013",
|
|
86
|
+
name: "NoSQL injection risk",
|
|
87
|
+
severity: "high",
|
|
88
|
+
owasp: "A02:2025 Injection",
|
|
89
|
+
description: "User input passed directly to MongoDB/NoSQL query operators.",
|
|
90
|
+
pattern: /(?:find|findOne|updateOne|deleteOne|aggregate)\s*\(\s*\{[^}]*(?:req\.|request\.|body\.|params\.)/gi,
|
|
91
|
+
languages: ["javascript", "typescript"],
|
|
92
|
+
fix: "Validate and sanitize input before using in queries. Use mongoose schema validation. Reject objects where strings are expected.",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "VG014",
|
|
96
|
+
name: "Dynamic code execution",
|
|
97
|
+
severity: "critical",
|
|
98
|
+
owasp: "A02:2025 Injection",
|
|
99
|
+
description: "Dynamic code execution function detected. This can run arbitrary code and is a major security risk.",
|
|
100
|
+
pattern: /\beval\s*\(/gi,
|
|
101
|
+
languages: ["javascript", "typescript", "python", "php", "ruby"],
|
|
102
|
+
fix: "Avoid dynamic code execution. Use JSON.parse() for JSON data. Use a sandboxed environment if absolutely required.",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "VG020",
|
|
106
|
+
name: "Wildcard dependency version",
|
|
107
|
+
severity: "medium",
|
|
108
|
+
owasp: "A03:2025 Software Supply Chain Failures",
|
|
109
|
+
description: "Using '*' or overly broad version ranges in package.json allows untested dependency updates.",
|
|
110
|
+
pattern: /["']\*["']|["']>=\d/gi,
|
|
111
|
+
languages: ["javascript", "typescript"],
|
|
112
|
+
fix: "Pin dependencies to specific versions or use caret ranges (^1.2.3). Run npm audit regularly.",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "VG030",
|
|
116
|
+
name: "Missing rate limiting",
|
|
117
|
+
severity: "medium",
|
|
118
|
+
owasp: "A04:2025 Insecure Design",
|
|
119
|
+
description: "Authentication or API endpoints without rate limiting are vulnerable to brute force attacks.",
|
|
120
|
+
pattern: /(?:\/login|\/auth|\/api\/|\/signin|\/register|\/signup|\/forgot-password)/gi,
|
|
121
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
122
|
+
fix: "Add rate limiting middleware. Express: npm install express-rate-limit. FastAPI: use slowapi. Apply stricter limits on auth endpoints (e.g. 5 requests/minute).",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "VG040",
|
|
126
|
+
name: "CORS wildcard",
|
|
127
|
+
severity: "high",
|
|
128
|
+
owasp: "A05:2025 Security Misconfiguration",
|
|
129
|
+
description: "CORS configured with wildcard (*) origin allows any website to make requests to your API.",
|
|
130
|
+
pattern: /(?:(?:cors|Access-Control-Allow-Origin)['"]?\]?\s*[:=(]\s*['"]?\s*\*|origin\s*:\s*['"]?\s*\*\s*['"]?|CORS_ORIGINS['"]?\]?\s*=\s*['"]?\s*\*)/gi,
|
|
131
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
132
|
+
fix: "Set specific allowed origins: cors({ origin: ['https://myapp.com'] }). Never use wildcard with authentication.",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "VG041",
|
|
136
|
+
name: "Debug mode in production",
|
|
137
|
+
severity: "medium",
|
|
138
|
+
owasp: "A05:2025 Security Misconfiguration",
|
|
139
|
+
description: "Debug mode or verbose error messages exposed in production.",
|
|
140
|
+
pattern: /(?:DEBUG\s*[:=]\s*['"]?(?:true|\*)|console\.log\(.*(?:password|token|secret|key))/gi,
|
|
141
|
+
languages: ["javascript", "typescript", "python"],
|
|
142
|
+
fix: "Disable debug mode in production. Never expose stack traces to users.",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: "VG042",
|
|
146
|
+
name: "Missing security headers",
|
|
147
|
+
severity: "medium",
|
|
148
|
+
owasp: "A05:2025 Security Misconfiguration",
|
|
149
|
+
description: "Express app without security headers (helmet).",
|
|
150
|
+
pattern: /(?:express\(\))|(?:createServer\s*\()/gi,
|
|
151
|
+
languages: ["javascript", "typescript"],
|
|
152
|
+
fix: "Use helmet middleware: npm install helmet, then app.use(helmet()).",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "VG060",
|
|
156
|
+
name: "Weak password hashing",
|
|
157
|
+
severity: "critical",
|
|
158
|
+
owasp: "A07:2025 Auth Failures",
|
|
159
|
+
description: "Using MD5 or SHA-1 for password hashing. These are fast hashes, not designed for passwords.",
|
|
160
|
+
pattern: /(?:md5|sha1|sha-1|createHash\s*\(\s*['"](?:md5|sha1)['"]\s*\))/gi,
|
|
161
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
162
|
+
fix: "Use bcrypt, scrypt, or argon2 for password hashing. Use at least 12 salt rounds.",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: "VG061",
|
|
166
|
+
name: "JWT without expiry",
|
|
167
|
+
severity: "high",
|
|
168
|
+
owasp: "A07:2025 Auth Failures",
|
|
169
|
+
description: "JWT token created without expiration time.",
|
|
170
|
+
pattern: /jwt\.sign\s*\([^)]*(?!\bexpiresIn\b)[^)]*\)/gi,
|
|
171
|
+
languages: ["javascript", "typescript"],
|
|
172
|
+
fix: "Always set token expiration: jwt.sign(payload, secret, { expiresIn: '15m' }).",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "VG070",
|
|
176
|
+
name: "Insecure deserialization",
|
|
177
|
+
severity: "high",
|
|
178
|
+
owasp: "A08:2025 Data Integrity Failures",
|
|
179
|
+
description: "Deserializing untrusted data can lead to remote code execution.",
|
|
180
|
+
pattern: /(?:JSON\.parse\s*\(\s*(?:req\.|request\.|body))/gi,
|
|
181
|
+
languages: ["javascript", "typescript", "python"],
|
|
182
|
+
fix: "Validate all deserialized data with a schema (zod, joi) before processing.",
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: "VG080",
|
|
186
|
+
name: "Sensitive data in logs",
|
|
187
|
+
severity: "medium",
|
|
188
|
+
owasp: "A09:2025 Logging Failures",
|
|
189
|
+
description: "Logging sensitive information like passwords, tokens, or personal data.",
|
|
190
|
+
pattern: /(?:console\.log|logger\.\w+|print)\s*\([^)]*(?:password|token|secret|ssn|credit.?card|api.?key)/gi,
|
|
191
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
192
|
+
fix: "Never log sensitive data. Redact or mask sensitive fields before logging.",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: "VG090",
|
|
196
|
+
name: "SSRF risk",
|
|
197
|
+
severity: "high",
|
|
198
|
+
owasp: "A10:2025 SSRF",
|
|
199
|
+
description: "User-supplied URLs passed to fetch/request functions can be used for SSRF attacks.",
|
|
200
|
+
pattern: /(?:fetch|axios|request|http\.get|urllib|requests\.get)\s*\(\s*(?:req\.|request\.|body\.|params\.|query\.|input|url|href)/gi,
|
|
201
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
202
|
+
fix: "Validate and allowlist URLs before making requests. Block internal IP ranges.",
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: "VG100",
|
|
206
|
+
name: "Insecure cookie configuration",
|
|
207
|
+
severity: "medium",
|
|
208
|
+
owasp: "A05:2025 Security Misconfiguration",
|
|
209
|
+
description: "Cookies set without secure, httpOnly, or sameSite flags.",
|
|
210
|
+
pattern: /(?:cookie|setCookie|set-cookie|res\.cookie)\s*\([^)]*(?!(?:.*secure|.*httpOnly|.*sameSite))/gi,
|
|
211
|
+
languages: ["javascript", "typescript"],
|
|
212
|
+
fix: "Set all security flags: { secure: true, httpOnly: true, sameSite: 'strict' }.",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: "VG101",
|
|
216
|
+
name: "Unvalidated redirect",
|
|
217
|
+
severity: "medium",
|
|
218
|
+
owasp: "A01:2025 Broken Access Control",
|
|
219
|
+
description: "Redirect URL taken from user input without validation.",
|
|
220
|
+
pattern: /(?:redirect|location\.href|window\.location)\s*(?:=|\()\s*(?:req\.|request\.|params\.|query\.|body\.)/gi,
|
|
221
|
+
languages: ["javascript", "typescript"],
|
|
222
|
+
fix: "Validate redirect URLs against an allowlist. Use relative paths for internal redirects.",
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: "VG102",
|
|
226
|
+
name: "File path traversal risk",
|
|
227
|
+
severity: "high",
|
|
228
|
+
owasp: "A01:2025 Broken Access Control",
|
|
229
|
+
description: "User input used in file paths without sanitization.",
|
|
230
|
+
pattern: /(?:readFile|readFileSync|createReadStream|open|path\.join|path\.resolve)\s*\([^)]*(?:req\.|request\.|params\.|body\.|query\.)/gi,
|
|
231
|
+
languages: ["javascript", "typescript", "python", "go", "java", "php", "ruby"],
|
|
232
|
+
fix: "Sanitize file paths: remove ../ sequences, verify the result is within the expected directory.",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "VG103",
|
|
236
|
+
name: "Prototype pollution risk",
|
|
237
|
+
severity: "high",
|
|
238
|
+
owasp: "A02:2025 Injection",
|
|
239
|
+
description: "Deep merge or object assignment from user input can lead to prototype pollution.",
|
|
240
|
+
pattern: /(?:Object\.assign|merge|deepMerge|extend)\s*\([^)]*(?:req\.|request\.|body|params)/gi,
|
|
241
|
+
languages: ["javascript", "typescript"],
|
|
242
|
+
fix: "Use Object.create(null) for lookup objects. Validate that keys don't include __proto__, constructor, or prototype.",
|
|
243
|
+
},
|
|
244
|
+
];
|
|
245
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/data/rules/core.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,uBAAuB;QAC7B,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,gCAAgC;QACvC,WAAW,EAAE,oEAAoE;QACjF,OAAO,EACL,4IAA4I;QAC9I,SAAS,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM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AAC;QACvC,GAAG,EAAE,oHAAoH;KAC1H;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../../src/data/rules/go.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,eAAO,MAAM,OAAO,EAAE,YAAY,EAmEjC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// === Go-specific rules ===
|
|
2
|
+
export const goRules = [
|
|
3
|
+
{
|
|
4
|
+
id: "VG110",
|
|
5
|
+
name: "Go SQL injection via fmt.Sprintf",
|
|
6
|
+
severity: "critical",
|
|
7
|
+
owasp: "A02:2025 Injection",
|
|
8
|
+
description: "Using fmt.Sprintf to build SQL queries allows SQL injection attacks.",
|
|
9
|
+
pattern: /(?:db\.(?:Query|Exec|QueryRow)|\.Query|\.Exec)\s*\(\s*fmt\.Sprintf/gi,
|
|
10
|
+
languages: ["go"],
|
|
11
|
+
fix: "Use parameterized queries: db.Query('SELECT * FROM users WHERE id = $1', id). Never use fmt.Sprintf for SQL.",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "VG111",
|
|
15
|
+
name: "Go command injection via os/exec",
|
|
16
|
+
severity: "critical",
|
|
17
|
+
owasp: "A02:2025 Injection",
|
|
18
|
+
description: "User input passed to os/exec command functions allows arbitrary command execution.",
|
|
19
|
+
pattern: /exec\.Command\s*\(\s*(?:fmt\.Sprintf|[^")\s]+\s*\+|[^")]*\+)/gi,
|
|
20
|
+
languages: ["go"],
|
|
21
|
+
fix: "Validate and sanitize all input before passing to exec.Command. Use an allowlist of permitted commands.",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "VG112",
|
|
25
|
+
name: "Go unescaped HTML template",
|
|
26
|
+
severity: "high",
|
|
27
|
+
owasp: "A02:2025 Injection",
|
|
28
|
+
description: "Using template.HTML() bypasses Go's automatic HTML escaping, enabling XSS.",
|
|
29
|
+
pattern: /template\.HTML\s*\(/gi,
|
|
30
|
+
languages: ["go"],
|
|
31
|
+
fix: "Avoid template.HTML() with user input. Use html/template which auto-escapes by default.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "VG113",
|
|
35
|
+
name: "Go HTTP handler without auth",
|
|
36
|
+
severity: "high",
|
|
37
|
+
owasp: "A01:2025 Broken Access Control",
|
|
38
|
+
description: "HTTP handler registered without authentication middleware.",
|
|
39
|
+
pattern: /(?:http\.HandleFunc|mux\.HandleFunc|\.HandleFunc)\s*\(\s*['"]\/(?:api|admin|users|account|dashboard)/gi,
|
|
40
|
+
languages: ["go"],
|
|
41
|
+
fix: "Wrap handlers with authentication middleware: http.Handle('/api/', authMiddleware(handler)).",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "VG114",
|
|
45
|
+
name: "Go weak hashing",
|
|
46
|
+
severity: "critical",
|
|
47
|
+
owasp: "A07:2025 Auth Failures",
|
|
48
|
+
description: "Using md5 or sha1 for hashing. These are cryptographically broken for security purposes.",
|
|
49
|
+
pattern: /(?:md5\.New|sha1\.New|md5\.Sum|sha1\.Sum)\s*\(/gi,
|
|
50
|
+
languages: ["go"],
|
|
51
|
+
fix: "Use crypto/sha256 or golang.org/x/crypto/bcrypt for password hashing.",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "VG115",
|
|
55
|
+
name: "Go CORS wildcard",
|
|
56
|
+
severity: "high",
|
|
57
|
+
owasp: "A05:2025 Security Misconfiguration",
|
|
58
|
+
description: "CORS configured with wildcard origin allows any website to access your API.",
|
|
59
|
+
pattern: /(?:Access-Control-Allow-Origin|AllowOrigins|allowOrigins)['"]?\]?\s*[:=,]\s*['"]?\s*\*/gi,
|
|
60
|
+
languages: ["go"],
|
|
61
|
+
fix: "Set specific allowed origins instead of wildcard '*'.",
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
//# sourceMappingURL=go.js.map
|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AS,EAAE,CAAC,IAAI,CAAC;QACjB,GAAG,EAAE,uEAAuE;KAC7E;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,oCAAoC;QAC3C,WAAW,EACT,6EAA6E;QAC/E,OAAO,EAAE,0FAA0F;QACnG,SAAS,EAAE,CAAC,IAAI,CAAC;QACjB,GAAG,EAAE,uDAAuD;KAC7D;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/rules/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO/C,eAAO,MAAM,UAAU,qCAMtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { coreRules } from "./core.js";
|
|
2
|
+
import { goRules } from "./go.js";
|
|
3
|
+
import { javaRules } from "./java.js";
|
|
4
|
+
import { phpRules } from "./php.js";
|
|
5
|
+
import { rubyRules } from "./ruby.js";
|
|
6
|
+
export const owaspRules = [
|
|
7
|
+
...coreRules,
|
|
8
|
+
...goRules,
|
|
9
|
+
...javaRules,
|
|
10
|
+
...phpRules,
|
|
11
|
+
...rubyRules,
|
|
12
|
+
];
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/rules/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,SAAS;IACZ,GAAG,OAAO;IACV,GAAG,SAAS;IACZ,GAAG,QAAQ;IACX,GAAG,SAAS;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"java.d.ts","sourceRoot":"","sources":["../../../src/data/rules/java.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,eAAO,MAAM,SAAS,EAAE,YAAY,EAmEnC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// === Java-specific rules ===
|
|
2
|
+
export const javaRules = [
|
|
3
|
+
{
|
|
4
|
+
id: "VG120",
|
|
5
|
+
name: "Java SQL injection via string concat",
|
|
6
|
+
severity: "critical",
|
|
7
|
+
owasp: "A02:2025 Injection",
|
|
8
|
+
description: "String concatenation in SQL queries allows SQL injection attacks.",
|
|
9
|
+
pattern: /(?:executeQuery|executeUpdate|prepareStatement|createQuery|createNativeQuery)\s*\(\s*['"][^'"]*['"]\s*\+/gi,
|
|
10
|
+
languages: ["java"],
|
|
11
|
+
fix: "Use PreparedStatement with parameter binding: stmt.setString(1, userInput). Never concatenate strings into SQL.",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "VG121",
|
|
15
|
+
name: "Java command injection",
|
|
16
|
+
severity: "critical",
|
|
17
|
+
owasp: "A02:2025 Injection",
|
|
18
|
+
description: "User input passed to Runtime.exec() allows arbitrary command execution.",
|
|
19
|
+
pattern: /Runtime\.getRuntime\(\)\.exec\s*\(\s*(?:[^")]*\+|.*(?:request|param|input|args))/gi,
|
|
20
|
+
languages: ["java"],
|
|
21
|
+
fix: "Use ProcessBuilder with a list of arguments. Validate input against an allowlist.",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "VG122",
|
|
25
|
+
name: "Java XSS via JSP",
|
|
26
|
+
severity: "high",
|
|
27
|
+
owasp: "A02:2025 Injection",
|
|
28
|
+
description: "Unescaped output in JSP pages enables Cross-Site Scripting attacks.",
|
|
29
|
+
pattern: /<%=\s*(?:request\.getParameter|session\.getAttribute)/gi,
|
|
30
|
+
languages: ["java"],
|
|
31
|
+
fix: "Use JSTL <c:out> tag or fn:escapeXml() for output encoding. Never use <%= with user input.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "VG123",
|
|
35
|
+
name: "Java endpoint without auth annotation",
|
|
36
|
+
severity: "high",
|
|
37
|
+
owasp: "A01:2025 Broken Access Control",
|
|
38
|
+
description: "Spring endpoint without security annotation may be publicly accessible.",
|
|
39
|
+
pattern: /@(?:RequestMapping|GetMapping|PostMapping|PutMapping|DeleteMapping)\s*\([^)]*(?:\/api|\/admin|\/users|\/account)/gi,
|
|
40
|
+
languages: ["java"],
|
|
41
|
+
fix: "Add @PreAuthorize, @Secured, or @RolesAllowed annotation to protect endpoints.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "VG124",
|
|
45
|
+
name: "Java weak hashing",
|
|
46
|
+
severity: "critical",
|
|
47
|
+
owasp: "A07:2025 Auth Failures",
|
|
48
|
+
description: "Using MessageDigest with MD5 or SHA-1. These are cryptographically weak for passwords.",
|
|
49
|
+
pattern: /MessageDigest\.getInstance\s*\(\s*['"](?:MD5|SHA-?1)['"]\s*\)/gi,
|
|
50
|
+
languages: ["java"],
|
|
51
|
+
fix: "Use BCryptPasswordEncoder or Argon2PasswordEncoder for password hashing.",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "VG125",
|
|
55
|
+
name: "Java CORS wildcard",
|
|
56
|
+
severity: "high",
|
|
57
|
+
owasp: "A05:2025 Security Misconfiguration",
|
|
58
|
+
description: "Spring @CrossOrigin with wildcard allows any website to access your API.",
|
|
59
|
+
pattern: /@CrossOrigin\s*\(\s*(?:origins\s*=\s*)?['"]?\s*\*/gi,
|
|
60
|
+
languages: ["java"],
|
|
61
|
+
fix: "Set specific allowed origins in @CrossOrigin annotation.",
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
//# sourceMappingURL=java.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"java.js","sourceRoot":"","sources":["../../../src/data/rules/java.ts"],"names":[],"mappings":"AAEA,8BAA8B;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,sCAAsC;QAC5C,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,mEAAmE;QACrE,OAAO,EAAE,4GAA4G;QACrH,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,iHAAiH;KACvH;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,wBAAwB;QAC9B,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,yEAAyE;QAC3E,OAAO,EAAE,oFAAoF;QAC7F,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,mFAAmF;KACzF;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,qEAAqE;QACvE,OAAO,EAAE,yDAAyD;QAClE,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,4FAA4F;KAClG;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,uCAAuC;QAC7C,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,yEAAyE;QAC3E,OAAO,EAAE,oHAAoH;QAC7H,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,gFAAgF;KACtF;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,wFAAwF;QAC1F,OAAO,EAAE,iEAAiE;QAC1E,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,0EAA0E;KAChF;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,oBAAoB;QAC1B,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,oCAAoC;QAC3C,WAAW,EACT,0EAA0E;QAC5E,OAAO,EAAE,qDAAqD;QAC9D,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,0DAA0D;KAChE;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../../src/data/rules/php.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,eAAO,MAAM,QAAQ,EAAE,YAAY,EAwDlC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// === PHP-specific rules ===
|
|
2
|
+
export const phpRules = [
|
|
3
|
+
{
|
|
4
|
+
id: "VG130",
|
|
5
|
+
name: "PHP SQL injection via user input",
|
|
6
|
+
severity: "critical",
|
|
7
|
+
owasp: "A02:2025 Injection",
|
|
8
|
+
description: "User input ($_GET, $_POST, $_REQUEST) directly used in SQL queries enables SQL injection.",
|
|
9
|
+
pattern: /(?:mysql_query|mysqli_query|->query|->exec)\s*\([^)]*(?:\$_GET|\$_POST|\$_REQUEST|\$_COOKIE)/gi,
|
|
10
|
+
languages: ["php"],
|
|
11
|
+
fix: "Use prepared statements: $stmt = $pdo->prepare('SELECT * FROM users WHERE id = ?'); $stmt->execute([$id]);",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "VG131",
|
|
15
|
+
name: "PHP command injection",
|
|
16
|
+
severity: "critical",
|
|
17
|
+
owasp: "A02:2025 Injection",
|
|
18
|
+
description: "User input passed to shell execution functions allows arbitrary command execution.",
|
|
19
|
+
pattern: /(?:shell_exec|passthru|popen|proc_open)\s*\([^)]*(?:\$_GET|\$_POST|\$_REQUEST|\$_COOKIE|\$(?:input|cmd|command))/gi,
|
|
20
|
+
languages: ["php"],
|
|
21
|
+
fix: "Use escapeshellarg() and escapeshellcmd() for any shell input. Prefer built-in PHP functions over shell commands.",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "VG132",
|
|
25
|
+
name: "PHP XSS via echo",
|
|
26
|
+
severity: "high",
|
|
27
|
+
owasp: "A02:2025 Injection",
|
|
28
|
+
description: "Echoing user input without escaping enables Cross-Site Scripting.",
|
|
29
|
+
pattern: /(?:echo|print)\s+(?:\$_GET|\$_POST|\$_REQUEST|\$_COOKIE)/gi,
|
|
30
|
+
languages: ["php"],
|
|
31
|
+
fix: "Use htmlspecialchars($input, ENT_QUOTES, 'UTF-8') before outputting user data.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "VG133",
|
|
35
|
+
name: "PHP weak hashing",
|
|
36
|
+
severity: "critical",
|
|
37
|
+
owasp: "A07:2025 Auth Failures",
|
|
38
|
+
description: "Using md5() or sha1() for password hashing. These are not secure for passwords.",
|
|
39
|
+
pattern: /(?:md5|sha1)\s*\(\s*\$/gi,
|
|
40
|
+
languages: ["php"],
|
|
41
|
+
fix: "Use password_hash($password, PASSWORD_BCRYPT) and password_verify() for passwords.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "VG134",
|
|
45
|
+
name: "PHP dynamic code execution",
|
|
46
|
+
severity: "critical",
|
|
47
|
+
owasp: "A02:2025 Injection",
|
|
48
|
+
description: "eval() with user input allows arbitrary code execution.",
|
|
49
|
+
pattern: /eval\s*\([^)]*(?:\$_GET|\$_POST|\$_REQUEST|\$_COOKIE|\$(?:input|data|code))/gi,
|
|
50
|
+
languages: ["php"],
|
|
51
|
+
fix: "Never use eval() with user input. Refactor to use safe alternatives.",
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.js","sourceRoot":"","sources":["../../../src/data/rules/php.ts"],"names":[],"mappings":"AAEA,6BAA6B;AAC7B,MAAM,CAAC,MAAM,QAAQ,GAAmB;IACtC;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,kCAAkC;QACxC,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,2FAA2F;QAC7F,OAAO,EAAE,gGAAgG;QACzG,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,GAAG,EAAE,4GAA4G;KAClH;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,uBAAuB;QAC7B,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,oFAAoF;QACtF,OAAO,EAAE,oHAAoH;QAC7H,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,GAAG,EAAE,mHAAmH;KACzH;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,mEAAmE;QACrE,OAAO,EAAE,4DAA4D;QACrE,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,GAAG,EAAE,gFAAgF;KACtF;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,iFAAiF;QACnF,OAAO,EAAE,0BAA0B;QACnC,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,GAAG,EAAE,oFAAoF;KAC1F;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,4BAA4B;QAClC,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,yDAAyD;QAC3D,OAAO,EAAE,+EAA+E;QACxF,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,GAAG,EAAE,sEAAsE;KAC5E;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.d.ts","sourceRoot":"","sources":["../../../src/data/rules/ruby.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,eAAO,MAAM,SAAS,EAAE,YAAY,EAwDnC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// === Ruby-specific rules ===
|
|
2
|
+
export const rubyRules = [
|
|
3
|
+
{
|
|
4
|
+
id: "VG140",
|
|
5
|
+
name: "Ruby SQL injection via interpolation",
|
|
6
|
+
severity: "critical",
|
|
7
|
+
owasp: "A02:2025 Injection",
|
|
8
|
+
description: "String interpolation in SQL queries allows SQL injection attacks.",
|
|
9
|
+
pattern: /(?:where|find_by_sql|execute|select|order)\s*\(\s*["'][^"']*#\{/gi,
|
|
10
|
+
languages: ["ruby"],
|
|
11
|
+
fix: "Use parameterized queries: User.where('name = ?', user_input) or User.where(name: user_input).",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "VG141",
|
|
15
|
+
name: "Ruby command injection",
|
|
16
|
+
severity: "critical",
|
|
17
|
+
owasp: "A02:2025 Injection",
|
|
18
|
+
description: "User input in system/backtick commands allows arbitrary command execution.",
|
|
19
|
+
pattern: /(?:`[^`]*#\{|%x\{[^}]*#\{|IO\.popen|Open3)/gi,
|
|
20
|
+
languages: ["ruby"],
|
|
21
|
+
fix: "Use array form of system(): system('cmd', arg1, arg2). Validate input against an allowlist.",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "VG142",
|
|
25
|
+
name: "Ruby XSS via html_safe/raw",
|
|
26
|
+
severity: "high",
|
|
27
|
+
owasp: "A02:2025 Injection",
|
|
28
|
+
description: "Using .html_safe or raw() with user input bypasses Rails' auto-escaping.",
|
|
29
|
+
pattern: /(?:\.html_safe|raw\s*\()\s*/gi,
|
|
30
|
+
languages: ["ruby"],
|
|
31
|
+
fix: "Avoid .html_safe and raw() with user data. Use sanitize() helper for HTML content.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "VG143",
|
|
35
|
+
name: "Ruby route without auth",
|
|
36
|
+
severity: "high",
|
|
37
|
+
owasp: "A01:2025 Broken Access Control",
|
|
38
|
+
description: "Rails route without before_action authentication filter.",
|
|
39
|
+
pattern: /(?:get|post|put|patch|delete)\s+['"]\/(?:api|admin|users|account|dashboard)/gi,
|
|
40
|
+
languages: ["ruby"],
|
|
41
|
+
fix: "Add before_action :authenticate_user! to controllers handling sensitive routes.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "VG144",
|
|
45
|
+
name: "Ruby weak hashing",
|
|
46
|
+
severity: "critical",
|
|
47
|
+
owasp: "A07:2025 Auth Failures",
|
|
48
|
+
description: "Using Digest::MD5 or Digest::SHA1 for hashing. These are not suitable for passwords.",
|
|
49
|
+
pattern: /Digest::(?:MD5|SHA1)\.(?:hexdigest|digest|base64digest)/gi,
|
|
50
|
+
languages: ["ruby"],
|
|
51
|
+
fix: "Use BCrypt::Password.create(password) from the bcrypt gem for password hashing.",
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
//# sourceMappingURL=ruby.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.js","sourceRoot":"","sources":["../../../src/data/rules/ruby.ts"],"names":[],"mappings":"AAEA,8BAA8B;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,sCAAsC;QAC5C,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,mEAAmE;QACrE,OAAO,EAAE,mEAAmE;QAC5E,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,gGAAgG;KACtG;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,wBAAwB;QAC9B,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,4EAA4E;QAC9E,OAAO,EAAE,8CAA8C;QACvD,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,6FAA6F;KACnG;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,4BAA4B;QAClC,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,0EAA0E;QAC5E,OAAO,EAAE,+BAA+B;QACxC,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,oFAAoF;KAC1F;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,yBAAyB;QAC/B,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,0DAA0D;QAC5D,OAAO,EAAE,+EAA+E;QACxF,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,iFAAiF;KACvF;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,sFAAsF;QACxF,OAAO,EAAE,2DAA2D;QACpE,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,iFAAiF;KACvF;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SecurityRule {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
5
|
+
owasp: string;
|
|
6
|
+
description: string;
|
|
7
|
+
pattern: RegExp;
|
|
8
|
+
languages: string[];
|
|
9
|
+
fix: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/data/rules/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/data/rules/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SecretPattern {
|
|
2
|
+
provider: string;
|
|
3
|
+
pattern: RegExp;
|
|
4
|
+
severity: "critical" | "high" | "medium";
|
|
5
|
+
fix: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const secretPatterns: SecretPattern[];
|
|
8
|
+
export declare function calculateEntropy(str: string): number;
|
|
9
|
+
//# sourceMappingURL=secret-patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-patterns.d.ts","sourceRoot":"","sources":["../../src/data/secret-patterns.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;IACzC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,cAAc,EAAE,aAAa,EAyEzC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWpD"}
|