deepscan-cli 1.0.0 → 1.2.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 (46) hide show
  1. package/NOTICE +5 -0
  2. package/README.md +174 -59
  3. package/dist/bin/deepscan.js +189 -71
  4. package/dist/bin/deepscan.js.map +1 -1
  5. package/dist/{chunk-OSYJXVNF.js → chunk-KITQQYNW.js} +5071 -596
  6. package/dist/chunk-KITQQYNW.js.map +1 -0
  7. package/dist/index.d.ts +61 -5
  8. package/dist/index.js +13 -3
  9. package/package.json +23 -5
  10. package/rules/built-in/default-config.yml +28 -3
  11. package/rules/built-in/operations.yml +287 -0
  12. package/rules/built-in/security.yml +12 -6
  13. package/dist/chunk-OSYJXVNF.js.map +0 -1
  14. package/rules/built-in/converted-semgrep.yml +0 -37
  15. package/rules/built-in/semgrep-apex.yml +0 -336
  16. package/rules/built-in/semgrep-bash.yml +0 -362
  17. package/rules/built-in/semgrep-c.yml +0 -429
  18. package/rules/built-in/semgrep-clojure.yml +0 -166
  19. package/rules/built-in/semgrep-csharp.yml +0 -1260
  20. package/rules/built-in/semgrep-dart.yml +0 -21
  21. package/rules/built-in/semgrep-dockerfile.yml +0 -874
  22. package/rules/built-in/semgrep-elixir.yml +0 -146
  23. package/rules/built-in/semgrep-generic.yml +0 -2945
  24. package/rules/built-in/semgrep-go.yml +0 -2898
  25. package/rules/built-in/semgrep-hcl.yml +0 -8181
  26. package/rules/built-in/semgrep-html.yml +0 -94
  27. package/rules/built-in/semgrep-java.yml +0 -4219
  28. package/rules/built-in/semgrep-javascript.yml +0 -6243
  29. package/rules/built-in/semgrep-json.yml +0 -360
  30. package/rules/built-in/semgrep-kotlin.yml +0 -540
  31. package/rules/built-in/semgrep-lua.yml +0 -46
  32. package/rules/built-in/semgrep-ocaml.yml +0 -773
  33. package/rules/built-in/semgrep-php.yml +0 -1638
  34. package/rules/built-in/semgrep-python.yml +0 -11240
  35. package/rules/built-in/semgrep-regex.yml +0 -6444
  36. package/rules/built-in/semgrep-ruby.yml +0 -2687
  37. package/rules/built-in/semgrep-rust.yml +0 -278
  38. package/rules/built-in/semgrep-scala.yml +0 -807
  39. package/rules/built-in/semgrep-sh.yml +0 -46
  40. package/rules/built-in/semgrep-solidity.yml +0 -1046
  41. package/rules/built-in/semgrep-swift.yml +0 -200
  42. package/rules/built-in/semgrep-terraform.yml +0 -147
  43. package/rules/built-in/semgrep-typescript.yml +0 -6212
  44. package/rules/built-in/semgrep-xml.yml +0 -31
  45. package/rules/built-in/semgrep-yaml.yml +0 -2785
  46. package/rules/examples/custom-api-security.yml +0 -66
