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,200 @@
1
+ rules:
2
+ - id: detect-apple-core-ml
3
+ name: detect-apple-core-ml
4
+ description: 'Possibly found usage of AI: Apple CoreML'
5
+ category: security
6
+ severity: low
7
+ confidence: medium
8
+ languages:
9
+ - swift
10
+ patterns:
11
+ - pattern: VNCoreMLModel(...)
12
+ message: 'Possibly found usage of AI: Apple CoreML'
13
+ - pattern: MLModelConfiguration(...)
14
+ message: 'Possibly found usage of AI: Apple CoreML'
15
+ cwe: []
16
+ owasp: []
17
+ references:
18
+ - https://semgrep.dev/blog/2024/detecting-shadow-ai
19
+ tags:
20
+ - genAI
21
+ - LLMs
22
+ - id: detect-gemini
23
+ name: detect-gemini
24
+ description: 'Possibly found usage of AI: Gemini'
25
+ category: security
26
+ severity: low
27
+ confidence: medium
28
+ languages:
29
+ - swift
30
+ patterns:
31
+ - pattern: import GoogleGenerativeAI
32
+ message: 'Possibly found usage of AI: Gemini'
33
+ - pattern: GenerativeModel(...)
34
+ message: 'Possibly found usage of AI: Gemini'
35
+ cwe: []
36
+ owasp: []
37
+ references:
38
+ - https://semgrep.dev/blog/2024/detecting-shadow-ai
39
+ tags:
40
+ - genAI
41
+ - LLMs
42
+ - id: insecure-random
43
+ name: insecure-random
44
+ description: >-
45
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the source
46
+ of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use the
47
+ `SecCopyRandomBytes` API explicitly.
48
+ category: security
49
+ severity: medium
50
+ confidence: medium
51
+ languages:
52
+ - swift
53
+ patterns:
54
+ - pattern: random()
55
+ message: >-
56
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
57
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
58
+ the `SecCopyRandomBytes` API explicitly.
59
+ - pattern: Int.random(...)
60
+ message: >-
61
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
62
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
63
+ the `SecCopyRandomBytes` API explicitly.
64
+ - pattern: Bool.random(...)
65
+ message: >-
66
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
67
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
68
+ the `SecCopyRandomBytes` API explicitly.
69
+ - pattern: Float.random(...)
70
+ message: >-
71
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
72
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
73
+ the `SecCopyRandomBytes` API explicitly.
74
+ - pattern: Double.random(...)
75
+ message: >-
76
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
77
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
78
+ the `SecCopyRandomBytes` API explicitly.
79
+ - pattern: arc4random()
80
+ message: >-
81
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
82
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
83
+ the `SecCopyRandomBytes` API explicitly.
84
+ - pattern: arc4random_buf(...)
85
+ message: >-
86
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
87
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
88
+ the `SecCopyRandomBytes` API explicitly.
89
+ - pattern: arc4random_uniform(...)
90
+ message: >-
91
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
92
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
93
+ the `SecCopyRandomBytes` API explicitly.
94
+ - pattern: SystemRandomNumberGenerator(...)
95
+ message: >-
96
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
97
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
98
+ the `SecCopyRandomBytes` API explicitly.
99
+ - pattern: rand()
100
+ message: >-
101
+ A random number generator was detected which is **not** *guaranteed* to be Cryptographically secure. If the
102
+ source of entropy is used for security purposes (e.g. with other Cryptographic operations), make sure to use
103
+ the `SecCopyRandomBytes` API explicitly.
104
+ cwe:
105
+ - CWE-338
106
+ owasp:
107
+ - A02:2021
108
+ - A04:2025
109
+ references:
110
+ - https://mobile-security.gitbook.io/masvs/security-requirements/0x08-v3-cryptography_verification_requirements
111
+ - https://developer.apple.com/documentation/security/1399291-secrandomcopybytes
112
+ - https://developer.apple.com/documentation/security/randomization_services?language=swift
113
+ - https://github.com/apple/swift-evolution/blob/main/proposals/0202-random-unification.md
114
+ tags:
115
+ - ios
116
+ - macos
117
+ - id: swift-user-defaults
118
+ name: swift-user-defaults
119
+ description: >-
120
+ Potentially sensitive data was observed to be stored in UserDefaults, which is not adequate protection of
121
+ sensitive information. For data of a sensitive nature, applications should leverage the Keychain.
122
+ category: security
123
+ severity: medium
124
+ confidence: medium
125
+ languages:
126
+ - swift
127
+ patterns:
128
+ - regex: .*
129
+ message: >-
130
+ Potentially sensitive data was observed to be stored in UserDefaults, which is not adequate protection of
131
+ sensitive information. For data of a sensitive nature, applications should leverage the Keychain.
132
+ cwe:
133
+ - CWE-311
134
+ owasp:
135
+ - A03:2017
136
+ - A04:2021
137
+ - A06:2025
138
+ references:
139
+ - >-
140
+ https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/ValidatingInput.html
141
+ - https://mas.owasp.org/MASVS/controls/MASVS-STORAGE-1/
142
+ tags:
143
+ - ios
144
+ - macos
145
+ - id: swift-potential-sqlite-injection
146
+ name: swift-potential-sqlite-injection
147
+ description: >-
148
+ Potential Client-side SQL injection which has different impacts depending on the SQL use-case. The impact may
149
+ include the circumvention of local authentication mechanisms, obtaining of sensitive data from the app, or
150
+ manipulation of client-side behavior. It wasn't possible to make certain that the source is untrusted, but the
151
+ application should avoid concatenating dynamic data into SQL queries and should instead leverage parameterized
152
+ queries.
153
+ category: injection
154
+ severity: medium
155
+ confidence: medium
156
+ languages:
157
+ - swift
158
+ patterns:
159
+ - regex: .*
160
+ message: >-
161
+ Potential Client-side SQL injection which has different impacts depending on the SQL use-case. The impact may
162
+ include the circumvention of local authentication mechanisms, obtaining of sensitive data from the app, or
163
+ manipulation of client-side behavior. It wasn't possible to make certain that the source is untrusted, but the
164
+ application should avoid concatenating dynamic data into SQL queries and should instead leverage parameterized
165
+ queries.
166
+ cwe:
167
+ - CWE-89
168
+ owasp: []
169
+ references:
170
+ - >-
171
+ https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/ValidatingInput.html
172
+ tags:
173
+ - ios
174
+ - macos
175
+ - id: swift-webview-config-allows-js-open-windows
176
+ name: swift-webview-config-allows-js-open-windows
177
+ description: >-
178
+ Webviews were observed that explictly allow JavaScript in an WKWebview to open windows automatically. Consider
179
+ disabling this functionality if not required, following the principle of least privelege.
180
+ category: security
181
+ severity: medium
182
+ confidence: medium
183
+ languages:
184
+ - swift
185
+ patterns:
186
+ - pattern: |
187
+ $P = WKPreferences()
188
+ ...
189
+ message: >-
190
+ Webviews were observed that explictly allow JavaScript in an WKWebview to open windows automatically. Consider
191
+ disabling this functionality if not required, following the principle of least privelege.
192
+ cwe:
193
+ - CWE-272
194
+ owasp: []
195
+ references:
196
+ - https://mas.owasp.org/MASVS/controls/MASVS-PLATFORM-2/
197
+ - https://developer.apple.com/documentation/webkit/wkpreferences/1536573-javascriptcanopenwindowsautomati
198
+ tags:
199
+ - ios
200
+ - macos
@@ -0,0 +1,147 @@
1
+ rules:
2
+ - id: aws-elasticsearch-insecure-tls-version
3
+ name: aws-elasticsearch-insecure-tls-version
4
+ description: >-
5
+ Detected an AWS Elasticsearch domain using an insecure version of TLS. To fix this, set "tls_security_policy"
6
+ equal to "Policy-Min-TLS-1-2-2019-07".
7
+ category: security
8
+ severity: medium
9
+ confidence: medium
10
+ languages:
11
+ - terraform
12
+ patterns:
13
+ - pattern: |
14
+ resource "aws_elasticsearch_domain" $ANYTHING {
15
+ ...
16
+ domain_endpoint_options {
17
+ ...
18
+ enforce_https = true
19
+ tls_security_policy = "Policy-Min-TLS-1-0-2019-07"
20
+ ...
21
+ }
22
+ ...
23
+ }
24
+ message: >-
25
+ Detected an AWS Elasticsearch domain using an insecure version of TLS. To fix this, set "tls_security_policy"
26
+ equal to "Policy-Min-TLS-1-2-2019-07".
27
+ cwe:
28
+ - CWE-326
29
+ owasp:
30
+ - A03:2017
31
+ - A02:2021
32
+ - A04:2025
33
+ references:
34
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
35
+ tags:
36
+ - aws
37
+ - terraform
38
+ - id: aws-insecure-api-gateway-tls-version
39
+ name: aws-insecure-api-gateway-tls-version
40
+ description: >-
41
+ Detected AWS API Gateway to be using an insecure version of TLS. To fix this issue make sure to set
42
+ "security_policy" equal to "TLS_1_2".
43
+ category: security
44
+ severity: medium
45
+ confidence: medium
46
+ languages:
47
+ - terraform
48
+ patterns:
49
+ - regex: .*
50
+ message: >-
51
+ Detected AWS API Gateway to be using an insecure version of TLS. To fix this issue make sure to set
52
+ "security_policy" equal to "TLS_1_2".
53
+ cwe:
54
+ - CWE-326
55
+ owasp:
56
+ - A03:2017
57
+ - A02:2021
58
+ - A04:2025
59
+ references:
60
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
61
+ tags:
62
+ - aws
63
+ - terraform
64
+ - id: aws-opensearchserverless-encrypted-with-cmk
65
+ name: aws-opensearchserverless-encrypted-with-cmk
66
+ description: >-
67
+ Ensure opensearch serverless is encrypted at rest using AWS KMS (Key Management Service) CMK (Customer Managed
68
+ Keys). CMKs give you control over the encryption key in terms of access and rotation.
69
+ category: security
70
+ severity: medium
71
+ confidence: medium
72
+ languages:
73
+ - terraform
74
+ patterns:
75
+ - regex: .*
76
+ message: >-
77
+ Ensure opensearch serverless is encrypted at rest using AWS KMS (Key Management Service) CMK (Customer Managed
78
+ Keys). CMKs give you control over the encryption key in terms of access and rotation.
79
+ cwe:
80
+ - CWE-320
81
+ owasp:
82
+ - A2:2021
83
+ - A5:2021
84
+ references:
85
+ - >-
86
+ https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-encryption.html#serverless-encryption-policies
87
+ tags:
88
+ - terraform
89
+ - aws
90
+ - id: aws-provisioner-exec
91
+ name: aws-provisioner-exec
92
+ description: >-
93
+ Provisioners are a tool of last resort and should be avoided where possible. Provisioner behavior cannot be mapped
94
+ by Terraform as part of a plan, and execute arbitrary shell commands by design.
95
+ category: security
96
+ severity: medium
97
+ confidence: medium
98
+ languages:
99
+ - terraform
100
+ patterns:
101
+ - regex: .*
102
+ message: >-
103
+ Provisioners are a tool of last resort and should be avoided where possible. Provisioner behavior cannot be
104
+ mapped by Terraform as part of a plan, and execute arbitrary shell commands by design.
105
+ cwe:
106
+ - CWE-77
107
+ - CWE-94
108
+ owasp:
109
+ - A03:2021
110
+ - A01:2017
111
+ - A05:2025
112
+ references:
113
+ - https://developer.hashicorp.com/terraform/language/resources/provisioners/remote-exec
114
+ - https://developer.hashicorp.com/terraform/language/resources/provisioners/local-exec
115
+ tags:
116
+ - terraform
117
+ - id: gcp-insecure-load-balancer-tls-version
118
+ name: gcp-insecure-load-balancer-tls-version
119
+ description: >-
120
+ Detected GCP Load Balancer to be using an insecure version of TLS. To fix this set your "min_tls_version" to
121
+ "TLS_1_2"
122
+ category: security
123
+ severity: medium
124
+ confidence: medium
125
+ languages:
126
+ - terraform
127
+ patterns:
128
+ - pattern: |
129
+ resource "google_compute_ssl_policy" $ANYTHING {
130
+ ...
131
+ min_tls_version = "..."
132
+ ...
133
+ }
134
+ message: >-
135
+ Detected GCP Load Balancer to be using an insecure version of TLS. To fix this set your "min_tls_version" to
136
+ "TLS_1_2"
137
+ cwe:
138
+ - CWE-326
139
+ owasp:
140
+ - A03:2017
141
+ - A02:2021
142
+ - A04:2025
143
+ references:
144
+ - https://docs.bridgecrew.io/docs/google-cloud-policy-index
145
+ tags:
146
+ - gcp
147
+ - terraform