deepscan-cli 1.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 (47) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +419 -0
  3. package/dist/bin/deepscan.d.ts +1 -0
  4. package/dist/bin/deepscan.js +393 -0
  5. package/dist/bin/deepscan.js.map +1 -0
  6. package/dist/chunk-OSYJXVNF.js +7268 -0
  7. package/dist/chunk-OSYJXVNF.js.map +1 -0
  8. package/dist/index.d.ts +470 -0
  9. package/dist/index.js +21 -0
  10. package/dist/index.js.map +1 -0
  11. package/package.json +68 -0
  12. package/rules/built-in/converted-semgrep.yml +37 -0
  13. package/rules/built-in/default-config.yml +59 -0
  14. package/rules/built-in/quality.yml +117 -0
  15. package/rules/built-in/security.yml +383 -0
  16. package/rules/built-in/semgrep-apex.yml +336 -0
  17. package/rules/built-in/semgrep-bash.yml +362 -0
  18. package/rules/built-in/semgrep-c.yml +429 -0
  19. package/rules/built-in/semgrep-clojure.yml +166 -0
  20. package/rules/built-in/semgrep-csharp.yml +1260 -0
  21. package/rules/built-in/semgrep-dart.yml +21 -0
  22. package/rules/built-in/semgrep-dockerfile.yml +874 -0
  23. package/rules/built-in/semgrep-elixir.yml +146 -0
  24. package/rules/built-in/semgrep-generic.yml +2945 -0
  25. package/rules/built-in/semgrep-go.yml +2898 -0
  26. package/rules/built-in/semgrep-hcl.yml +8181 -0
  27. package/rules/built-in/semgrep-html.yml +94 -0
  28. package/rules/built-in/semgrep-java.yml +4219 -0
  29. package/rules/built-in/semgrep-javascript.yml +6243 -0
  30. package/rules/built-in/semgrep-json.yml +360 -0
  31. package/rules/built-in/semgrep-kotlin.yml +540 -0
  32. package/rules/built-in/semgrep-lua.yml +46 -0
  33. package/rules/built-in/semgrep-ocaml.yml +773 -0
  34. package/rules/built-in/semgrep-php.yml +1638 -0
  35. package/rules/built-in/semgrep-python.yml +11240 -0
  36. package/rules/built-in/semgrep-regex.yml +6444 -0
  37. package/rules/built-in/semgrep-ruby.yml +2687 -0
  38. package/rules/built-in/semgrep-rust.yml +278 -0
  39. package/rules/built-in/semgrep-scala.yml +807 -0
  40. package/rules/built-in/semgrep-sh.yml +46 -0
  41. package/rules/built-in/semgrep-solidity.yml +1046 -0
  42. package/rules/built-in/semgrep-swift.yml +200 -0
  43. package/rules/built-in/semgrep-terraform.yml +147 -0
  44. package/rules/built-in/semgrep-typescript.yml +6212 -0
  45. package/rules/built-in/semgrep-xml.yml +31 -0
  46. package/rules/built-in/semgrep-yaml.yml +2785 -0
  47. package/rules/examples/custom-api-security.yml +66 -0
