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,336 @@
1
+ rules:
2
+ - id: global-access-modifiers
3
+ name: global-access-modifiers
4
+ description: >-
5
+ Global classes, methods, and variables should be avoided (especially in managed packages) as they can never be
6
+ deleted or changed in signature. Always check twice if something needs to be global.
7
+ category: security
8
+ severity: medium
9
+ confidence: medium
10
+ languages:
11
+ - apex
12
+ patterns:
13
+ - regex: global [A-Za-z0-9_]{3,}
14
+ message: >-
15
+ Global classes, methods, and variables should be avoided (especially in managed packages) as they can never be
16
+ deleted or changed in signature. Always check twice if something needs to be global.
17
+ cwe:
18
+ - CWE-284
19
+ owasp: []
20
+ references:
21
+ - https://cwe.mitre.org/data/definitions/284.html
22
+ tags:
23
+ - salesforce
24
+ - id: absolute-urls
25
+ name: absolute-urls
26
+ description: >-
27
+ Using absolute URLs to Salesforce Pages is bug prone. Different sandboxes and production environments will have
28
+ different instance names (like "na10", "na15" etc.). Code using absolute URLs will only work when it runs in the
29
+ corresponding salesforce instances. It will break as soon as it is deployed in another one. Thus only relative
30
+ URLs, i.e. without the domain and subdomain names, should be used when pointing to a salesforce page.
31
+ category: security
32
+ severity: medium
33
+ confidence: medium
34
+ languages:
35
+ - apex
36
+ patterns:
37
+ - regex: (http|https)://.*(salesforce|force|visualforce)\.com\.*
38
+ message: >-
39
+ Using absolute URLs to Salesforce Pages is bug prone. Different sandboxes and production environments will
40
+ have different instance names (like "na10", "na15" etc.). Code using absolute URLs will only work when it runs
41
+ in the corresponding salesforce instances. It will break as soon as it is deployed in another one. Thus only
42
+ relative URLs, i.e. without the domain and subdomain names, should be used when pointing to a salesforce page.
43
+ cwe: []
44
+ owasp: []
45
+ references:
46
+ - ''
47
+ tags:
48
+ - salesforce
49
+ - id: apex-csrf-constructor
50
+ name: apex-csrf-constructor
51
+ description: >-
52
+ Having DML operations in Apex class constructor or initializers can have unexpected side effects: By just
53
+ accessing a page, the DML statements would be executed and the database would be modified. Just querying the
54
+ database is permitted.
55
+ category: api-security
56
+ severity: high
57
+ confidence: medium
58
+ languages:
59
+ - apex
60
+ patterns:
61
+ - regex: .*
62
+ message: >-
63
+ Having DML operations in Apex class constructor or initializers can have unexpected side effects: By just
64
+ accessing a page, the DML statements would be executed and the database would be modified. Just querying the
65
+ database is permitted.
66
+ cwe:
67
+ - CWE-352
68
+ owasp:
69
+ - A01:2021
70
+ - A01:2025
71
+ references:
72
+ - https://cwe.mitre.org/data/definitions/352.html
73
+ tags:
74
+ - salesforce
75
+ - id: dml-native-statements
76
+ name: dml-native-statements
77
+ description: >-
78
+ Native Salesforce DML operations execute in system context, ignoring the current user's permissions, field-level
79
+ security, organization-wide defaults, position in the role hierarchy, and sharing rules. Be mindful when using
80
+ native Salesforce DML operations.
81
+ category: security
82
+ severity: medium
83
+ confidence: medium
84
+ languages:
85
+ - apex
86
+ patterns:
87
+ - regex: .*
88
+ message: >-
89
+ Native Salesforce DML operations execute in system context, ignoring the current user's permissions,
90
+ field-level security, organization-wide defaults, position in the role hierarchy, and sharing rules. Be
91
+ mindful when using native Salesforce DML operations.
92
+ cwe:
93
+ - CWE-863
94
+ owasp:
95
+ - A01:2021
96
+ - A04:2021
97
+ - A01:2025
98
+ - A06:2025
99
+ references:
100
+ - https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_dml_section.htm
101
+ - https://cwe.mitre.org/data/definitions/863.html
102
+ - https://owasp.org/Top10/A04_2021-Insecure_Design/
103
+ tags:
104
+ - salesforce
105
+ - id: bad-crypto
106
+ name: bad-crypto
107
+ description: >-
108
+ The rule makes sure you are using randomly generated IVs and keys for Crypto calls. Hard-coding these values
109
+ greatly compromises the security of encrypted data.
110
+ category: crypto
111
+ severity: high
112
+ confidence: medium
113
+ languages:
114
+ - apex
115
+ patterns:
116
+ - pattern: Blob $IV = Blob.valueOf('$STRING');...Crypto.encrypt($ONE, $TWO, $IV, $FOUR);
117
+ message: >-
118
+ The rule makes sure you are using randomly generated IVs and keys for Crypto calls. Hard-coding these values
119
+ greatly compromises the security of encrypted data.
120
+ - pattern: Blob $IV = Blob.valueOf('$STRING');...Crypto.decrypt($ONE, $TWO, $IV, $FOUR);
121
+ message: >-
122
+ The rule makes sure you are using randomly generated IVs and keys for Crypto calls. Hard-coding these values
123
+ greatly compromises the security of encrypted data.
124
+ - pattern: Blob $KEY = Blob.valueOf('$STRING');...Crypto.encrypt($ONE, $KEY, $THREE, $FOUR);
125
+ message: >-
126
+ The rule makes sure you are using randomly generated IVs and keys for Crypto calls. Hard-coding these values
127
+ greatly compromises the security of encrypted data.
128
+ - pattern: Blob $KEY = Blob.valueOf('$STRING');...Crypto.decrypt($ONE, $KEY, $THREE, $FOUR);
129
+ message: >-
130
+ The rule makes sure you are using randomly generated IVs and keys for Crypto calls. Hard-coding these values
131
+ greatly compromises the security of encrypted data.
132
+ cwe:
133
+ - CWE-321
134
+ owasp:
135
+ - A02:2021
136
+ - A04:2025
137
+ references:
138
+ - https://cwe.mitre.org/data/definitions/321.html
139
+ tags:
140
+ - salesforce
141
+ - id: insecure-http-request
142
+ name: insecure-http-request
143
+ description: >-
144
+ The software transmits sensitive or security-critical data in cleartext in a communication channel that can be
145
+ sniffed by unauthorized actors.
146
+ category: security
147
+ severity: high
148
+ confidence: medium
149
+ languages:
150
+ - apex
151
+ patterns:
152
+ - regex: http[:][/][/]
153
+ message: >-
154
+ The software transmits sensitive or security-critical data in cleartext in a communication channel that can be
155
+ sniffed by unauthorized actors.
156
+ cwe:
157
+ - CWE-319
158
+ owasp: []
159
+ references:
160
+ - https://cwe.mitre.org/data/definitions/319.html
161
+ tags:
162
+ - salesforce
163
+ - id: named-credentials-constant-match
164
+ name: named-credentials-constant-match
165
+ description: >-
166
+ Named Credentials (and callout endpoints) should be used instead of hard-coding credentials. 1. Hard-coded
167
+ credentials are hard to maintain when mixed in with application code. 2. It is particularly hard to update
168
+ hard-coded credentials when they are used amongst different classes. 3. Granting a developer access to the
169
+ codebase means granting knowledge of credentials, and thus keeping a two-level access is not possible. 4. Using
170
+ different credentials for different environments is troublesome and error-prone.
171
+ category: security
172
+ severity: high
173
+ confidence: medium
174
+ languages:
175
+ - apex
176
+ patterns:
177
+ - regex: .*
178
+ message: >-
179
+ Named Credentials (and callout endpoints) should be used instead of hard-coding credentials. 1. Hard-coded
180
+ credentials are hard to maintain when mixed in with application code. 2. It is particularly hard to update
181
+ hard-coded credentials when they are used amongst different classes. 3. Granting a developer access to the
182
+ codebase means granting knowledge of credentials, and thus keeping a two-level access is not possible. 4.
183
+ Using different credentials for different environments is troublesome and error-prone.
184
+ cwe:
185
+ - CWE-540
186
+ owasp: []
187
+ references:
188
+ - https://cwe.mitre.org/data/definitions/540.html
189
+ tags:
190
+ - salesforce
191
+ - id: named-credentials-string-match
192
+ name: named-credentials-string-match
193
+ description: >-
194
+ Named Credentials (and callout endpoints) should be used instead of hard-coding credentials. 1. Hard-coded
195
+ credentials are hard to maintain when mixed in with application code. 2. It is particularly hard to update
196
+ hard-coded credentials when they are used amongst different classes. 3. Granting a developer access to the
197
+ codebase means granting knowledge of credentials, and thus keeping a two-level access is not possible. 4. Using
198
+ different credentials for different environments is troublesome and error-prone.
199
+ category: security
200
+ severity: high
201
+ confidence: medium
202
+ languages:
203
+ - apex
204
+ patterns:
205
+ - pattern: $REQUEST.setHeader('Authorization', $AUTHSTRING);
206
+ message: >-
207
+ Named Credentials (and callout endpoints) should be used instead of hard-coding credentials. 1. Hard-coded
208
+ credentials are hard to maintain when mixed in with application code. 2. It is particularly hard to update
209
+ hard-coded credentials when they are used amongst different classes. 3. Granting a developer access to the
210
+ codebase means granting knowledge of credentials, and thus keeping a two-level access is not possible. 4.
211
+ Using different credentials for different environments is troublesome and error-prone.
212
+ cwe:
213
+ - CWE-540
214
+ owasp: []
215
+ references:
216
+ - https://cwe.mitre.org/data/definitions/540.html
217
+ tags:
218
+ - salesforce
219
+ - id: soql-injection-unescaped-url-param
220
+ name: soql-injection-unescaped-url-param
221
+ description: >-
222
+ If a dynamic query must be used,leverage nFORCE Query Builder. In other programming languages, the related flaw is
223
+ known as SQL injection. Apex doesn't use SQL, but uses its own database query language, SOQL. SOQL is much simpler
224
+ and more limited in functionality than SQL. The risks are much lower for SOQL injection than for SQL injection,
225
+ but the attacks are nearly identical to traditional SQL injection. SQL/SOQL injection takes user-supplied input
226
+ and uses those values in a dynamic SOQL query. If the input isn't validated, it can include SOQL commands that
227
+ effectively modify the SOQL statement and trick the application into performing unintended commands.
228
+ category: security
229
+ severity: high
230
+ confidence: medium
231
+ languages:
232
+ - apex
233
+ patterns:
234
+ - regex: .*
235
+ message: >-
236
+ If a dynamic query must be used,leverage nFORCE Query Builder. In other programming languages, the related
237
+ flaw is known as SQL injection. Apex doesn't use SQL, but uses its own database query language, SOQL. SOQL is
238
+ much simpler and more limited in functionality than SQL. The risks are much lower for SOQL injection than for
239
+ SQL injection, but the attacks are nearly identical to traditional SQL injection. SQL/SOQL injection takes
240
+ user-supplied input and uses those values in a dynamic SOQL query. If the input isn't validated, it can
241
+ include SOQL commands that effectively modify the SOQL statement and trick the application into performing
242
+ unintended commands.
243
+ cwe:
244
+ - CWE-943
245
+ owasp:
246
+ - A03:2021
247
+ - A05:2025
248
+ references:
249
+ - https://cwe.mitre.org/data/definitions/943.html
250
+ tags:
251
+ - salesforce
252
+ - id: soql-injection-unescaped-param
253
+ name: soql-injection-unescaped-param
254
+ description: >-
255
+ If a dynamic query must be used,leverage nFORCE Query Builder. In other programming languages, the related flaw is
256
+ known as SQL injection. Apex doesn't use SQL, but uses its own database query language, SOQL. SOQL is much simpler
257
+ and more limited in functionality than SQL. The risks are much lower for SOQL injection than for SQL injection,
258
+ but the attacks are nearly identical to traditional SQL injection. SQL/SOQL injection takes user-supplied input
259
+ and uses those values in a dynamic SOQL query. If the input isn't validated, it can include SOQL commands that
260
+ effectively modify the SOQL statement and trick the application into performing unintended commands.
261
+ category: security
262
+ severity: high
263
+ confidence: medium
264
+ languages:
265
+ - apex
266
+ patterns:
267
+ - regex: .*
268
+ message: >-
269
+ If a dynamic query must be used,leverage nFORCE Query Builder. In other programming languages, the related
270
+ flaw is known as SQL injection. Apex doesn't use SQL, but uses its own database query language, SOQL. SOQL is
271
+ much simpler and more limited in functionality than SQL. The risks are much lower for SOQL injection than for
272
+ SQL injection, but the attacks are nearly identical to traditional SQL injection. SQL/SOQL injection takes
273
+ user-supplied input and uses those values in a dynamic SOQL query. If the input isn't validated, it can
274
+ include SOQL commands that effectively modify the SOQL statement and trick the application into performing
275
+ unintended commands.
276
+ cwe:
277
+ - CWE-943
278
+ owasp:
279
+ - A03:2021
280
+ - A05:2025
281
+ references:
282
+ - https://cwe.mitre.org/data/definitions/943.html
283
+ tags:
284
+ - salesforce
285
+ - id: specify-sharing-level
286
+ name: specify-sharing-level
287
+ description: >-
288
+ Every Apex class should have an explicit sharing mode declared. Use the `with sharing` or `without sharing`
289
+ keywords on a class to specify whether sharing rules must be enforced. Use the `inherited sharing` keyword on an
290
+ Apex class to run the class in the sharing mode of the class that called it.
291
+ category: security
292
+ severity: medium
293
+ confidence: medium
294
+ languages:
295
+ - apex
296
+ patterns:
297
+ - regex: (private|public|global).*\s(class)\s.*[{]
298
+ message: >-
299
+ Every Apex class should have an explicit sharing mode declared. Use the `with sharing` or `without sharing`
300
+ keywords on a class to specify whether sharing rules must be enforced. Use the `inherited sharing` keyword on
301
+ an Apex class to run the class in the sharing mode of the class that called it.
302
+ cwe:
303
+ - CWE-284
304
+ owasp:
305
+ - A04:2021
306
+ - A06:2025
307
+ references:
308
+ - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm
309
+ - https://cwe.mitre.org/data/definitions/284.html
310
+ - https://owasp.org/Top10/A04_2021-Insecure_Design/
311
+ tags:
312
+ - salesforce
313
+ - id: system-debug
314
+ name: system-debug
315
+ description: >-
316
+ In addition to debug statements potentially logging data excessively, debug statements also contribute to longer
317
+ transactions and consume Apex CPU time even when debug logs are not being captured.
318
+ category: security
319
+ severity: medium
320
+ confidence: medium
321
+ languages:
322
+ - apex
323
+ patterns:
324
+ - pattern: System.debug(...)
325
+ message: >-
326
+ In addition to debug statements potentially logging data excessively, debug statements also contribute to
327
+ longer transactions and consume Apex CPU time even when debug logs are not being captured.
328
+ cwe:
329
+ - CWE-489
330
+ - CWE-779
331
+ owasp: []
332
+ references:
333
+ - https://cwe.mitre.org/data/definitions/489.html
334
+ - https://cwe.mitre.org/data/definitions/779.html
335
+ tags:
336
+ - vuln
@@ -0,0 +1,362 @@
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