securebox-cli 0.1.0__py3-none-any.whl
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.
- securebox_cli/__init__.py +3 -0
- securebox_cli/api.py +86 -0
- securebox_cli/config.py +85 -0
- securebox_cli/hook.py +78 -0
- securebox_cli/ignore.py +141 -0
- securebox_cli/main.py +403 -0
- securebox_cli/output.py +87 -0
- securebox_cli/rules/starter.yml +509 -0
- securebox_cli/scan.py +291 -0
- securebox_cli/snapshot.py +221 -0
- securebox_cli/tools.py +229 -0
- securebox_cli-0.1.0.dist-info/LICENSE +202 -0
- securebox_cli-0.1.0.dist-info/METADATA +109 -0
- securebox_cli-0.1.0.dist-info/RECORD +17 -0
- securebox_cli-0.1.0.dist-info/WHEEL +5 -0
- securebox_cli-0.1.0.dist-info/entry_points.txt +2 -0
- securebox_cli-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
# SecureBox starter rules (public, used without an API key; a key fetches the full set).
|
|
2
|
+
rules:
|
|
3
|
+
- id: securebox.express-route-without-auth
|
|
4
|
+
languages:
|
|
5
|
+
- javascript
|
|
6
|
+
- typescript
|
|
7
|
+
severity: WARNING
|
|
8
|
+
message: This state-changing route has no visible authentication check. Anyone who can reach the server can call it. Add auth middleware (e.g. app.post(path, requireAuth, handler)) or check the session/user
|
|
9
|
+
inside the handler.
|
|
10
|
+
metadata:
|
|
11
|
+
category: security
|
|
12
|
+
cwe: 'CWE-306: Missing Authentication for Critical Function'
|
|
13
|
+
owasp: A01:2021 - Broken Access Control
|
|
14
|
+
confidence: LOW
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: $APP.$METHOD($PATH, ($REQ, $RES) => { ... })
|
|
18
|
+
- pattern: $APP.$METHOD($PATH, async ($REQ, $RES) => { ... })
|
|
19
|
+
- pattern: $APP.$METHOD($PATH, function ($REQ, $RES) { ... })
|
|
20
|
+
- pattern: $APP.$METHOD($PATH, async function ($REQ, $RES) { ... })
|
|
21
|
+
- metavariable-regex:
|
|
22
|
+
metavariable: $METHOD
|
|
23
|
+
regex: ^(post|put|patch|delete)$
|
|
24
|
+
- metavariable-regex:
|
|
25
|
+
metavariable: $APP
|
|
26
|
+
regex: ^(app|router|api|server)$
|
|
27
|
+
- pattern-not-regex: (?i)(req\.(user|auth|session)|isAuthenticated|getSession|getServerSession|verifyToken|jwt\.verify|currentUser|getUser\(|auth\(|require(Auth|Admin|User|Session|Role|Login|Owner|Member|Permission)\w*|(with|check|ensure|assert|validate)(Auth|Session|Admin|User|Role|Permission)\w*\(|authorize\()
|
|
28
|
+
- id: securebox.nextjs-route-handler-without-auth
|
|
29
|
+
languages:
|
|
30
|
+
- javascript
|
|
31
|
+
- typescript
|
|
32
|
+
severity: WARNING
|
|
33
|
+
message: This Next.js route handler changes state but has no visible authentication check. Verify the session (e.g. auth(), getServerSession(), supabase.auth.getUser()) before acting.
|
|
34
|
+
metadata:
|
|
35
|
+
category: security
|
|
36
|
+
cwe: 'CWE-306: Missing Authentication for Critical Function'
|
|
37
|
+
owasp: A01:2021 - Broken Access Control
|
|
38
|
+
confidence: LOW
|
|
39
|
+
paths:
|
|
40
|
+
include:
|
|
41
|
+
- route.ts
|
|
42
|
+
- route.js
|
|
43
|
+
exclude:
|
|
44
|
+
- '**/login/**'
|
|
45
|
+
- '**/logout/**'
|
|
46
|
+
- '**/signin/**'
|
|
47
|
+
- '**/sign-in/**'
|
|
48
|
+
- '**/signout/**'
|
|
49
|
+
- '**/sign-out/**'
|
|
50
|
+
- '**/signup/**'
|
|
51
|
+
- '**/sign-up/**'
|
|
52
|
+
- '**/register/**'
|
|
53
|
+
- '**/callback/**'
|
|
54
|
+
- '**/*webhook*/**'
|
|
55
|
+
patterns:
|
|
56
|
+
- pattern-either:
|
|
57
|
+
- pattern: export async function $METHOD(...) { ... }
|
|
58
|
+
- pattern: export function $METHOD(...) { ... }
|
|
59
|
+
- metavariable-regex:
|
|
60
|
+
metavariable: $METHOD
|
|
61
|
+
regex: ^(POST|PUT|PATCH|DELETE)$
|
|
62
|
+
- pattern-not-regex: (?i)(getServerSession|getSession|auth\(|currentUser|getUser\(|verifyToken|jwt\.verify|clerk|require(Auth|Admin|User|Session|Role|Login|Owner|Member|Permission)\w*|(with|check|ensure|assert|validate)(Auth|Session|Admin|User|Role|Permission)\w*\(|authorize\()
|
|
63
|
+
- pattern-not-regex: (\w+\(\s*(req|request)\s*[,)]|\bcookies\(\)|\bheaders\(\))
|
|
64
|
+
- id: securebox.cors-wildcard-with-credentials
|
|
65
|
+
languages:
|
|
66
|
+
- javascript
|
|
67
|
+
- typescript
|
|
68
|
+
severity: WARNING
|
|
69
|
+
message: CORS allows any origin together with credentials. Any website can then make authenticated requests on behalf of your users. List the allowed origins explicitly.
|
|
70
|
+
metadata:
|
|
71
|
+
category: security
|
|
72
|
+
cwe: 'CWE-942: Permissive Cross-domain Policy with Untrusted Domains'
|
|
73
|
+
owasp: A05:2021 - Security Misconfiguration
|
|
74
|
+
confidence: HIGH
|
|
75
|
+
pattern-either:
|
|
76
|
+
- pattern: 'cors({..., origin: "*", ..., credentials: true, ...})'
|
|
77
|
+
- pattern: 'cors({..., credentials: true, ..., origin: "*", ...})'
|
|
78
|
+
- pattern: 'cors({..., origin: true, ..., credentials: true, ...})'
|
|
79
|
+
- pattern: 'cors({..., credentials: true, ..., origin: true, ...})'
|
|
80
|
+
- id: securebox.supabase-service-role-in-client
|
|
81
|
+
languages:
|
|
82
|
+
- javascript
|
|
83
|
+
- typescript
|
|
84
|
+
severity: ERROR
|
|
85
|
+
message: The Supabase service_role key bypasses Row Level Security and must never reach the browser. Use the anon key in client code and keep the service_role key on the server only.
|
|
86
|
+
metadata:
|
|
87
|
+
category: security
|
|
88
|
+
cwe: 'CWE-798: Use of Hard-coded Credentials'
|
|
89
|
+
owasp: A01:2021 - Broken Access Control
|
|
90
|
+
confidence: MEDIUM
|
|
91
|
+
pattern-either:
|
|
92
|
+
- patterns:
|
|
93
|
+
- pattern-either:
|
|
94
|
+
- pattern: process.env.$VAR
|
|
95
|
+
- pattern: import.meta.env.$VAR
|
|
96
|
+
- metavariable-regex:
|
|
97
|
+
metavariable: $VAR
|
|
98
|
+
regex: ^(NEXT_PUBLIC_|VITE_|REACT_APP_|PUBLIC_).*SERVICE_?ROLE
|
|
99
|
+
- patterns:
|
|
100
|
+
- pattern-either:
|
|
101
|
+
- pattern-inside: '"use client";
|
|
102
|
+
|
|
103
|
+
...
|
|
104
|
+
|
|
105
|
+
'
|
|
106
|
+
- pattern-inside: '''use client'';
|
|
107
|
+
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
'
|
|
111
|
+
- pattern: createClient($URL, $KEY, ...)
|
|
112
|
+
- metavariable-regex:
|
|
113
|
+
metavariable: $KEY
|
|
114
|
+
regex: (?i).*service_?role
|
|
115
|
+
- id: securebox.code-exec-from-request
|
|
116
|
+
languages:
|
|
117
|
+
- javascript
|
|
118
|
+
- typescript
|
|
119
|
+
severity: ERROR
|
|
120
|
+
message: Request data reaches eval / new Function / child_process. An attacker can run arbitrary code or shell commands on the server. Never execute user input; use a fixed command with execFile and validated
|
|
121
|
+
arguments.
|
|
122
|
+
metadata:
|
|
123
|
+
category: security
|
|
124
|
+
cwe: 'CWE-94: Improper Control of Generation of Code (''Code Injection'')'
|
|
125
|
+
owasp: A03:2021 - Injection
|
|
126
|
+
confidence: MEDIUM
|
|
127
|
+
mode: taint
|
|
128
|
+
pattern-sources:
|
|
129
|
+
- pattern: $REQ.body
|
|
130
|
+
- pattern: $REQ.query
|
|
131
|
+
- pattern: $REQ.params
|
|
132
|
+
- pattern: $REQ.headers
|
|
133
|
+
- pattern: $REQ.json()
|
|
134
|
+
- pattern: $REQ.cookies
|
|
135
|
+
- pattern: $REQ.formData()
|
|
136
|
+
- pattern: $URL.searchParams.get(...)
|
|
137
|
+
- patterns:
|
|
138
|
+
- pattern-inside: 'class $C { ... $M(..., @$DEC(...) $P: $T, ...) { ... } ... }
|
|
139
|
+
|
|
140
|
+
'
|
|
141
|
+
- metavariable-regex:
|
|
142
|
+
metavariable: $DEC
|
|
143
|
+
regex: ^(Body|Query|Param|Headers|Req|Request|Args|Cookies|UploadedFile|MessageBody|Payload|RawBody)$
|
|
144
|
+
- focus-metavariable: $P
|
|
145
|
+
pattern-sinks:
|
|
146
|
+
- pattern: eval(...)
|
|
147
|
+
- pattern: new Function(...)
|
|
148
|
+
- pattern: Function(...)
|
|
149
|
+
- patterns:
|
|
150
|
+
- pattern-either:
|
|
151
|
+
- pattern: vm.runInContext($CODE, ...)
|
|
152
|
+
- pattern: vm.runInNewContext($CODE, ...)
|
|
153
|
+
- pattern: vm.runInThisContext($CODE, ...)
|
|
154
|
+
- pattern: new vm.Script($CODE, ...)
|
|
155
|
+
- pattern: vm.compileFunction($CODE, ...)
|
|
156
|
+
- pattern: setTimeout($CODE, ...)
|
|
157
|
+
- pattern: setInterval($CODE, ...)
|
|
158
|
+
- focus-metavariable: $CODE
|
|
159
|
+
- patterns:
|
|
160
|
+
- pattern-either:
|
|
161
|
+
- pattern: exec($CMD, ...)
|
|
162
|
+
- pattern: execSync($CMD, ...)
|
|
163
|
+
- pattern: 'spawn($CMD, ..., {..., shell: true, ...})'
|
|
164
|
+
- patterns:
|
|
165
|
+
- pattern-either:
|
|
166
|
+
- pattern: $CP.exec($CMD, ...)
|
|
167
|
+
- pattern: $CP.execSync($CMD, ...)
|
|
168
|
+
- metavariable-regex:
|
|
169
|
+
metavariable: $CP
|
|
170
|
+
regex: ^(child_process|childProcess|cp|proc)$
|
|
171
|
+
- focus-metavariable: $CMD
|
|
172
|
+
- id: securebox.python-sql-string-building
|
|
173
|
+
languages:
|
|
174
|
+
- python
|
|
175
|
+
severity: ERROR
|
|
176
|
+
message: SQL is built with string formatting. If any part comes from user input this is SQL injection. Use parameterized queries, e.g. cursor.execute("... WHERE id = %s", (user_id,)).
|
|
177
|
+
metadata:
|
|
178
|
+
category: security
|
|
179
|
+
cwe: 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command (''SQL Injection'')'
|
|
180
|
+
owasp: A03:2021 - Injection
|
|
181
|
+
confidence: MEDIUM
|
|
182
|
+
paths:
|
|
183
|
+
exclude:
|
|
184
|
+
- '**/migrations/**'
|
|
185
|
+
- '**/migration/**'
|
|
186
|
+
- '**/alembic/**'
|
|
187
|
+
- '**/revisions/**'
|
|
188
|
+
patterns:
|
|
189
|
+
- pattern-either:
|
|
190
|
+
- pattern: $DB.$EXEC(f"...", ...)
|
|
191
|
+
- pattern: $DB.$EXEC("..." + $X, ...)
|
|
192
|
+
- pattern: $DB.$EXEC("..." + $X + $Y, ...)
|
|
193
|
+
- pattern: $DB.$EXEC("..." % $X, ...)
|
|
194
|
+
- pattern: $DB.$EXEC("...".format(...), ...)
|
|
195
|
+
- patterns:
|
|
196
|
+
- pattern-either:
|
|
197
|
+
- pattern-inside: '$Q = f"..."
|
|
198
|
+
|
|
199
|
+
...
|
|
200
|
+
|
|
201
|
+
'
|
|
202
|
+
- pattern-inside: '$Q = "..." + $X
|
|
203
|
+
|
|
204
|
+
...
|
|
205
|
+
|
|
206
|
+
'
|
|
207
|
+
- pattern-inside: '$Q = "..." + $X + $Y
|
|
208
|
+
|
|
209
|
+
...
|
|
210
|
+
|
|
211
|
+
'
|
|
212
|
+
- pattern-inside: '$Q = "..." % $X
|
|
213
|
+
|
|
214
|
+
...
|
|
215
|
+
|
|
216
|
+
'
|
|
217
|
+
- pattern-inside: '$Q = "...".format(...)
|
|
218
|
+
|
|
219
|
+
...
|
|
220
|
+
|
|
221
|
+
'
|
|
222
|
+
- pattern: $DB.$EXEC($Q, ...)
|
|
223
|
+
- pattern-not: $DB.$EXEC($Q, $PARAMS, ...)
|
|
224
|
+
- pattern-not: schema_editor.$EXEC(...)
|
|
225
|
+
- pattern-not-regex: (?i)\(\s*(f|r|rf|fr)?["'`]\s*(set|pragma|drop|alter|create|truncate|grant|revoke|vacuum|analyze|reset|show|comment\s+on|begin|commit|lock|use|kill|install|load|attach|detach)\b
|
|
226
|
+
- metavariable-regex:
|
|
227
|
+
metavariable: $EXEC
|
|
228
|
+
regex: ^(execute|executemany|executescript|raw|exec_driver_sql)$
|
|
229
|
+
- id: securebox.python-sqlalchemy-text-string-building
|
|
230
|
+
languages:
|
|
231
|
+
- python
|
|
232
|
+
severity: ERROR
|
|
233
|
+
message: 'SQL passed to SQLAlchemy text() is built with string formatting. If any part comes from user input this is SQL injection. Keep the SQL constant and bind values, e.g. text("SELECT * FROM users
|
|
234
|
+
WHERE id = :id") with execute(stmt, {"id": user_id}).'
|
|
235
|
+
metadata:
|
|
236
|
+
category: security
|
|
237
|
+
cwe: 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command (''SQL Injection'')'
|
|
238
|
+
owasp: A03:2021 - Injection
|
|
239
|
+
confidence: MEDIUM
|
|
240
|
+
paths:
|
|
241
|
+
exclude:
|
|
242
|
+
- '**/migrations/**'
|
|
243
|
+
- '**/migration/**'
|
|
244
|
+
- '**/alembic/**'
|
|
245
|
+
- '**/revisions/**'
|
|
246
|
+
patterns:
|
|
247
|
+
- pattern-either:
|
|
248
|
+
- pattern: $TEXT(f"...", ...)
|
|
249
|
+
- pattern: $TEXT("..." + $X, ...)
|
|
250
|
+
- pattern: $TEXT("..." + $X + $Y, ...)
|
|
251
|
+
- pattern: $TEXT("..." % $X, ...)
|
|
252
|
+
- pattern: $TEXT("...".format(...), ...)
|
|
253
|
+
- patterns:
|
|
254
|
+
- pattern-either:
|
|
255
|
+
- pattern-inside: '$Q = f"..."
|
|
256
|
+
|
|
257
|
+
...
|
|
258
|
+
|
|
259
|
+
'
|
|
260
|
+
- pattern-inside: '$Q = "..." + $X
|
|
261
|
+
|
|
262
|
+
...
|
|
263
|
+
|
|
264
|
+
'
|
|
265
|
+
- pattern-inside: '$Q = "..." % $X
|
|
266
|
+
|
|
267
|
+
...
|
|
268
|
+
|
|
269
|
+
'
|
|
270
|
+
- pattern-inside: '$Q = "...".format(...)
|
|
271
|
+
|
|
272
|
+
...
|
|
273
|
+
|
|
274
|
+
'
|
|
275
|
+
- pattern: $TEXT($Q, ...)
|
|
276
|
+
- pattern-not-inside: $C.execute($TEXT(...), $PARAMS, ...)
|
|
277
|
+
- pattern-not-inside: $TEXT(...).bindparams(...)
|
|
278
|
+
- pattern-not-regex: (?i)\(\s*(f|r|rf|fr)?["'`]\s*(set|pragma|drop|alter|create|truncate|grant|revoke|vacuum|analyze|reset|show|comment\s+on|begin|commit|lock|use|kill|install|load|attach|detach)\b
|
|
279
|
+
- metavariable-regex:
|
|
280
|
+
metavariable: $TEXT
|
|
281
|
+
regex: ^(text|sqlalchemy\.text|sa\.text|sql\.text)$
|
|
282
|
+
- id: securebox.js-sql-string-building
|
|
283
|
+
languages:
|
|
284
|
+
- javascript
|
|
285
|
+
- typescript
|
|
286
|
+
severity: ERROR
|
|
287
|
+
message: SQL is built with string interpolation or concatenation. If any part comes from user input this is SQL injection. Use placeholders, e.g. db.query("... WHERE id = $1", [id]).
|
|
288
|
+
metadata:
|
|
289
|
+
category: security
|
|
290
|
+
cwe: 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command (''SQL Injection'')'
|
|
291
|
+
owasp: A03:2021 - Injection
|
|
292
|
+
confidence: MEDIUM
|
|
293
|
+
paths:
|
|
294
|
+
exclude:
|
|
295
|
+
- '**/migrations/**'
|
|
296
|
+
- '**/migration/**'
|
|
297
|
+
- '**/alembic/**'
|
|
298
|
+
- '**/revisions/**'
|
|
299
|
+
patterns:
|
|
300
|
+
- pattern-either:
|
|
301
|
+
- pattern: $DB.$Q(`...${$X}...`, ...)
|
|
302
|
+
- pattern: $DB.$Q("..." + $X, ...)
|
|
303
|
+
- pattern: $DB.$Q("..." + $X + $Y, ...)
|
|
304
|
+
- patterns:
|
|
305
|
+
- pattern-either:
|
|
306
|
+
- pattern-inside: '$SQL = `...${$X}...`;
|
|
307
|
+
|
|
308
|
+
...
|
|
309
|
+
|
|
310
|
+
'
|
|
311
|
+
- pattern-inside: '$SQL = "..." + $X;
|
|
312
|
+
|
|
313
|
+
...
|
|
314
|
+
|
|
315
|
+
'
|
|
316
|
+
- pattern: $DB.$Q($SQL, ...)
|
|
317
|
+
- pattern-not: $DB.$Q($SQL, [...], ...)
|
|
318
|
+
- pattern-not: '$DB.$Q($SQL, {..., replacements: $R, ...}, ...)'
|
|
319
|
+
- pattern-not: '$DB.$Q($SQL, {..., bind: $R, ...}, ...)'
|
|
320
|
+
- pattern-not-regex: (?i)\(\s*(f|r|rf|fr)?["'`]\s*(set|pragma|drop|alter|create|truncate|grant|revoke|vacuum|analyze|reset|show|comment\s+on|begin|commit|lock|use|kill|install|load|attach|detach)\b
|
|
321
|
+
- metavariable-regex:
|
|
322
|
+
metavariable: $Q
|
|
323
|
+
regex: ^(query|execute|raw|\$queryRawUnsafe|\$executeRawUnsafe)$
|
|
324
|
+
- id: securebox.debug-enabled
|
|
325
|
+
languages:
|
|
326
|
+
- python
|
|
327
|
+
severity: WARNING
|
|
328
|
+
message: Debug mode is enabled. Debug pages leak stack traces and settings, and the Flask/Werkzeug debugger allows remote code execution. Read it from an environment variable that is off in production.
|
|
329
|
+
metadata:
|
|
330
|
+
category: security
|
|
331
|
+
cwe: 'CWE-489: Active Debug Code'
|
|
332
|
+
owasp: A05:2021 - Security Misconfiguration
|
|
333
|
+
confidence: HIGH
|
|
334
|
+
paths:
|
|
335
|
+
exclude:
|
|
336
|
+
- '**/settings/dev*.py'
|
|
337
|
+
- '**/settings/local*.py'
|
|
338
|
+
- '**/settings/test*.py'
|
|
339
|
+
- '**/settings_dev.py'
|
|
340
|
+
- '**/settings_local.py'
|
|
341
|
+
- '**/dev_settings.py'
|
|
342
|
+
- '**/local_settings.py'
|
|
343
|
+
- '**/development.py'
|
|
344
|
+
pattern-either:
|
|
345
|
+
- pattern: DEBUG = True
|
|
346
|
+
- pattern: $APP.run(..., debug=True, ...)
|
|
347
|
+
- pattern: $APP.config["DEBUG"] = True
|
|
348
|
+
- pattern: $APP.debug = True
|
|
349
|
+
- pattern: fastapi.FastAPI(..., debug=True, ...)
|
|
350
|
+
- pattern: starlette.applications.Starlette(..., debug=True, ...)
|
|
351
|
+
- pattern: aiohttp.web.Application(..., debug=True, ...)
|
|
352
|
+
- pattern: web.Application(..., debug=True, ...)
|
|
353
|
+
- id: securebox.python-jwt-verification-disabled
|
|
354
|
+
languages:
|
|
355
|
+
- python
|
|
356
|
+
severity: ERROR
|
|
357
|
+
message: JWT signature verification is disabled or the "none" algorithm is allowed, so anyone can forge tokens. Verify with a fixed algorithm list, e.g. jwt.decode(token, key, algorithms=["HS256"]).
|
|
358
|
+
metadata:
|
|
359
|
+
category: security
|
|
360
|
+
cwe: 'CWE-347: Improper Verification of Cryptographic Signature'
|
|
361
|
+
owasp: A07:2021 - Identification and Authentication Failures
|
|
362
|
+
confidence: HIGH
|
|
363
|
+
pattern-either:
|
|
364
|
+
- pattern: 'jwt.decode(..., options={..., "verify_signature": False, ...}, ...)'
|
|
365
|
+
- pattern: jwt.decode(..., verify=False, ...)
|
|
366
|
+
- pattern: jwt.decode(..., algorithms=[..., "none", ...], ...)
|
|
367
|
+
- pattern: jwt.encode(..., algorithm="none", ...)
|
|
368
|
+
- id: securebox.js-jwt-verification-disabled
|
|
369
|
+
languages:
|
|
370
|
+
- javascript
|
|
371
|
+
- typescript
|
|
372
|
+
severity: ERROR
|
|
373
|
+
message: 'The JWT is not verified (jwt.decode does not check the signature) or the "none" algorithm is allowed, so anyone can forge tokens. Use jwt.verify(token, key, { algorithms: ["HS256"] }).'
|
|
374
|
+
metadata:
|
|
375
|
+
category: security
|
|
376
|
+
cwe: 'CWE-347: Improper Verification of Cryptographic Signature'
|
|
377
|
+
owasp: A07:2021 - Identification and Authentication Failures
|
|
378
|
+
confidence: MEDIUM
|
|
379
|
+
pattern-either:
|
|
380
|
+
- pattern: 'jwt.verify($T, $K, {..., algorithms: [..., "none", ...], ...}, ...)'
|
|
381
|
+
- pattern: 'jwt.sign($P, $K, {..., algorithm: "none", ...}, ...)'
|
|
382
|
+
- patterns:
|
|
383
|
+
- pattern: jwt.decode($T, ...)
|
|
384
|
+
- metavariable-regex:
|
|
385
|
+
metavariable: $T
|
|
386
|
+
regex: (?i)^(?!.*id_?token)
|
|
387
|
+
- id: securebox.python-weak-hash
|
|
388
|
+
languages:
|
|
389
|
+
- python
|
|
390
|
+
severity: WARNING
|
|
391
|
+
message: 'MD5 and SHA-1 are broken for security: collisions can be made on purpose. Use hashlib.sha256 (or a password hash such as argon2/bcrypt for passwords). If this hash is not used for security (a
|
|
392
|
+
cache key, a non-secret ID), say so with usedforsecurity=False.'
|
|
393
|
+
metadata:
|
|
394
|
+
category: security
|
|
395
|
+
cwe: 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
|
|
396
|
+
owasp: A02:2021 - Cryptographic Failures
|
|
397
|
+
confidence: MEDIUM
|
|
398
|
+
patterns:
|
|
399
|
+
- pattern-either:
|
|
400
|
+
- pattern: hashlib.md5(...)
|
|
401
|
+
- pattern: hashlib.sha1(...)
|
|
402
|
+
- pattern: hashlib.new("md5", ...)
|
|
403
|
+
- pattern: hashlib.new("sha1", ...)
|
|
404
|
+
- pattern: hashlib.new("MD5", ...)
|
|
405
|
+
- pattern: hashlib.new("SHA1", ...)
|
|
406
|
+
- pattern-not: hashlib.$F(..., usedforsecurity=False, ...)
|
|
407
|
+
- pattern-inside: "def $NAME(...):\n ...\n"
|
|
408
|
+
- metavariable-regex:
|
|
409
|
+
metavariable: $NAME
|
|
410
|
+
regex: (?i)^(?!.*(color|colour|avatar|gravatar|etag|cache|checksum|fingerprint|file_?hash|content_?hash|dedup|bucket|shard|slug|palette|hue|seed|mock|fake|dummy|sample|_id$|^id$|ids$|key_for|cache_key))
|
|
411
|
+
- id: securebox.python-url-fetch-from-variable
|
|
412
|
+
languages:
|
|
413
|
+
- python
|
|
414
|
+
severity: WARNING
|
|
415
|
+
message: A URL that is not a fixed string is fetched. If any part of it comes from user input, an attacker can make the server call internal addresses (SSRF), or read local files with a file:// URL. Check
|
|
416
|
+
the scheme and host against an allowlist before fetching.
|
|
417
|
+
metadata:
|
|
418
|
+
category: security
|
|
419
|
+
cwe: 'CWE-918: Server-Side Request Forgery (SSRF)'
|
|
420
|
+
owasp: A10:2021 - Server-Side Request Forgery
|
|
421
|
+
confidence: LOW
|
|
422
|
+
patterns:
|
|
423
|
+
- pattern-either:
|
|
424
|
+
- pattern: urllib.request.urlopen($URL, ...)
|
|
425
|
+
- pattern: urllib.request.Request($URL, ...)
|
|
426
|
+
- pattern: urlopen($URL, ...)
|
|
427
|
+
- pattern-not: urllib.request.urlopen("...", ...)
|
|
428
|
+
- pattern-not: urllib.request.Request("...", ...)
|
|
429
|
+
- pattern-not: urlopen("...", ...)
|
|
430
|
+
- id: securebox.node-gcm-without-auth-tag-length
|
|
431
|
+
languages:
|
|
432
|
+
- javascript
|
|
433
|
+
- typescript
|
|
434
|
+
severity: ERROR
|
|
435
|
+
message: 'AES-GCM decryption without authTagLength accepts shortened authentication tags, which makes forged ciphertexts much easier to get accepted. Pass the tag length, e.g. createDecipheriv("aes-256-gcm",
|
|
436
|
+
key, iv, { authTagLength: 16 }).'
|
|
437
|
+
metadata:
|
|
438
|
+
category: security
|
|
439
|
+
cwe: 'CWE-310: Cryptographic Issues'
|
|
440
|
+
owasp: A02:2021 - Cryptographic Failures
|
|
441
|
+
confidence: HIGH
|
|
442
|
+
patterns:
|
|
443
|
+
- pattern-either:
|
|
444
|
+
- pattern: $CRYPTO.createDecipheriv("=~/(?i)gcm/", $KEY, $IV)
|
|
445
|
+
- pattern: createDecipheriv("=~/(?i)gcm/", $KEY, $IV)
|
|
446
|
+
- pattern: $CRYPTO.createDecipheriv("=~/(?i)gcm/", $KEY, $IV, {...})
|
|
447
|
+
- pattern: createDecipheriv("=~/(?i)gcm/", $KEY, $IV, {...})
|
|
448
|
+
- pattern-not: '$CRYPTO.createDecipheriv($ALG, $KEY, $IV, {..., authTagLength: $LEN, ...})'
|
|
449
|
+
- pattern-not: 'createDecipheriv($ALG, $KEY, $IV, {..., authTagLength: $LEN, ...})'
|
|
450
|
+
- id: securebox.github-actions-unpinned-action
|
|
451
|
+
languages:
|
|
452
|
+
- yaml
|
|
453
|
+
severity: WARNING
|
|
454
|
+
message: 'This action is used by tag or branch, which its owner (or anyone who takes over the repository) can move to new code that then runs in your workflow with its secrets. Pin it to a full commit
|
|
455
|
+
SHA and keep the version in a comment, e.g. uses: owner/action@<40-char sha> # v4.'
|
|
456
|
+
metadata:
|
|
457
|
+
category: security
|
|
458
|
+
cwe: 'CWE-1357: Reliance on Insufficiently Trustworthy Component'
|
|
459
|
+
owasp: A08:2021 - Software and Data Integrity Failures
|
|
460
|
+
confidence: HIGH
|
|
461
|
+
paths:
|
|
462
|
+
include:
|
|
463
|
+
- '**/.github/workflows/*.yml'
|
|
464
|
+
- '**/.github/workflows/*.yaml'
|
|
465
|
+
- '**/action.yml'
|
|
466
|
+
- '**/action.yaml'
|
|
467
|
+
patterns:
|
|
468
|
+
- pattern: 'uses: $REF'
|
|
469
|
+
- metavariable-regex:
|
|
470
|
+
metavariable: $REF
|
|
471
|
+
regex: ^(?!\./|docker://)[^@\s]+@(?![0-9a-f]{40}$)\S+$
|
|
472
|
+
- id: securebox.dependabot-without-cooldown
|
|
473
|
+
languages:
|
|
474
|
+
- yaml
|
|
475
|
+
severity: WARNING
|
|
476
|
+
message: 'Dependabot proposes new releases as soon as they are published. A malicious release of a dependency is usually caught within days; a cooldown keeps such releases out of your pull requests until
|
|
477
|
+
then, e.g. cooldown: { default-days: 7 }.'
|
|
478
|
+
metadata:
|
|
479
|
+
category: security
|
|
480
|
+
cwe: 'CWE-829: Inclusion of Functionality from Untrusted Control Sphere'
|
|
481
|
+
owasp: A08:2021 - Software and Data Integrity Failures
|
|
482
|
+
confidence: MEDIUM
|
|
483
|
+
paths:
|
|
484
|
+
include:
|
|
485
|
+
- '**/.github/dependabot.yml'
|
|
486
|
+
- '**/.github/dependabot.yaml'
|
|
487
|
+
patterns:
|
|
488
|
+
- pattern-inside: 'updates: [...]
|
|
489
|
+
|
|
490
|
+
'
|
|
491
|
+
- pattern: 'package-ecosystem: $ECOSYSTEM
|
|
492
|
+
|
|
493
|
+
...
|
|
494
|
+
|
|
495
|
+
'
|
|
496
|
+
- pattern-not-inside: 'package-ecosystem: $ECOSYSTEM
|
|
497
|
+
|
|
498
|
+
...
|
|
499
|
+
|
|
500
|
+
cooldown: $COOLDOWN
|
|
501
|
+
|
|
502
|
+
'
|
|
503
|
+
- pattern-not-inside: 'cooldown: $COOLDOWN
|
|
504
|
+
|
|
505
|
+
...
|
|
506
|
+
|
|
507
|
+
package-ecosystem: $ECOSYSTEM
|
|
508
|
+
|
|
509
|
+
'
|