deepscan-cli 1.0.0 → 1.2.1

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 +224 -61
  3. package/dist/bin/deepscan.js +189 -71
  4. package/dist/bin/deepscan.js.map +1 -1
  5. package/dist/{chunk-OSYJXVNF.js → chunk-4TWV5TES.js} +5130 -610
  6. package/dist/chunk-4TWV5TES.js.map +1 -0
  7. package/dist/index.d.ts +62 -5
  8. package/dist/index.js +13 -3
  9. package/package.json +38 -12
  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,362 +0,0 @@
1
- rules:
2
- - id: hooks-no-input-validation-bash
3
- name: hooks-no-input-validation-bash
4
- description: >-
5
- Piping untrusted input directly to eval, bash, or sh is dangerous in Claude Code and Cursor hooks. Validate and
6
- sanitize input before executing it.
7
- category: security
8
- severity: medium
9
- confidence: medium
10
- languages:
11
- - bash
12
- patterns:
13
- - pattern: eval $...ARGS
14
- message: >-
15
- Piping untrusted input directly to eval, bash, or sh is dangerous in Claude Code and Cursor hooks. Validate
16
- and sanitize input before executing it.
17
- - pattern: echo $...ARGS | bash
18
- message: >-
19
- Piping untrusted input directly to eval, bash, or sh is dangerous in Claude Code and Cursor hooks. Validate
20
- and sanitize input before executing it.
21
- - pattern: echo $...ARGS | sh
22
- message: >-
23
- Piping untrusted input directly to eval, bash, or sh is dangerous in Claude Code and Cursor hooks. Validate
24
- and sanitize input before executing it.
25
- cwe:
26
- - CWE-1287
27
- owasp: []
28
- references:
29
- - https://docs.anthropic.com/en/docs/claude-code/hooks
30
- - https://cursor.com/docs/agent/hooks
31
- tags:
32
- - claude-code
33
- - cursor
34
- - id: hooks-path-traversal-bash
35
- name: hooks-path-traversal-bash
36
- description: >-
37
- Hook input flows into a file path without validation. Claude Code and Cursor hooks receive JSON input that may
38
- contain user-controlled paths. An attacker could craft input with path traversal sequences (e.g.,
39
- '../../etc/passwd') to read, modify, or delete arbitrary files. Use realpath or readlink -f to resolve and
40
- validate paths before file operations.
41
- category: file-ops
42
- severity: high
43
- confidence: medium
44
- languages:
45
- - bash
46
- patterns:
47
- - regex: .*
48
- message: >-
49
- Hook input flows into a file path without validation. Claude Code and Cursor hooks receive JSON input that may
50
- contain user-controlled paths. An attacker could craft input with path traversal sequences (e.g.,
51
- '../../etc/passwd') to read, modify, or delete arbitrary files. Use realpath or readlink -f to resolve and
52
- validate paths before file operations.
53
- cwe:
54
- - CWE-22
55
- owasp: []
56
- references:
57
- - https://docs.anthropic.com/en/docs/claude-code/hooks
58
- - https://cursor.com/docs/agent/hooks
59
- tags:
60
- - claude-code
61
- - cursor
62
- - id: hooks-relative-script-path-bash
63
- name: hooks-relative-script-path-bash
64
- description: >-
65
- Relative path used for script invocation in hook. Use absolute paths or environment variables like
66
- $CLAUDE_PROJECT_DIR, $CURSOR_PROJECT_DIR, or $HOME to ensure the correct script is executed regardless of working
67
- directory.
68
- category: file-ops
69
- severity: medium
70
- confidence: medium
71
- languages:
72
- - bash
73
- patterns:
74
- - regex: (source|bash|sh|\.)\s+\./\S+
75
- message: >-
76
- Relative path used for script invocation in hook. Use absolute paths or environment variables like
77
- $CLAUDE_PROJECT_DIR, $CURSOR_PROJECT_DIR, or $HOME to ensure the correct script is executed regardless of
78
- working directory.
79
- cwe:
80
- - CWE-426
81
- owasp: []
82
- references:
83
- - https://docs.anthropic.com/en/docs/claude-code/hooks
84
- - https://cursor.com/docs/agent/hooks
85
- tags:
86
- - claude-code
87
- - cursor
88
- - id: hooks-unquoted-variable-bash-taint
89
- name: hooks-unquoted-variable-bash-taint
90
- description: >-
91
- Untrusted input from stdin (e.g., via `cat | jq`) flows into a dangerous command execution sink such as `eval`,
92
- `bash -c`, or `sh -c`. In Claude Code and Cursor hooks, stdin contains JSON that may include user-controlled data.
93
- Passing this data unquoted or unsanitized to command execution functions enables OS command injection. Use safe
94
- alternatives like arrays or direct command invocation instead of eval, and always quote variable expansions.
95
- category: security
96
- severity: high
97
- confidence: medium
98
- languages:
99
- - bash
100
- patterns:
101
- - regex: .*
102
- message: >-
103
- Untrusted input from stdin (e.g., via `cat | jq`) flows into a dangerous command execution sink such as
104
- `eval`, `bash -c`, or `sh -c`. In Claude Code and Cursor hooks, stdin contains JSON that may include
105
- user-controlled data. Passing this data unquoted or unsanitized to command execution functions enables OS
106
- command injection. Use safe alternatives like arrays or direct command invocation instead of eval, and always
107
- quote variable expansions.
108
- cwe:
109
- - CWE-78
110
- owasp: []
111
- references:
112
- - https://docs.anthropic.com/en/docs/claude-code/hooks
113
- - https://cursor.com/docs/agent/hooks
114
- tags:
115
- - claude-code
116
- - cursor
117
- - id: hooks-unquoted-variable-bash-eval
118
- name: hooks-unquoted-variable-bash-eval
119
- description: >-
120
- Use of `eval` in a Claude Code or Cursor hook script is dangerous. The `eval` command re-parses its arguments,
121
- which can lead to command injection if any variable contains special characters or attacker-controlled data. Avoid
122
- `eval` entirely; use arrays, direct command invocation, or other safe alternatives.
123
- category: injection
124
- severity: medium
125
- confidence: medium
126
- languages:
127
- - bash
128
- patterns:
129
- - pattern: eval $...ARGS
130
- message: >-
131
- Use of `eval` in a Claude Code or Cursor hook script is dangerous. The `eval` command re-parses its arguments,
132
- which can lead to command injection if any variable contains special characters or attacker-controlled data.
133
- Avoid `eval` entirely; use arrays, direct command invocation, or other safe alternatives.
134
- cwe:
135
- - CWE-78
136
- owasp: []
137
- references:
138
- - https://docs.anthropic.com/en/docs/claude-code/hooks
139
- - https://cursor.com/docs/agent/hooks
140
- tags:
141
- - claude-code
142
- - cursor
143
- - id: curl-eval
144
- name: curl-eval
145
- description: >-
146
- Data is being eval'd from a `curl` command. An attacker with control of the server in the `curl` command could
147
- inject malicious code into the `eval`, resulting in a system comrpomise. Avoid eval'ing untrusted data if you can.
148
- If you must do this, consider checking the SHA sum of the content returned by the server to verify its integrity.
149
- category: injection
150
- severity: medium
151
- confidence: medium
152
- languages:
153
- - bash
154
- patterns:
155
- - regex: .*
156
- message: >-
157
- Data is being eval'd from a `curl` command. An attacker with control of the server in the `curl` command could
158
- inject malicious code into the `eval`, resulting in a system comrpomise. Avoid eval'ing untrusted data if you
159
- can. If you must do this, consider checking the SHA sum of the content returned by the server to verify its
160
- integrity.
161
- cwe:
162
- - CWE-95
163
- owasp:
164
- - A03:2021
165
- - A05:2025
166
- references:
167
- - https://owasp.org/Top10/A03_2021-Injection
168
- tags:
169
- - bash
170
- - curl
171
- - id: curl-pipe-bash
172
- name: curl-pipe-bash
173
- description: >-
174
- Data is being piped into `bash` from a `curl` command. An attacker with control of the server in the `curl`
175
- command could inject malicious code into the pipe, resulting in a system compromise. Avoid piping untrusted data
176
- into `bash` or any other shell if you can. If you must do this, consider checking the SHA sum of the content
177
- returned by the server to verify its integrity.
178
- category: security
179
- severity: medium
180
- confidence: medium
181
- languages:
182
- - bash
183
- patterns:
184
- - regex: .*
185
- message: >-
186
- Data is being piped into `bash` from a `curl` command. An attacker with control of the server in the `curl`
187
- command could inject malicious code into the pipe, resulting in a system compromise. Avoid piping untrusted
188
- data into `bash` or any other shell if you can. If you must do this, consider checking the SHA sum of the
189
- content returned by the server to verify its integrity.
190
- cwe:
191
- - CWE-95
192
- owasp:
193
- - A03:2021
194
- - A05:2025
195
- references:
196
- - https://owasp.org/Top10/A03_2021-Injection
197
- tags:
198
- - bash
199
- - curl
200
- - id: iteration-over-ls-output
201
- name: iteration-over-ls-output
202
- description: Iterating over ls output is fragile. Use globs, e.g. 'dir/*' instead of '$(ls dir)'.
203
- category: security
204
- severity: medium
205
- confidence: medium
206
- languages:
207
- - bash
208
- patterns:
209
- - pattern: |
210
- for $VAR in $LIST; do
211
- ...
212
- done
213
- message: Iterating over ls output is fragile. Use globs, e.g. 'dir/*' instead of '$(ls dir)'.
214
- - pattern: |
215
- $(ls ...)
216
- message: Iterating over ls output is fragile. Use globs, e.g. 'dir/*' instead of '$(ls dir)'.
217
- cwe: []
218
- owasp: []
219
- references:
220
- - https://github.com/koalaman/shellcheck/wiki/SC2045
221
- tags:
222
- - bash
223
- - id: useless-cat
224
- name: useless-cat
225
- description: Useless call to 'cat' in a pipeline. Use '<' and '>' for any command to read from a file or write to a file.
226
- category: security
227
- severity: medium
228
- confidence: medium
229
- languages:
230
- - bash
231
- patterns:
232
- - pattern: |
233
- cat | ...
234
- message: Useless call to 'cat' in a pipeline. Use '<' and '>' for any command to read from a file or write to a file.
235
- - pattern: |
236
- ... | cat
237
- message: Useless call to 'cat' in a pipeline. Use '<' and '>' for any command to read from a file or write to a file.
238
- - pattern: |
239
- ... | cat | ...
240
- message: Useless call to 'cat' in a pipeline. Use '<' and '>' for any command to read from a file or write to a file.
241
- cwe: []
242
- owasp: []
243
- references:
244
- - https://github.com/koalaman/shellcheck/wiki/SC2002
245
- tags:
246
- - bash
247
- - id: unquoted-variable-expansion-in-command
248
- name: unquoted-variable-expansion-in-command
249
- description: >-
250
- Variable expansions must be double-quoted so as to prevent being split into multiple pieces according to
251
- whitespace or whichever separator is specified by the IFS variable. If you really wish to split the variable's
252
- contents, you may use a variable that starts with an underscore e.g. $_X instead of $X, and semgrep will ignore
253
- it. If what you need is an array, consider using a proper bash array.
254
- category: security
255
- severity: low
256
- confidence: medium
257
- languages:
258
- - bash
259
- patterns:
260
- - regex: .*
261
- message: >-
262
- Variable expansions must be double-quoted so as to prevent being split into multiple pieces according to
263
- whitespace or whichever separator is specified by the IFS variable. If you really wish to split the variable's
264
- contents, you may use a variable that starts with an underscore e.g. $_X instead of $X, and semgrep will
265
- ignore it. If what you need is an array, consider using a proper bash array.
266
- cwe: []
267
- owasp: []
268
- references: []
269
- tags:
270
- - bash
271
- - id: unquoted-command-substitution-in-command
272
- name: unquoted-command-substitution-in-command
273
- description: >-
274
- The result of command substitution $(...) or `...`, if unquoted, is split on whitespace or other separators
275
- specified by the IFS variable. You should surround it with double quotes to avoid splitting the result.
276
- category: security
277
- severity: low
278
- confidence: medium
279
- languages:
280
- - bash
281
- patterns:
282
- - regex: |
283
- .*(\$\([^\(]|`).+([^\)]\)|`).*
284
- message: >-
285
- The result of command substitution $(...) or `...`, if unquoted, is split on whitespace or other separators
286
- specified by the IFS variable. You should surround it with double quotes to avoid splitting the result.
287
- cwe: []
288
- owasp: []
289
- references: []
290
- tags:
291
- - bash
292
- - id: ifs-tampering
293
- name: ifs-tampering
294
- description: >-
295
- The special variable IFS affects how splitting takes place when expanding unquoted variables. Don't set it
296
- globally. Prefer a dedicated utility such as 'cut' or 'awk' if you need to split input data. If you must use
297
- 'read', set IFS locally using e.g. 'IFS="," read -a my_array'.
298
- category: security
299
- severity: medium
300
- confidence: medium
301
- languages:
302
- - bash
303
- patterns:
304
- - pattern: IFS=...
305
- message: >-
306
- The special variable IFS affects how splitting takes place when expanding unquoted variables. Don't set it
307
- globally. Prefer a dedicated utility such as 'cut' or 'awk' if you need to split input data. If you must use
308
- 'read', set IFS locally using e.g. 'IFS="," read -a my_array'.
309
- cwe:
310
- - CWE-20
311
- owasp:
312
- - A03:2021
313
- - A05:2025
314
- references:
315
- - https://owasp.org/Top10/A03_2021-Injection
316
- tags:
317
- - bash
318
- - id: contains-bidirectional-characters
319
- name: contains-bidirectional-characters
320
- description: >-
321
- This code contains bidirectional (bidi) characters. While this is useful for support of right-to-left languages
322
- such as Arabic or Hebrew, it can also be used to trick language parsers into executing code in a manner that is
323
- different from how it is displayed in code editing and review tools. If this is not what you were expecting,
324
- please review this code in an editor that can reveal hidden Unicode characters.
325
- category: security
326
- severity: medium
327
- confidence: medium
328
- languages:
329
- - bash
330
- - c
331
- - csharp
332
- - go
333
- - java
334
- - javascript
335
- - json
336
- - kotlin
337
- - lua
338
- - ocaml
339
- - php
340
- - python
341
- - ruby
342
- - rust
343
- - scala
344
- - sh
345
- - typescript
346
- - yaml
347
- patterns:
348
- - regex: .*
349
- message: >-
350
- This code contains bidirectional (bidi) characters. While this is useful for support of right-to-left
351
- languages such as Arabic or Hebrew, it can also be used to trick language parsers into executing code in a
352
- manner that is different from how it is displayed in code editing and review tools. If this is not what you
353
- were expecting, please review this code in an editor that can reveal hidden Unicode characters.
354
- cwe:
355
- - CWE-94
356
- owasp:
357
- - A03:2021
358
- - A05:2025
359
- references:
360
- - https://trojansource.codes/
361
- tags:
362
- - unicode