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,37 +0,0 @@
1
- rules:
2
- - id: javascript.express.security.audit.xss.direct-response-write
3
- name: direct-response-write
4
- description: User input directly written to response, potential XSS
5
- category: xss
6
- severity: high
7
- confidence: medium
8
- languages:
9
- - javascript
10
- - typescript
11
- patterns:
12
- - pattern: res.write(req.query.url)
13
- message: User input directly written to response, potential XSS
14
- cwe:
15
- - CWE-79
16
- owasp:
17
- - A03:2021
18
- references:
19
- - https://owasp.org/www-community/attacks/xss/
20
- tags: []
21
- - id: python.lang.security.audit.crypto.weak-hash-md5
22
- name: weak-hash-md5
23
- description: MD5 hashing detected. Use SHA-256 or stronger.
24
- category: crypto
25
- severity: medium
26
- confidence: medium
27
- languages:
28
- - python
29
- patterns:
30
- - regex: hashlib\.md5\(
31
- message: MD5 hashing detected. Use SHA-256 or stronger.
32
- cwe:
33
- - CWE-328
34
- owasp:
35
- - A02:2021
36
- references: []
37
- tags: []
@@ -1,336 +0,0 @@
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