@@ -0,0 +1,807 @@
1
+ rules:
2
+ - id: contains-bidirectional-characters
3
+ name: contains-bidirectional-characters
4
+ description: >-
5
+ This code contains bidirectional (bidi) characters. While this is useful for support of right-to-left languages
6
+ such as Arabic or Hebrew, it can also be used to trick language parsers into executing code in a manner that is
7
+ different from how it is displayed in code editing and review tools. If this is not what you were expecting,
8
+ please review this code in an editor that can reveal hidden Unicode characters.
9
+ category: security
10
+ severity: medium
11
+ confidence: medium
12
+ languages:
13
+ - bash
14
+ - c
15
+ - csharp
16
+ - go
17
+ - java
18
+ - javascript
19
+ - json
20
+ - kotlin
21
+ - lua
22
+ - ocaml
23
+ - php
24
+ - python
25
+ - ruby
26
+ - rust
27
+ - scala
28
+ - sh
29
+ - typescript
30
+ - yaml
31
+ patterns:
32
+ - regex: .*
33
+ message: >-
34
+ This code contains bidirectional (bidi) characters. While this is useful for support of right-to-left
35
+ languages such as Arabic or Hebrew, it can also be used to trick language parsers into executing code in a
36
+ manner that is different from how it is displayed in code editing and review tools. If this is not what you
37
+ were expecting, please review this code in an editor that can reveal hidden Unicode characters.
38
+ cwe:
39
+ - CWE-94
40
+ owasp:
41
+ - A03:2021
42
+ - A05:2025
43
+ references:
44
+ - https://trojansource.codes/
45
+ tags:
46
+ - unicode
47
+ - id: no-null-cipher
48
+ name: no-null-cipher
49
+ description: >-
50
+ NullCipher was detected. This will not encrypt anything; the cipher text will be the same as the plain text. Use a
51
+ valid, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
52
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
53
+ category: crypto
54
+ severity: medium
55
+ confidence: medium
56
+ languages:
57
+ - kt
58
+ - scala
59
+ patterns:
60
+ - pattern: NullCipher(...)
61
+ message: >-
62
+ NullCipher was detected. This will not encrypt anything; the cipher text will be the same as the plain text.
63
+ Use a valid, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
64
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for more information.
65
+ cwe:
66
+ - CWE-327
67
+ owasp:
68
+ - A03:2017
69
+ - A02:2021
70
+ - A04:2025
71
+ references:
72
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
73
+ tags:
74
+ - kotlin
75
+ - id: jwt-scala-hardcode
76
+ name: jwt-scala-hardcode
77
+ description: >-
78
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
79
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect the
80
+ credentials (e.g. keeping secrets in environment variables)
81
+ category: auth
82
+ severity: medium
83
+ confidence: medium
84
+ languages:
85
+ - scala
86
+ patterns:
87
+ - regex: .*
88
+ message: >-
89
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
90
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
91
+ the credentials (e.g. keeping secrets in environment variables)
92
+ cwe:
93
+ - CWE-522
94
+ owasp:
95
+ - A02:2017
96
+ - A04:2021
97
+ - A06:2025
98
+ references:
99
+ - https://jwt-scala.github.io/jwt-scala/
100
+ tags:
101
+ - scala
102
+ - id: positive-number-index-of
103
+ name: positive-number-index-of
104
+ description: >-
105
+ Flags scala code that look for values that are greater than 0. This ignores the first element, which is most
106
+ likely a bug. Instead, use indexOf with -1. If the intent is to check the inclusion of a value, use the contains
107
+ method instead.
108
+ category: security
109
+ severity: medium
110
+ confidence: medium
111
+ languages:
112
+ - scala
113
+ patterns:
114
+ - regex: .*
115
+ message: >-
116
+ Flags scala code that look for values that are greater than 0. This ignores the first element, which is most
117
+ likely a bug. Instead, use indexOf with -1. If the intent is to check the inclusion of a value, use the
118
+ contains method instead.
119
+ cwe: []
120
+ owasp: []
121
+ references:
122
+ - https://blog.codacy.com/9-scala-security-issues/
123
+ tags:
124
+ - scala
125
+ - id: dangerous-seq-run
126
+ name: dangerous-seq-run
127
+ description: >-
128
+ Found dynamic content used for the external process. This is dangerous if arbitrary data can reach this function
129
+ call because it allows a malicious actor to execute commands. Ensure your variables are not controlled by users or
130
+ sufficiently sanitized.
131
+ category: security
132
+ severity: high
133
+ confidence: medium
134
+ languages:
135
+ - scala
136
+ patterns:
137
+ - pattern: Seq($CMD, ...)
138
+ message: >-
139
+ Found dynamic content used for the external process. This is dangerous if arbitrary data can reach this
140
+ function call because it allows a malicious actor to execute commands. Ensure your variables are not
141
+ controlled by users or sufficiently sanitized.
142
+ cwe:
143
+ - CWE-78
144
+ owasp:
145
+ - A01:2017
146
+ - A03:2021
147
+ - A05:2025
148
+ references:
149
+ - https://owasp.org/Top10/A03_2021-Injection
150
+ tags:
151
+ - scala
152
+ - id: dangerous-shell-run
153
+ name: dangerous-shell-run
154
+ description: >-
155
+ Found dynamic content used for the external process. This is dangerous if arbitrary data can reach this function
156
+ call because it allows a malicious actor to execute commands. Ensure your variables are not controlled by users or
157
+ sufficiently sanitized.
158
+ category: security
159
+ severity: high
160
+ confidence: medium
161
+ languages:
162
+ - scala
163
+ patterns:
164
+ - pattern: Seq($SH, "-c", $CMD, ...)
165
+ message: >-
166
+ Found dynamic content used for the external process. This is dangerous if arbitrary data can reach this
167
+ function call because it allows a malicious actor to execute commands. Ensure your variables are not
168
+ controlled by users or sufficiently sanitized.
169
+ cwe:
170
+ - CWE-78
171
+ owasp:
172
+ - A01:2017
173
+ - A03:2021
174
+ - A05:2025
175
+ references:
176
+ - https://owasp.org/Top10/A03_2021-Injection
177
+ tags:
178
+ - scala
179
+ - id: dispatch-ssrf
180
+ name: dispatch-ssrf
181
+ description: >-
182
+ A parameter being passed directly into `url` most likely lead to SSRF. This could allow an attacker to send data
183
+ to their own server, potentially exposing sensitive data sent with this request. They could also probe internal
184
+ servers or other resources that the server running this code can access. Do not allow arbitrary hosts. Instead,
185
+ create an allowlist for approved hosts, or hardcode the correct host.
186
+ category: api-security
187
+ severity: medium
188
+ confidence: medium
189
+ languages:
190
+ - scala
191
+ patterns:
192
+ - pattern: url($URL)
193
+ message: >-
194
+ A parameter being passed directly into `url` most likely lead to SSRF. This could allow an attacker to send
195
+ data to their own server, potentially exposing sensitive data sent with this request. They could also probe
196
+ internal servers or other resources that the server running this code can access. Do not allow arbitrary
197
+ hosts. Instead, create an allowlist for approved hosts, or hardcode the correct host.
198
+ cwe:
199
+ - CWE-918
200
+ owasp:
201
+ - A10:2021
202
+ - A01:2025
203
+ references:
204
+ - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
205
+ - https://dispatchhttp.org/Dispatch.html
206
+ tags:
207
+ - scala
208
+ - dispatch
209
+ - id: documentbuilder-dtd-enabled
210
+ name: documentbuilder-dtd-enabled
211
+ description: >-
212
+ Document Builder being instantiated without calling the `setFeature` functions that are generally used for
213
+ disabling entity processing. User controlled data in XML Document builder can result in XML Internal Entity
214
+ Processing vulnerabilities like the disclosure of confidential data, denial of service, Server Side Request
215
+ Forgery (SSRF), port scanning. Make sure to disable entity processing functionality.
216
+ category: security
217
+ severity: medium
218
+ confidence: medium
219
+ languages:
220
+ - scala
221
+ patterns:
222
+ - regex: .*
223
+ message: >-
224
+ Document Builder being instantiated without calling the `setFeature` functions that are generally used for
225
+ disabling entity processing. User controlled data in XML Document builder can result in XML Internal Entity
226
+ Processing vulnerabilities like the disclosure of confidential data, denial of service, Server Side Request
227
+ Forgery (SSRF), port scanning. Make sure to disable entity processing functionality.
228
+ cwe:
229
+ - CWE-611
230
+ owasp:
231
+ - A04:2017
232
+ - A05:2021
233
+ - A02:2025
234
+ references:
235
+ - https://owasp.org/Top10/A05_2021-Security_Misconfiguration
236
+ tags:
237
+ - scala
238
+ - id: insecure-random
239
+ name: insecure-random
240
+ description: >-
241
+ Flags the use of a predictable random value from `scala.util.Random`. This can lead to vulnerabilities when used
242
+ in security contexts, such as in a CSRF token, password reset token, or any other secret value. To fix this, use
243
+ java.security.SecureRandom instead.
244
+ category: security
245
+ severity: medium
246
+ confidence: medium
247
+ languages:
248
+ - scala
249
+ patterns:
250
+ - pattern: |
251
+ import scala.util.Random
252
+ message: >-
253
+ Flags the use of a predictable random value from `scala.util.Random`. This can lead to vulnerabilities when
254
+ used in security contexts, such as in a CSRF token, password reset token, or any other secret value. To fix
255
+ this, use java.security.SecureRandom instead.
256
+ cwe:
257
+ - CWE-330
258
+ owasp:
259
+ - A02:2021
260
+ - A04:2025
261
+ references:
262
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
263
+ tags:
264
+ - scala
265
+ - cryptography
266
+ - id: io-source-ssrf
267
+ name: io-source-ssrf
268
+ description: >-
269
+ A parameter being passed directly into `fromURL` most likely lead to SSRF. This could allow an attacker to send
270
+ data to their own server, potentially exposing sensitive data sent with this request. They could also probe
271
+ internal servers or other resources that the server running this code can access. Do not allow arbitrary hosts.
272
+ Instead, create an allowlist for approved hosts, or hardcode the correct host.
273
+ category: injection
274
+ severity: medium
275
+ confidence: medium
276
+ languages:
277
+ - scala
278
+ patterns:
279
+ - regex: .*
280
+ message: >-
281
+ A parameter being passed directly into `fromURL` most likely lead to SSRF. This could allow an attacker to
282
+ send data to their own server, potentially exposing sensitive data sent with this request. They could also
283
+ probe internal servers or other resources that the server running this code can access. Do not allow arbitrary
284
+ hosts. Instead, create an allowlist for approved hosts, or hardcode the correct host.
285
+ cwe:
286
+ - CWE-918
287
+ owasp:
288
+ - A10:2021
289
+ - A01:2025
290
+ references:
291
+ - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
292
+ - >-
293
+ https://www.scala-lang.org/api/current/scala/io/Source$.html#fromURL(url:java.net.URL)(implicitcodec:scala.io.Codec):scala.io.BufferedSource
294
+ tags:
295
+ - scala
296
+ - id: path-traversal-fromfile
297
+ name: path-traversal-fromfile
298
+ description: >-
299
+ Flags cases of possible path traversal. If an unfiltered parameter is passed into 'fromFile', file from an
300
+ arbitrary filesystem location could be read. This could lead to sensitive data exposure and other provles.
301
+ Instead, sanitize the user input instead of performing direct string concatenation.
302
+ category: file-ops
303
+ severity: medium
304
+ confidence: medium
305
+ languages:
306
+ - scala
307
+ patterns:
308
+ - regex: .*
309
+ message: >-
310
+ Flags cases of possible path traversal. If an unfiltered parameter is passed into 'fromFile', file from an
311
+ arbitrary filesystem location could be read. This could lead to sensitive data exposure and other provles.
312
+ Instead, sanitize the user input instead of performing direct string concatenation.
313
+ cwe:
314
+ - CWE-22
315
+ owasp:
316
+ - A05:2017
317
+ - A01:2021
318
+ - A01:2025
319
+ references:
320
+ - https://owasp.org/Top10/A01_2021-Broken_Access_Control
321
+ tags:
322
+ - scala
323
+ - id: rsa-padding-set
324
+ name: rsa-padding-set
325
+ description: >-
326
+ Usage of RSA without OAEP (Optimal Asymmetric Encryption Padding) may weaken encryption. This could lead to
327
+ sensitive data exposure. Instead, use RSA with `OAEPWithMD5AndMGF1Padding` instead.
328
+ category: security
329
+ severity: medium
330
+ confidence: medium
331
+ languages:
332
+ - scala
333
+ patterns:
334
+ - pattern: |
335
+ $VAR = $CIPHER.getInstance($MODE)
336
+ message: >-
337
+ Usage of RSA without OAEP (Optimal Asymmetric Encryption Padding) may weaken encryption. This could lead to
338
+ sensitive data exposure. Instead, use RSA with `OAEPWithMD5AndMGF1Padding` instead.
339
+ cwe:
340
+ - CWE-780
341
+ owasp:
342
+ - A02:2021
343
+ - A04:2025
344
+ references:
345
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
346
+ tags:
347
+ - scala
348
+ - cryptography
349
+ - id: sax-dtd-enabled
350
+ name: sax-dtd-enabled
351
+ description: >-
352
+ XML processor being instantiated without calling the `setFeature` functions that are generally used for disabling
353
+ entity processing. User controlled data in XML Parsers can result in XML Internal Entity Processing
354
+ vulnerabilities like the disclosure of confidential data, denial of service, Server Side Request Forgery (SSRF),
355
+ port scanning. Make sure to disable entity processing functionality.
356
+ category: security
357
+ severity: medium
358
+ confidence: medium
359
+ languages:
360
+ - scala
361
+ patterns:
362
+ - regex: .*
363
+ message: >-
364
+ XML processor being instantiated without calling the `setFeature` functions that are generally used for
365
+ disabling entity processing. User controlled data in XML Parsers can result in XML Internal Entity Processing
366
+ vulnerabilities like the disclosure of confidential data, denial of service, Server Side Request Forgery
367
+ (SSRF), port scanning. Make sure to disable entity processing functionality.
368
+ cwe:
369
+ - CWE-611
370
+ owasp:
371
+ - A04:2017
372
+ - A05:2021
373
+ - A02:2025
374
+ references:
375
+ - https://owasp.org/Top10/A05_2021-Security_Misconfiguration
376
+ tags:
377
+ - scala
378
+ - id: scala-dangerous-process-run
379
+ name: scala-dangerous-process-run
380
+ description: >-
381
+ Found dynamic content used for the external process. This is dangerous if arbitrary data can reach this function
382
+ call because it allows a malicious actor to execute commands. Use `Seq(...)` for dynamically generated commands.
383
+ category: security
384
+ severity: high
385
+ confidence: medium
386
+ languages:
387
+ - scala
388
+ patterns:
389
+ - regex: .*
390
+ message: >-
391
+ Found dynamic content used for the external process. This is dangerous if arbitrary data can reach this
392
+ function call because it allows a malicious actor to execute commands. Use `Seq(...)` for dynamically
393
+ generated commands.
394
+ cwe:
395
+ - CWE-78
396
+ owasp:
397
+ - A01:2017
398
+ - A03:2021
399
+ - A05:2025
400
+ references:
401
+ - https://owasp.org/Top10/A03_2021-Injection
402
+ tags:
403
+ - scala
404
+ - id: scalaj-http-ssrf
405
+ name: scalaj-http-ssrf
406
+ description: >-
407
+ A parameter being passed directly into `Http` can likely lead to SSRF. This could allow an attacker to send data
408
+ to their own server, potentially exposing sensitive data sent with this request. They could also probe internal
409
+ servers or other resources that the server running this code can access. Do not allow arbitrary hosts. Instead,
410
+ create an allowlist for approved hosts, or hardcode the correct host.
411
+ category: api-security
412
+ severity: medium
413
+ confidence: medium
414
+ languages:
415
+ - scala
416
+ patterns:
417
+ - pattern: Http($URL)
418
+ message: >-
419
+ A parameter being passed directly into `Http` can likely lead to SSRF. This could allow an attacker to send
420
+ data to their own server, potentially exposing sensitive data sent with this request. They could also probe
421
+ internal servers or other resources that the server running this code can access. Do not allow arbitrary
422
+ hosts. Instead, create an allowlist for approved hosts, or hardcode the correct host.
423
+ cwe:
424
+ - CWE-918
425
+ owasp:
426
+ - A10:2021
427
+ - A01:2025
428
+ references:
429
+ - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
430
+ - https://github.com/scalaj/scalaj-http#simplified-http
431
+ tags:
432
+ - scala
433
+ - scalaj-http
434
+ - id: scalajs-eval
435
+ name: scalajs-eval
436
+ description: >-
437
+ `eval()` function evaluates JavaScript code represented as a string. Executing JavaScript from a string is an
438
+ enormous security risk. It is far too easy for a bad actor to run arbitrary code when you use `eval()`. Do not use
439
+ eval(). Alternatively: Ensure evaluated content is not definable by external sources. If it’s not possible, strip
440
+ everything except alphanumeric characters from an input provided for the command string and arguments.
441
+ category: injection
442
+ severity: medium
443
+ confidence: medium
444
+ languages:
445
+ - scala
446
+ patterns:
447
+ - regex: .*
448
+ message: >-
449
+ `eval()` function evaluates JavaScript code represented as a string. Executing JavaScript from a string is an
450
+ enormous security risk. It is far too easy for a bad actor to run arbitrary code when you use `eval()`. Do not
451
+ use eval(). Alternatively: Ensure evaluated content is not definable by external sources. If it’s not
452
+ possible, strip everything except alphanumeric characters from an input provided for the command string and
453
+ arguments.
454
+ cwe:
455
+ - CWE-94
456
+ owasp:
457
+ - A03:2021
458
+ - A05:2025
459
+ references:
460
+ - https://www.scala-js.org/doc/
461
+ tags:
462
+ - scala
463
+ - scala-js
464
+ - id: tainted-sql-string
465
+ name: tainted-sql-string
466
+ description: >-
467
+ User data flows into this manually-constructed SQL string. User data can be safely inserted into SQL strings using
468
+ prepared statements or an object-relational mapper (ORM). Manually-constructed SQL strings is a possible indicator
469
+ of SQL injection, which could let an attacker steal or manipulate data from the database. Instead, use prepared
470
+ statements (`connection.PreparedStatement`) or a safe library.
471
+ category: injection
472
+ severity: high
473
+ confidence: medium
474
+ languages:
475
+ - scala
476
+ patterns:
477
+ - regex: .*
478
+ message: >-
479
+ User data flows into this manually-constructed SQL string. User data can be safely inserted into SQL strings
480
+ using prepared statements or an object-relational mapper (ORM). Manually-constructed SQL strings is a possible
481
+ indicator of SQL injection, which could let an attacker steal or manipulate data from the database. Instead,
482
+ use prepared statements (`connection.PreparedStatement`) or a safe library.
483
+ cwe:
484
+ - CWE-89
485
+ owasp:
486
+ - A01:2017
487
+ - A03:2021
488
+ - A05:2025
489
+ references:
490
+ - https://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html
491
+ tags:
492
+ - scala
493
+ - id: xmlinputfactory-dtd-enabled
494
+ name: xmlinputfactory-dtd-enabled
495
+ description: >-
496
+ XMLInputFactory being instantiated without calling the setProperty functions that are generally used for disabling
497
+ entity processing. User controlled data in XML Document builder can result in XML Internal Entity Processing
498
+ vulnerabilities like the disclosure of confidential data, denial of service, Server Side Request Forgery (SSRF),
499
+ port scanning. Make sure to disable entity processing functionality.
500
+ category: security
501
+ severity: medium
502
+ confidence: medium
503
+ languages:
504
+ - scala
505
+ patterns:
506
+ - regex: .*
507
+ message: >-
508
+ XMLInputFactory being instantiated without calling the setProperty functions that are generally used for
509
+ disabling entity processing. User controlled data in XML Document builder can result in XML Internal Entity
510
+ Processing vulnerabilities like the disclosure of confidential data, denial of service, Server Side Request
511
+ Forgery (SSRF), port scanning. Make sure to disable entity processing functionality.
512
+ cwe:
513
+ - CWE-611
514
+ owasp:
515
+ - A04:2017
516
+ - A05:2021
517
+ - A02:2025
518
+ references:
519
+ - https://owasp.org/Top10/A05_2021-Security_Misconfiguration
520
+ tags:
521
+ - scala
522
+ - id: tainted-html-response
523
+ name: tainted-html-response
524
+ description: >-
525
+ Detected a request with potential user-input going into an `Ok()` response. This bypasses any view or template
526
+ environments, including HTML escaping, which may expose this application to cross-site scripting (XSS)
527
+ vulnerabilities. Consider using a view technology such as Twirl which automatically escapes HTML views.
528
+ category: security
529
+ severity: medium
530
+ confidence: medium
531
+ languages:
532
+ - scala
533
+ patterns:
534
+ - regex: .*
535
+ message: >-
536
+ Detected a request with potential user-input going into an `Ok()` response. This bypasses any view or template
537
+ environments, including HTML escaping, which may expose this application to cross-site scripting (XSS)
538
+ vulnerabilities. Consider using a view technology such as Twirl which automatically escapes HTML views.
539
+ cwe:
540
+ - CWE-79
541
+ owasp:
542
+ - A07:2017
543
+ - A03:2021
544
+ - A05:2025
545
+ references:
546
+ - https://owasp.org/Top10/A03_2021-Injection
547
+ tags:
548
+ - scala
549
+ - play
550
+ - id: tainted-slick-sqli
551
+ name: tainted-slick-sqli
552
+ description: >-
553
+ Detected a tainted SQL statement. This could lead to SQL injection if variables in the SQL statement are not
554
+ properly sanitized. Avoid using using user input for generating SQL strings.
555
+ category: injection
556
+ severity: high
557
+ confidence: medium
558
+ languages:
559
+ - scala
560
+ patterns:
561
+ - regex: .*
562
+ message: >-
563
+ Detected a tainted SQL statement. This could lead to SQL injection if variables in the SQL statement are not
564
+ properly sanitized. Avoid using using user input for generating SQL strings.
565
+ cwe:
566
+ - CWE-89
567
+ owasp:
568
+ - A01:2017
569
+ - A03:2021
570
+ - A05:2025
571
+ references:
572
+ - https://scala-slick.org/doc/3.3.3/sql.html#splicing-literal-values
573
+ - https://scala-slick.org/doc/3.2.0/sql-to-slick.html#non-optimal-sql-code
574
+ tags:
575
+ - scala
576
+ - slick
577
+ - play
578
+ - id: tainted-sql-from-http-request
579
+ name: tainted-sql-from-http-request
580
+ description: >-
581
+ User data flows into this manually-constructed SQL string. User data can be safely inserted into SQL strings using
582
+ prepared statements or an object-relational mapper (ORM). Manually-constructed SQL strings is a possible indicator
583
+ of SQL injection, which could let an attacker steal or manipulate data from the database. Instead, use prepared
584
+ statements (`connection.PreparedStatement`) or a safe library.
585
+ category: injection
586
+ severity: high
587
+ confidence: medium
588
+ languages:
589
+ - scala
590
+ patterns:
591
+ - regex: .*
592
+ message: >-
593
+ User data flows into this manually-constructed SQL string. User data can be safely inserted into SQL strings
594
+ using prepared statements or an object-relational mapper (ORM). Manually-constructed SQL strings is a possible
595
+ indicator of SQL injection, which could let an attacker steal or manipulate data from the database. Instead,
596
+ use prepared statements (`connection.PreparedStatement`) or a safe library.
597
+ cwe:
598
+ - CWE-89
599
+ owasp:
600
+ - A01:2017
601
+ - A03:2021
602
+ - A05:2025
603
+ references:
604
+ - https://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html
605
+ tags:
606
+ - scala
607
+ - play
608
+ - id: webservice-ssrf
609
+ name: webservice-ssrf
610
+ description: >-
611
+ A parameter being passed directly into `WSClient` most likely lead to SSRF. This could allow an attacker to send
612
+ data to their own server, potentially exposing sensitive data sent with this request. They could also probe
613
+ internal servers or other resources that the server running this code can access. Do not allow arbitrary hosts.
614
+ Instead, create an allowlist for approved hosts hardcode the correct host.
615
+ category: api-security
616
+ severity: medium
617
+ confidence: medium
618
+ languages:
619
+ - scala
620
+ patterns:
621
+ - pattern: $WS.url($URL)
622
+ message: >-
623
+ A parameter being passed directly into `WSClient` most likely lead to SSRF. This could allow an attacker to
624
+ send data to their own server, potentially exposing sensitive data sent with this request. They could also
625
+ probe internal servers or other resources that the server running this code can access. Do not allow arbitrary
626
+ hosts. Instead, create an allowlist for approved hosts hardcode the correct host.
627
+ cwe:
628
+ - CWE-918
629
+ owasp:
630
+ - A10:2021
631
+ - A01:2025
632
+ references:
633
+ - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
634
+ - https://www.playframework.com/documentation/2.8.x/ScalaWS
635
+ tags:
636
+ - scala
637
+ - play
638
+ - id: scala-jwt-hardcoded-secret
639
+ name: scala-jwt-hardcoded-secret
640
+ description: >-
641
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
642
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect the
643
+ credentials (e.g. keeping secrets in environment variables)
644
+ category: secrets
645
+ severity: high
646
+ confidence: medium
647
+ languages:
648
+ - scala
649
+ patterns:
650
+ - pattern: |
651
+ com.auth0.jwt.algorithms.Algorithm.HMAC256("...");
652
+ message: >-
653
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
654
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
655
+ the credentials (e.g. keeping secrets in environment variables)
656
+ - pattern: |
657
+ $SECRET = "...";
658
+ ...
659
+ com.auth0.jwt.algorithms.Algorithm.HMAC256($SECRET);
660
+ message: >-
661
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
662
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
663
+ the credentials (e.g. keeping secrets in environment variables)
664
+ - pattern: |
665
+ class $CLASS {
666
+ ...
667
+ $DECL $SECRET = "...";
668
+ ...
669
+ def $FUNC (...): $RETURNTYPE = {
670
+ ...
671
+ com.auth0.jwt.algorithms.Algorithm.HMAC256($SECRET);
672
+ ...
673
+ }
674
+ ...
675
+ }
676
+ message: >-
677
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
678
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
679
+ the credentials (e.g. keeping secrets in environment variables)
680
+ - pattern: |
681
+ com.auth0.jwt.algorithms.Algorithm.HMAC384("...");
682
+ message: >-
683
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
684
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
685
+ the credentials (e.g. keeping secrets in environment variables)
686
+ - pattern: |
687
+ $SECRET = "...";
688
+ ...
689
+ com.auth0.jwt.algorithms.Algorithm.HMAC384($SECRET);
690
+ message: >-
691
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
692
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
693
+ the credentials (e.g. keeping secrets in environment variables)
694
+ - pattern: |
695
+ class $CLASS {
696
+ ...
697
+ $DECL $SECRET = "...";
698
+ ...
699
+ def $FUNC (...): $RETURNTYPE = {
700
+ ...
701
+ com.auth0.jwt.algorithms.Algorithm.HMAC384($SECRET);
702
+ ...
703
+ }
704
+ ...
705
+ }
706
+ message: >-
707
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
708
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
709
+ the credentials (e.g. keeping secrets in environment variables)
710
+ - pattern: |
711
+ com.auth0.jwt.algorithms.Algorithm.HMAC512("...");
712
+ message: >-
713
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
714
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
715
+ the credentials (e.g. keeping secrets in environment variables)
716
+ - pattern: |
717
+ $SECRET = "...";
718
+ ...
719
+ com.auth0.jwt.algorithms.Algorithm.HMAC512($SECRET);
720
+ message: >-
721
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
722
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
723
+ the credentials (e.g. keeping secrets in environment variables)
724
+ - pattern: |
725
+ class $CLASS {
726
+ ...
727
+ $DECL $SECRET = "...";
728
+ ...
729
+ def $FUNC (...): $RETURNTYPE = {
730
+ ...
731
+ com.auth0.jwt.algorithms.Algorithm.HMAC512($SECRET);
732
+ ...
733
+ }
734
+ ...
735
+ }
736
+ message: >-
737
+ Hardcoded JWT secret or private key is used. This is a Insufficiently Protected Credentials weakness:
738
+ https://cwe.mitre.org/data/definitions/522.html Consider using an appropriate security mechanism to protect
739
+ the credentials (e.g. keeping secrets in environment variables)
740
+ cwe:
741
+ - CWE-522
742
+ owasp:
743
+ - A02:2017
744
+ - A04:2021
745
+ - A06:2025
746
+ references:
747
+ - https://owasp.org/Top10/A04_2021-Insecure_Design
748
+ tags:
749
+ - jwt
750
+ - id: scala-slick-overrideSql-literal
751
+ name: scala-slick-overrideSql-literal
752
+ description: >-
753
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
754
+ are not properly sanitized. Avoid using non literal values in `overrideSql(...)`.
755
+ category: injection
756
+ severity: high
757
+ confidence: medium
758
+ languages:
759
+ - scala
760
+ patterns:
761
+ - pattern: $MODEL.overrideSql($QUERY,...)
762
+ message: >-
763
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
764
+ statement are not properly sanitized. Avoid using non literal values in `overrideSql(...)`.
765
+ cwe:
766
+ - CWE-89
767
+ owasp:
768
+ - A01:2017
769
+ - A03:2021
770
+ - A05:2025
771
+ references:
772
+ - https://owasp.org/Top10/A03_2021-Injection
773
+ tags:
774
+ - scala
775
+ - slick
776
+ - id: scala-slick-sql-non-literal
777
+ name: scala-slick-sql-non-literal
778
+ description: >-
779
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement
780
+ are not properly sanitized. Avoid using `#$variable` and use `$variable` in `sql"..."` strings instead.
781
+ category: injection
782
+ severity: high
783
+ confidence: medium
784
+ languages:
785
+ - scala
786
+ patterns:
787
+ - pattern: sql"..."
788
+ message: >-
789
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
790
+ statement are not properly sanitized. Avoid using `#$variable` and use `$variable` in `sql"..."` strings
791
+ instead.
792
+ - regex: \#\$
793
+ message: >-
794
+ Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL
795
+ statement are not properly sanitized. Avoid using `#$variable` and use `$variable` in `sql"..."` strings
796
+ instead.
797
+ cwe:
798
+ - CWE-89
799
+ owasp:
800
+ - A01:2017
801
+ - A03:2021
802
+ - A05:2025
803
+ references:
804
+ - https://scala-slick.org/doc/3.3.3/sql.html#splicing-literal-values
805
+ tags:
806
+ - scala
807
+ - slick