@@ -1,773 +0,0 @@
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: ocamllint-bool-true
48
- name: ocamllint-bool-true
49
- description: Comparison to boolean. Just use `$X`
50
- category: security
51
- severity: medium
52
- confidence: medium
53
- languages:
54
- - ocaml
55
- patterns:
56
- - pattern: $X = true
57
- message: Comparison to boolean. Just use `$X`
58
- - pattern: $X == true
59
- message: Comparison to boolean. Just use `$X`
60
- - pattern: $X != false
61
- message: Comparison to boolean. Just use `$X`
62
- cwe: []
63
- owasp: []
64
- references: []
65
- tags:
66
- - ocaml
67
- - id: ocamllint-bool-false
68
- name: ocamllint-bool-false
69
- description: Comparison to boolean. Just use `not $X`
70
- category: security
71
- severity: medium
72
- confidence: medium
73
- languages:
74
- - ocaml
75
- patterns:
76
- - pattern: $X = false
77
- message: Comparison to boolean. Just use `not $X`
78
- - pattern: $X == false
79
- message: Comparison to boolean. Just use `not $X`
80
- - pattern: $X <> true
81
- message: Comparison to boolean. Just use `not $X`
82
- cwe: []
83
- owasp: []
84
- references: []
85
- tags:
86
- - ocaml
87
- - id: bad-reraise
88
- name: bad-reraise
89
- description: >-
90
- You should not re-raise exceptions using 'raise' because it loses track of where the exception was raised
91
- originally, leading to a useless and possibly confusing stack trace. Instead, you should obtain a stack backtrace
92
- as soon as the exception is caught using 'try ... with exn -> let trace = Printexc.get_raw_backtrace () in ...',
93
- and keep it around until you re-raise the exception using 'Printexc.raise_with_backtrace exn trace'. You must
94
- collect the stack backtrace before calling another function which might internally raise and catch exceptions. To
95
- avoid false positives from Semgrep, write 'raise (Foo args)' instead of 'let e = Foo args in raise e'.
96
- category: security
97
- severity: medium
98
- confidence: medium
99
- languages:
100
- - ocaml
101
- patterns:
102
- - pattern: |
103
- raise $EXN
104
- message: >-
105
- You should not re-raise exceptions using 'raise' because it loses track of where the exception was raised
106
- originally, leading to a useless and possibly confusing stack trace. Instead, you should obtain a stack
107
- backtrace as soon as the exception is caught using 'try ... with exn -> let trace = Printexc.get_raw_backtrace
108
- () in ...', and keep it around until you re-raise the exception using 'Printexc.raise_with_backtrace exn
109
- trace'. You must collect the stack backtrace before calling another function which might internally raise and
110
- catch exceptions. To avoid false positives from Semgrep, write 'raise (Foo args)' instead of 'let e = Foo args
111
- in raise e'.
112
- cwe: []
113
- owasp: []
114
- references:
115
- - https://v2.ocaml.org/api/Printexc.html
116
- tags:
117
- - ocaml
118
- - id: hashtbl-find-outside-try
119
- name: hashtbl-find-outside-try
120
- description: >-
121
- 'Hashtbl.find' raises the 'Not_found' exception. Handle the exception or use 'Hashtbl.find_opt' instead. If you
122
- have proof that the key exists in the table, use 'assert false' as the exception handler to demonstrate awareness
123
- of the issue. If your code uses the syntax 'match Hashtbl.find ... with exception Not_found -> ...', it's fine and
124
- we apologize for not detecting it. Consider using 'Hashtbl.find_opt' to please Semgrep and stay safe.
125
- category: crypto
126
- severity: medium
127
- confidence: medium
128
- languages:
129
- - ocaml
130
- patterns:
131
- - pattern: |
132
- Hashtbl.find ...
133
- message: >-
134
- 'Hashtbl.find' raises the 'Not_found' exception. Handle the exception or use 'Hashtbl.find_opt' instead. If
135
- you have proof that the key exists in the table, use 'assert false' as the exception handler to demonstrate
136
- awareness of the issue. If your code uses the syntax 'match Hashtbl.find ... with exception Not_found -> ...',
137
- it's fine and we apologize for not detecting it. Consider using 'Hashtbl.find_opt' to please Semgrep and stay
138
- safe.
139
- cwe: []
140
- owasp: []
141
- references: []
142
- tags:
143
- - ocaml
144
- - id: ocamllint-useless-else
145
- name: ocamllint-useless-else
146
- description: Useless else. Just remove the else branch;
147
- category: security
148
- severity: medium
149
- confidence: medium
150
- languages:
151
- - ocaml
152
- patterns:
153
- - pattern: if $E then $E1 else ()
154
- message: Useless else. Just remove the else branch;
155
- cwe: []
156
- owasp: []
157
- references: []
158
- tags:
159
- - ocaml
160
- - id: ocamllint-backwards-if
161
- name: ocamllint-backwards-if
162
- description: Backwards if. Rewrite the code as 'if not $E then $E2'.
163
- category: security
164
- severity: medium
165
- confidence: medium
166
- languages:
167
- - ocaml
168
- patterns:
169
- - pattern: if $E then () else $E2
170
- message: Backwards if. Rewrite the code as 'if not $E then $E2'.
171
- cwe: []
172
- owasp: []
173
- references: []
174
- tags:
175
- - ocaml
176
- - id: list-find-outside-try
177
- name: list-find-outside-try
178
- description: You should not use List.find outside of a try, or you should use List.find_opt
179
- category: security
180
- severity: medium
181
- confidence: medium
182
- languages:
183
- - ocaml
184
- patterns:
185
- - pattern: |
186
- List.find ...
187
- message: You should not use List.find outside of a try, or you should use List.find_opt
188
- cwe: []
189
- owasp: []
190
- references: []
191
- tags:
192
- - ocaml
193
- - id: mutex-lock-exn
194
- name: mutex-lock-exn
195
- description: >-
196
- Raw `Mutex.lock`/`Mutex.unlock` is not exception-safe. If an exception is raised between lock and unlock, the
197
- mutex will never be released, causing a deadlock. Replace with `Mutex.protect $MUTEX (fun () -> ...)` which
198
- guarantees the mutex is released even when exceptions are raised.
199
- category: security
200
- severity: medium
201
- confidence: medium
202
- languages:
203
- - ocaml
204
- patterns:
205
- - pattern: Mutex.lock $MUTEX
206
- message: >-
207
- Raw `Mutex.lock`/`Mutex.unlock` is not exception-safe. If an exception is raised between lock and unlock, the
208
- mutex will never be released, causing a deadlock. Replace with `Mutex.protect $MUTEX (fun () -> ...)` which
209
- guarantees the mutex is released even when exceptions are raised.
210
- cwe: []
211
- owasp: []
212
- references: []
213
- tags:
214
- - ocaml
215
- - id: ocamllint-ref-incr
216
- name: ocamllint-ref-incr
217
- description: You should use `incr`
218
- category: security
219
- severity: medium
220
- confidence: medium
221
- languages:
222
- - ocaml
223
- patterns:
224
- - pattern: $X := ! $X + 1
225
- message: You should use `incr`
226
- cwe: []
227
- owasp: []
228
- references:
229
- - https://v2.ocaml.org/api/Stdlib.html#VALincr
230
- - https://v2.ocaml.org/api/Atomic.html#VALincr
231
- tags:
232
- - ocaml
233
- - id: ocamllint-ref-decr
234
- name: ocamllint-ref-decr
235
- description: You should use `decr`
236
- category: security
237
- severity: medium
238
- confidence: medium
239
- languages:
240
- - ocaml
241
- patterns:
242
- - pattern: $X := ! $X - 1
243
- message: You should use `decr`
244
- cwe: []
245
- owasp: []
246
- references:
247
- - https://v2.ocaml.org/api/Stdlib.html#VALdecr
248
- - https://v2.ocaml.org/api/Atomic.html#VALdecr
249
- tags:
250
- - ocaml
251
- - id: ocamllint-str-first-chars
252
- name: ocamllint-str-first-chars
253
- description: Use instead `Str.first_chars`
254
- category: security
255
- severity: medium
256
- confidence: medium
257
- languages:
258
- - ocaml
259
- patterns:
260
- - pattern: String.sub $S 0 $N
261
- message: Use instead `Str.first_chars`
262
- cwe: []
263
- owasp: []
264
- references: []
265
- tags:
266
- - ocaml
267
- - id: ocamllint-str-string-after
268
- name: ocamllint-str-string-after
269
- description: Use instead `Str.string_after`
270
- category: security
271
- severity: medium
272
- confidence: medium
273
- languages:
274
- - ocaml
275
- patterns:
276
- - pattern: String.sub $S $N (String.length $S - $N)
277
- message: Use instead `Str.string_after`
278
- cwe: []
279
- owasp: []
280
- references: []
281
- tags:
282
- - ocaml
283
- - id: ocamllint-str-last-chars
284
- name: ocamllint-str-last-chars
285
- description: Use instead `Str.last_chars`
286
- category: security
287
- severity: medium
288
- confidence: medium
289
- languages:
290
- - ocaml
291
- patterns:
292
- - pattern: String.sub $S (String.length $S - $N) $N
293
- message: Use instead `Str.last_chars`
294
- cwe: []
295
- owasp: []
296
- references: []
297
- tags:
298
- - ocaml
299
- - id: ocamllint-useless-sprintf
300
- name: ocamllint-useless-sprintf
301
- description: Useless sprintf
302
- category: security
303
- severity: medium
304
- confidence: medium
305
- languages:
306
- - ocaml
307
- patterns:
308
- - pattern: Printf.sprintf "..."
309
- message: Useless sprintf
310
- - pattern: Printf.sprintf "%s" $S
311
- message: Useless sprintf
312
- cwe: []
313
- owasp: []
314
- references: []
315
- tags:
316
- - ocaml
317
- - id: deprecated-pervasives
318
- name: deprecated-pervasives
319
- description: Pervasives is deprecated and will not be available after 4.10. Use Stdlib.
320
- category: security
321
- severity: high
322
- confidence: medium
323
- languages:
324
- - ocaml
325
- patterns:
326
- - pattern: Pervasives.$X
327
- message: Pervasives is deprecated and will not be available after 4.10. Use Stdlib.
328
- cwe: []
329
- owasp: []
330
- references: []
331
- tags:
332
- - ocaml
333
- - id: physical-equal
334
- name: physical-equal
335
- description: You probably want the structural equality operator =
336
- category: security
337
- severity: medium
338
- confidence: medium
339
- languages:
340
- - ocaml
341
- patterns:
342
- - pattern: $X == $Y
343
- message: You probably want the structural equality operator =
344
- cwe: []
345
- owasp: []
346
- references:
347
- - https://v2.ocaml.org/api/Stdlib.html#1_Comparisons
348
- tags:
349
- - ocaml
350
- - id: physical-not-equal
351
- name: physical-not-equal
352
- description: You probably want the structural inequality operator <>
353
- category: security
354
- severity: medium
355
- confidence: medium
356
- languages:
357
- - ocaml
358
- patterns:
359
- - pattern: $X != $Y
360
- message: You probably want the structural inequality operator <>
361
- cwe: []
362
- owasp: []
363
- references:
364
- - https://v2.ocaml.org/api/Stdlib.html#1_Comparisons
365
- tags:
366
- - ocaml
367
- - id: useless-compare
368
- name: useless-compare
369
- description: >-
370
- This comparison is useless because the expressions being compared are identical. This is expected to always return
371
- the same result, 0, unless your code is really strange.
372
- category: security
373
- severity: high
374
- confidence: medium
375
- languages:
376
- - ocaml
377
- patterns:
378
- - regex: .*
379
- message: >-
380
- This comparison is useless because the expressions being compared are identical. This is expected to always
381
- return the same result, 0, unless your code is really strange.
382
- cwe: []
383
- owasp: []
384
- references: []
385
- tags:
386
- - ocaml
387
- - id: useless-equal
388
- name: useless-equal
389
- description: This is always true. If testing for floating point NaN, use `Float.is_nan` instead.
390
- category: security
391
- severity: high
392
- confidence: medium
393
- languages:
394
- - ocaml
395
- patterns:
396
- - pattern: $X = $X
397
- message: This is always true. If testing for floating point NaN, use `Float.is_nan` instead.
398
- cwe: []
399
- owasp: []
400
- references: []
401
- tags:
402
- - ocaml
403
- - id: ocamllint-useless-if
404
- name: ocamllint-useless-if
405
- description: Useless if. Both branches are equal.
406
- category: security
407
- severity: high
408
- confidence: medium
409
- languages:
410
- - ocaml
411
- patterns:
412
- - pattern: if $X then $E else $E
413
- message: Useless if. Both branches are equal.
414
- cwe: []
415
- owasp: []
416
- references: []
417
- tags:
418
- - ocaml
419
- - id: useless-let
420
- name: useless-let
421
- description: Useless let
422
- category: security
423
- severity: high
424
- confidence: medium
425
- languages:
426
- - ocaml
427
- patterns:
428
- - pattern: let $X = $E in $X
429
- message: Useless let
430
- cwe: []
431
- owasp: []
432
- references: []
433
- tags:
434
- - ocaml
435
- - id: ocamllint-length-list-zero
436
- name: ocamllint-length-list-zero
437
- description: You probably want $X = [], which is faster.
438
- category: security
439
- severity: medium
440
- confidence: medium
441
- languages:
442
- - ocaml
443
- patterns:
444
- - pattern: List.length $X = 0
445
- message: You probably want $X = [], which is faster.
446
- cwe: []
447
- owasp: []
448
- references: []
449
- tags:
450
- - ocaml
451
- - id: ocamllint-length-more-than-zero
452
- name: ocamllint-length-more-than-zero
453
- description: You probably want $X <> [], which is faster.
454
- category: security
455
- severity: medium
456
- confidence: medium
457
- languages:
458
- - ocaml
459
- patterns:
460
- - pattern: List.length $X > 0
461
- message: You probably want $X <> [], which is faster.
462
- cwe: []
463
- owasp: []
464
- references: []
465
- tags:
466
- - ocaml
467
- - id: broken-input-line
468
- name: broken-input-line
469
- description: >-
470
- 'input_line' leaves a '\r' (CR) character when reading lines from a Windows text file, whose lines end in "\r\n"
471
- (CRLF). This is a problem for any Windows file that is being read either on a Unix-like platform or on Windows in
472
- binary mode. If the code already takes care of removing any trailing '\r' after reading the line, add a '(*
473
- nosemgrep *)' comment to disable this warning.
474
- category: security
475
- severity: medium
476
- confidence: medium
477
- languages:
478
- - ocaml
479
- patterns:
480
- - pattern: |
481
- input_line
482
- message: >-
483
- 'input_line' leaves a '\r' (CR) character when reading lines from a Windows text file, whose lines end in
484
- "\r\n" (CRLF). This is a problem for any Windows file that is being read either on a Unix-like platform or on
485
- Windows in binary mode. If the code already takes care of removing any trailing '\r' after reading the line,
486
- add a '(* nosemgrep *)' comment to disable this warning.
487
- cwe: []
488
- owasp: []
489
- references: []
490
- tags:
491
- - ocaml
492
- - id: prefer-read-in-binary-mode
493
- name: prefer-read-in-binary-mode
494
- description: >-
495
- 'open_in' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the same
496
- behavior everywhere, use 'open_in_bin' or 'open_in_gen [Open_binary]'. If you really want CRLF-to-LF translations
497
- to take place when running on Windows, use 'open_in_gen [Open_text]'.
498
- category: security
499
- severity: medium
500
- confidence: medium
501
- languages:
502
- - ocaml
503
- patterns:
504
- - pattern: open_in
505
- message: >-
506
- 'open_in' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the
507
- same behavior everywhere, use 'open_in_bin' or 'open_in_gen [Open_binary]'. If you really want CRLF-to-LF
508
- translations to take place when running on Windows, use 'open_in_gen [Open_text]'.
509
- cwe: []
510
- owasp: []
511
- references: []
512
- tags:
513
- - ocaml
514
- - id: prefer-write-in-binary-mode
515
- name: prefer-write-in-binary-mode
516
- description: >-
517
- 'open_out' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the same
518
- behavior everywhere, use 'open_out_bin' or 'open_out_gen [Open_binary]'. If you really want LF-to-CRLF
519
- translations to take place when running on Windows, use 'open_out_gen [Open_text]'.
520
- category: security
521
- severity: medium
522
- confidence: medium
523
- languages:
524
- - ocaml
525
- patterns:
526
- - pattern: open_out
527
- message: >-
528
- 'open_out' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the
529
- same behavior everywhere, use 'open_out_bin' or 'open_out_gen [Open_binary]'. If you really want LF-to-CRLF
530
- translations to take place when running on Windows, use 'open_out_gen [Open_text]'.
531
- cwe: []
532
- owasp: []
533
- references: []
534
- tags:
535
- - ocaml
536
- - id: not-portable-tmp-string
537
- name: not-portable-tmp-string
538
- description: You should probably use Filename.get_temp_dirname().
539
- category: security
540
- severity: medium
541
- confidence: medium
542
- languages:
543
- - ocaml
544
- patterns:
545
- - pattern: |
546
- "=~/\/tmp/"
547
- message: You should probably use Filename.get_temp_dirname().
548
- cwe: []
549
- owasp: []
550
- references: []
551
- tags:
552
- - ocaml
553
- - id: ocamllint-digest
554
- name: ocamllint-digest
555
- description: Digest uses MD5 and should not be used for security purposes. Consider using SHA256 instead.
556
- category: security
557
- severity: medium
558
- confidence: medium
559
- languages:
560
- - ocaml
561
- patterns:
562
- - pattern: Digest.string
563
- message: Digest uses MD5 and should not be used for security purposes. Consider using SHA256 instead.
564
- - pattern: Digest.bytes
565
- message: Digest uses MD5 and should not be used for security purposes. Consider using SHA256 instead.
566
- - pattern: Digest.substring
567
- message: Digest uses MD5 and should not be used for security purposes. Consider using SHA256 instead.
568
- - pattern: Digest.subbytes
569
- message: Digest uses MD5 and should not be used for security purposes. Consider using SHA256 instead.
570
- - pattern: Digest.channel
571
- message: Digest uses MD5 and should not be used for security purposes. Consider using SHA256 instead.
572
- - pattern: Digest.file
573
- message: Digest uses MD5 and should not be used for security purposes. Consider using SHA256 instead.
574
- cwe:
575
- - CWE-328
576
- owasp: []
577
- references:
578
- - https://v2.ocaml.org/api/Digest.html
579
- tags:
580
- - ocaml
581
- - id: ocamllint-exec
582
- name: ocamllint-exec
583
- description: Executing external programs might lead to comand or argument injection vulnerabilities.
584
- category: security
585
- severity: medium
586
- confidence: medium
587
- languages:
588
- - ocaml
589
- patterns:
590
- - regex: .*
591
- message: Executing external programs might lead to comand or argument injection vulnerabilities.
592
- cwe:
593
- - CWE-78
594
- owasp: []
595
- references:
596
- - https://v2.ocaml.org/api/Unix.html
597
- tags:
598
- - ocaml
599
- - id: ocamllint-filenameconcat
600
- name: ocamllint-filenameconcat
601
- description: When attacker supplied data is passed to Filename.concat directory traversal attacks might be possible.
602
- category: file-ops
603
- severity: medium
604
- confidence: medium
605
- languages:
606
- - ocaml
607
- patterns:
608
- - pattern: Filename.concat
609
- message: When attacker supplied data is passed to Filename.concat directory traversal attacks might be possible.
610
- cwe:
611
- - CWE-35
612
- owasp: []
613
- references:
614
- - https://v2.ocaml.org/api/Filename.html
615
- tags:
616
- - ocaml
617
- - id: ocamllint-hashtable-dos
618
- name: ocamllint-hashtable-dos
619
- description: >-
620
- Creating a Hashtbl without the optional random number parameter makes it prone to DoS attacks when attackers are
621
- able to fill the table with malicious content. Hashtbl.randomize or the R flag in the OCAMLRUNPARAM are other ways
622
- to randomize it.
623
- category: crypto
624
- severity: medium
625
- confidence: medium
626
- languages:
627
- - ocaml
628
- patterns:
629
- - pattern: Hashtbl.create $Y
630
- message: >-
631
- Creating a Hashtbl without the optional random number parameter makes it prone to DoS attacks when attackers
632
- are able to fill the table with malicious content. Hashtbl.randomize or the R flag in the OCAMLRUNPARAM are
633
- other ways to randomize it.
634
- cwe:
635
- - CWE-399
636
- owasp: []
637
- references:
638
- - https://v2.ocaml.org/api/Hashtbl.html
639
- tags:
640
- - ocaml
641
- - id: ocamllint-marshal
642
- name: ocamllint-marshal
643
- description: >-
644
- Marshaling is currently not type-safe and can lead to insecure behaviour when untrusted data is marshalled.
645
- Marshalling can lead to out-of-bound reads as well.
646
- category: security
647
- severity: medium
648
- confidence: medium
649
- languages:
650
- - ocaml
651
- patterns:
652
- - pattern: input_value
653
- message: >-
654
- Marshaling is currently not type-safe and can lead to insecure behaviour when untrusted data is marshalled.
655
- Marshalling can lead to out-of-bound reads as well.
656
- - pattern: Marshal.from_channel
657
- message: >-
658
- Marshaling is currently not type-safe and can lead to insecure behaviour when untrusted data is marshalled.
659
- Marshalling can lead to out-of-bound reads as well.
660
- - pattern: Marshal.from_bytes
661
- message: >-
662
- Marshaling is currently not type-safe and can lead to insecure behaviour when untrusted data is marshalled.
663
- Marshalling can lead to out-of-bound reads as well.
664
- - pattern: Marshal.from_string
665
- message: >-
666
- Marshaling is currently not type-safe and can lead to insecure behaviour when untrusted data is marshalled.
667
- Marshalling can lead to out-of-bound reads as well.
668
- cwe:
669
- - CWE-502
670
- owasp: []
671
- references:
672
- - https://eternal.red/2021/secure-ocaml-sandbox/
673
- tags:
674
- - ocaml
675
- - id: ocamllint-tempfile
676
- name: ocamllint-tempfile
677
- description: >-
678
- Filename.temp_file might lead to race conditions, since the file could be altered or replaced by a symlink before
679
- being opened.
680
- category: file-ops
681
- severity: medium
682
- confidence: medium
683
- languages:
684
- - ocaml
685
- patterns:
686
- - pattern: Filename.temp_file
687
- message: >-
688
- Filename.temp_file might lead to race conditions, since the file could be altered or replaced by a symlink
689
- before being opened.
690
- cwe:
691
- - CWE-367
692
- owasp: []
693
- references:
694
- - https://v2.ocaml.org/api/Filename.html
695
- tags:
696
- - ocaml
697
- - id: ocamllint-unsafe
698
- name: ocamllint-unsafe
699
- description: Unsafe functions do not perform boundary checks or have other side effects, use with care.
700
- category: security
701
- severity: medium
702
- confidence: medium
703
- languages:
704
- - ocaml
705
- patterns:
706
- - pattern: $X.unsafe_get
707
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
708
- - pattern: $X.unsafe_set
709
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
710
- - pattern: $X.unsafe_to_string
711
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
712
- - pattern: $X.unsafe_of_string
713
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
714
- - pattern: $X.unsafe_blit
715
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
716
- - pattern: $X.unsafe_blit_string
717
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
718
- - pattern: $X.unsafe_fill
719
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
720
- - pattern: $X.unsafe_to_string
721
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
722
- - pattern: $X.unsafe_getenv
723
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
724
- - pattern: $X.unsafe_environment
725
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
726
- - pattern: $X.unsafe_chr
727
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
728
- - pattern: $X.unsafe_of_int
729
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
730
- - pattern: $X.unsafe_output
731
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
732
- - pattern: $X.unsafe_output_string
733
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
734
- - pattern: $X.unsafe_read
735
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
736
- - pattern: $X.unsafe_recv
737
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
738
- - pattern: $X.unsafe_recvfrom
739
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
740
- - pattern: $X.unsafe_send
741
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
742
- - pattern: $X.unsafe_sendto
743
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
744
- - pattern: $X.unsafe_set
745
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
746
- - pattern: $X.unsafe_set_int16
747
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
748
- - pattern: $X.unsafe_set_int32
749
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
750
- - pattern: $X.unsafe_set_int64
751
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
752
- - pattern: $X.unsafe_set_int8
753
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
754
- - pattern: $X.unsafe_set_uint16_ne
755
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
756
- - pattern: $X.unsafe_set_uint8
757
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
758
- - pattern: $X.unsafe_single_write
759
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
760
- - pattern: $X.unsafe_string
761
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
762
- - pattern: $X.unsafe_sub
763
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
764
- - pattern: $X.unsafe_write
765
- message: Unsafe functions do not perform boundary checks or have other side effects, use with care.
766
- cwe:
767
- - CWE-242
768
- owasp: []
769
- references:
770
- - https://v2.ocaml.org/api/Bigarray.Array1.html#VALunsafe_get
771
- - https://v2.ocaml.org/api/Bytes.html#VALunsafe_to_string
772
- tags:
773
- - ocaml