@dataparade/cli 0.0.10 → 0.0.12

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 (64) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/analyzers/php/dependency-manifests.d.ts +10 -0
  3. package/dist/src/analyzers/php/dependency-manifests.js +117 -0
  4. package/dist/src/analyzers/php/detector.d.ts +3 -0
  5. package/dist/src/analyzers/php/detector.js +20 -0
  6. package/dist/src/analyzers/php/index.d.ts +2 -0
  7. package/dist/src/analyzers/php/index.js +11 -0
  8. package/dist/src/analyzers/php/manifest-parsers.d.ts +14 -0
  9. package/dist/src/analyzers/php/manifest-parsers.js +40 -0
  10. package/dist/src/analyzers/php/parser.d.ts +42 -0
  11. package/dist/src/analyzers/php/parser.js +297 -0
  12. package/dist/src/analyzers/php/patterns.d.ts +3 -0
  13. package/dist/src/analyzers/php/patterns.js +49 -0
  14. package/dist/src/analyzers/php/php-detection-config.d.ts +104 -0
  15. package/dist/src/analyzers/php/php-detection-config.js +192 -0
  16. package/dist/src/analyzers/registry.js +3 -0
  17. package/dist/src/analyzers/shared/strip-comments.js +3 -2
  18. package/dist/src/classifier/postprocessing.d.ts +6 -0
  19. package/dist/src/classifier/postprocessing.js +61 -6
  20. package/dist/src/cli.js +27 -0
  21. package/dist/src/config/file.js +1 -0
  22. package/dist/src/config/resolve.js +1 -0
  23. package/dist/src/core/pipeline/classifier-phase.js +3 -3
  24. package/dist/src/core/pipeline/structural-scan.js +39 -14
  25. package/dist/src/core/schema/scan-config.schema.d.ts +1 -0
  26. package/dist/src/core/schema/scan-config.schema.js +1 -0
  27. package/dist/src/core/schema/scan-result.schema.d.ts +1 -0
  28. package/dist/src/core/schema/scan-result.schema.js +1 -0
  29. package/dist/src/core/sectioning/discover-service-sections.js +3 -0
  30. package/dist/src/core/types/file.d.ts +1 -1
  31. package/dist/src/ingest/file-system.js +3 -0
  32. package/dist/src/patterns/config.d.ts +2 -0
  33. package/dist/src/patterns/config.js +31 -0
  34. package/dist/src/patterns/detectors/php.d.ts +9 -0
  35. package/dist/src/patterns/detectors/php.js +466 -0
  36. package/dist/src/patterns/engine.js +7 -0
  37. package/dist/src/platform-api/telemetry-client.d.ts +6 -0
  38. package/dist/src/platform-api/telemetry-client.js +65 -0
  39. package/dist/src/platform-api/telemetry.types.d.ts +13 -0
  40. package/dist/src/platform-api/telemetry.types.js +2 -0
  41. package/dist/src/platform-api/upload-client.d.ts +2 -0
  42. package/dist/src/platform-api/upload-client.js +4 -0
  43. package/dist/src/platform-api/upload.types.d.ts +2 -0
  44. package/dist/src/upload/build-preview-url.d.ts +2 -2
  45. package/dist/src/upload/build-preview-url.js +10 -3
  46. package/dist/src/upload/run-upload.js +62 -19
  47. package/dist/src/upload/types.d.ts +2 -0
  48. package/dist/tests/unit/analyzers/php/dependency-manifests.spec.d.ts +1 -0
  49. package/dist/tests/unit/analyzers/php/dependency-manifests.spec.js +54 -0
  50. package/dist/tests/unit/analyzers/php/parser.spec.d.ts +1 -0
  51. package/dist/tests/unit/analyzers/php/parser.spec.js +128 -0
  52. package/dist/tests/unit/analyzers/php/patterns.spec.d.ts +1 -0
  53. package/dist/tests/unit/analyzers/php/patterns.spec.js +334 -0
  54. package/dist/tests/unit/classifier/classify.spec.js +68 -0
  55. package/dist/tests/unit/ingest/php-languages.spec.d.ts +1 -0
  56. package/dist/tests/unit/ingest/php-languages.spec.js +40 -0
  57. package/dist/tests/unit/platform-api/telemetry-client.spec.d.ts +1 -0
  58. package/dist/tests/unit/platform-api/telemetry-client.spec.js +48 -0
  59. package/dist/tests/unit/upload/build-preview-url.spec.js +10 -0
  60. package/dist/tests/unit/upload/run-upload.spec.js +18 -0
  61. package/package.json +1 -1
  62. package/patterns/php.md +74 -0
  63. package/patterns/php.patterns.yaml +311 -0
  64. package/patterns/third-party.patterns.yaml +10 -0
@@ -0,0 +1,311 @@
1
+ # PHP pattern config. All entries share: patternId, optional confidence (default 0.8).
2
+ #
3
+ # `importNamespaces` matches a `use` namespace exactly or as a prefix, so
4
+ # `Illuminate\Support` also matches `Illuminate\Support\Facades\Route`.
5
+ # `packageNames` matches Composer package names from composer.json
6
+ # (`guzzlehttp/guzzle`). The two spaces stay disjoint: namespaces use `\`,
7
+ # Composer packages use `/`.
8
+
9
+ db_clients:
10
+ - id: pdo
11
+ patternId: database_connection
12
+ databaseType: sql
13
+ importNamespaces:
14
+ - PDO
15
+ callNames:
16
+ - "new PDO"
17
+ - PDO::__construct
18
+ confidence: 0.9
19
+
20
+ - id: eloquent
21
+ patternId: database_connection
22
+ databaseType: sql
23
+ importNamespaces:
24
+ - Illuminate\Database
25
+ - Illuminate\Support\Facades\DB
26
+ packageNames:
27
+ - illuminate/database
28
+ - laravel/framework
29
+ callNames:
30
+ - DB::connection
31
+ - DB::table
32
+ - "Eloquent::"
33
+ confidence: 0.9
34
+
35
+ - id: doctrine_dbal
36
+ patternId: database_connection
37
+ databaseType: sql
38
+ importNamespaces:
39
+ - Doctrine\DBAL
40
+ - Doctrine\ORM
41
+ packageNames:
42
+ - doctrine/dbal
43
+ - doctrine/orm
44
+ callNames:
45
+ - DriverManager::getConnection
46
+ - EntityManager::create
47
+ confidence: 0.9
48
+
49
+ - id: mysqli
50
+ patternId: database_connection
51
+ databaseType: mysql
52
+ callNames:
53
+ - mysqli_connect
54
+ - "new mysqli"
55
+ confidence: 0.85
56
+
57
+ - id: predis
58
+ patternId: database_connection
59
+ databaseType: redis
60
+ importNamespaces:
61
+ - Predis
62
+ packageNames:
63
+ - predis/predis
64
+ callNames:
65
+ - "new Client"
66
+ - Predis\Client
67
+ confidence: 0.85
68
+
69
+ - id: mongodb_php
70
+ patternId: database_connection
71
+ databaseType: mongodb
72
+ importNamespaces:
73
+ - MongoDB
74
+ packageNames:
75
+ - mongodb/mongodb
76
+ confidence: 0.85
77
+
78
+ pdo_dsn:
79
+ patternId: database_connection
80
+ regex: 'new\s+\\?PDO\s*\(\s*["'']([^"'']+)["'']'
81
+ name: pdo_dsn
82
+ confidence: 0.9
83
+ drivers:
84
+ mysql: mysql
85
+ pgsql: postgres
86
+ postgres: postgres
87
+ postgresql: postgres
88
+ sqlite: sqlite
89
+ sqlsrv: mssql
90
+ dblib: mssql
91
+ oci: oracle
92
+ defaultDatabaseType: sql
93
+
94
+ auth:
95
+ libraries:
96
+ - id: laravel_sanctum
97
+ patternId: auth_middleware
98
+ importNamespaces:
99
+ - Laravel\Sanctum
100
+ packageNames:
101
+ - laravel/sanctum
102
+ strategy: sanctum
103
+ confidence: 0.9
104
+
105
+ - id: laravel_passport
106
+ patternId: auth_middleware
107
+ importNamespaces:
108
+ - Laravel\Passport
109
+ packageNames:
110
+ - laravel/passport
111
+ strategy: oauth2
112
+ confidence: 0.9
113
+
114
+ - id: laravel_socialite
115
+ patternId: auth_middleware
116
+ importNamespaces:
117
+ - Laravel\Socialite
118
+ - SocialiteProviders
119
+ packageNames:
120
+ - laravel/socialite
121
+ callNames:
122
+ - Socialite::driver
123
+ strategy: oauth2
124
+ confidence: 0.9
125
+
126
+ - id: league_oauth2_client
127
+ patternId: auth_middleware
128
+ importNamespaces:
129
+ - League\OAuth2\Client
130
+ packageNames:
131
+ - league/oauth2-client
132
+ callNames:
133
+ - "new AbstractProvider"
134
+ - ->getAccessToken
135
+ - ->getAuthorizationUrl
136
+ strategy: oauth2
137
+ confidence: 0.9
138
+
139
+ - id: firebase_jwt
140
+ patternId: auth_middleware
141
+ importNamespaces:
142
+ - Firebase\JWT
143
+ packageNames:
144
+ - firebase/php-jwt
145
+ callNames:
146
+ - JWT::encode
147
+ - JWT::decode
148
+ strategy: jwt
149
+ confidence: 0.9
150
+
151
+ - id: symfony_security
152
+ patternId: auth_middleware
153
+ importNamespaces:
154
+ - Symfony\Component\Security
155
+ packageNames:
156
+ - symfony/security-bundle
157
+ - symfony/security-http
158
+ strategy: session
159
+ confidence: 0.85
160
+
161
+ - id: bearer_token_header
162
+ patternId: auth_middleware
163
+ contentRegexes:
164
+ - '["'']Authorization["'']'
165
+ - '\$\_SERVER\[["'']HTTP_AUTHORIZATION["'']\]'
166
+ strategy: bearer_token
167
+ confidence: 0.7
168
+
169
+ routes:
170
+ frameworks:
171
+ # Laravel route files usually call the Route facade with no `use` import
172
+ # (class alias). Leave namespaces empty so Route::get(...) always matches.
173
+ - id: laravel
174
+ patternId: express_route
175
+ confidence: 0.9
176
+ routeRegexes:
177
+ - regex: '\bRoute::(get|post|put|patch|delete|options|any|match)\s*\(\s*["'']([^"'']+)["'']'
178
+ methodGroup: 1
179
+ pathGroup: 2
180
+
181
+ # Symfony route attributes/annotations are distinctive enough without a gate.
182
+ - id: symfony
183
+ patternId: express_route
184
+ confidence: 0.85
185
+ routeRegexes:
186
+ # Attribute / annotation style: #[Route('/path', methods: ['GET'])]
187
+ - regex: '#\[Route\s*\(\s*["'']([^"'']+)["'']'
188
+ pathGroup: 1
189
+ - regex: '@Route\s*\(\s*["'']([^"'']+)["'']'
190
+ pathGroup: 1
191
+
192
+ - id: slim
193
+ patternId: express_route
194
+ importNamespaces:
195
+ - Slim\App
196
+ - Slim\Routing
197
+ packageNames:
198
+ - slim/slim
199
+ confidence: 0.9
200
+ routeRegexes:
201
+ - regex: '(?:^|[^A-Za-z0-9_])\$[A-Za-z_]\w*->(get|post|put|patch|delete|options|any|map)\s*\(\s*["'']([^"'']+)["'']'
202
+ methodGroup: 1
203
+ pathGroup: 2
204
+
205
+ serverless:
206
+ handlers:
207
+ - id: bref_lambda
208
+ patternId: lambda_handler
209
+ importNamespaces:
210
+ - Bref\Context
211
+ - Bref\Event
212
+ packageNames:
213
+ - bref/bref
214
+ confidence: 0.85
215
+
216
+ env_config:
217
+ envVariable:
218
+ patternId: env_variable
219
+ # getenv("KEY"), $_ENV["KEY"], $_SERVER["KEY"], env("KEY") (Laravel helper)
220
+ regex: '(?:getenv|env)\s*\(\s*["'']([^"'']+)["'']|\$\_(?:ENV|SERVER)\s*\[\s*["'']([^"'']+)["'']\s*\]'
221
+ confidence: 0.85
222
+
223
+ configLoaders:
224
+ patternId: config_file
225
+ confidence: 0.85
226
+ loaders:
227
+ - id: vlucas_phpdotenv
228
+ importNamespaces:
229
+ - Dotenv
230
+ packageNames:
231
+ - vlucas/phpdotenv
232
+ callNames:
233
+ - Dotenv::createImmutable
234
+ - Dotenv::createMutable
235
+ - ->load
236
+ - id: laravel_config
237
+ importNamespaces:
238
+ - Illuminate\Support\Facades\Config
239
+ callNames:
240
+ - config
241
+ - Config::get
242
+
243
+ configFile:
244
+ patternId: config_file
245
+ fileNameRegex: '(^|/)(config|configuration|settings)\.php$'
246
+ name: php_config
247
+ confidence: 0.75
248
+
249
+ external_apis:
250
+ httpClients:
251
+ - id: guzzle
252
+ patternId: external_api_call
253
+ clientName: guzzle
254
+ importNamespaces:
255
+ - GuzzleHttp
256
+ packageNames:
257
+ - guzzlehttp/guzzle
258
+ callNames:
259
+ - "->request"
260
+ - "->get"
261
+ - "->post"
262
+ - "->put"
263
+ - "->patch"
264
+ - "->delete"
265
+ - "->head"
266
+ urlRegex: '["''](https?:\/\/[^"'']+)["'']'
267
+ confidence: 0.9
268
+
269
+ - id: curl
270
+ patternId: external_api_call
271
+ clientName: curl
272
+ callNames:
273
+ - curl_setopt
274
+ - curl_exec
275
+ - curl_init
276
+ urlRegex: '["''](https?:\/\/[^"'']+)["'']'
277
+ confidence: 0.85
278
+
279
+ - id: symfony_http_client
280
+ patternId: external_api_call
281
+ clientName: symfony_http_client
282
+ importNamespaces:
283
+ - Symfony\Component\HttpClient
284
+ - Symfony\Contracts\HttpClient
285
+ packageNames:
286
+ - symfony/http-client
287
+ callNames:
288
+ - "->request"
289
+ - HttpClient::create
290
+ urlRegex: '["''](https?:\/\/[^"'']+)["'']'
291
+ confidence: 0.85
292
+
293
+ # SDK / Flysystem presence is enough (no HTTP URL on every call).
294
+ - id: aws_s3
295
+ patternId: external_api_call
296
+ clientName: aws
297
+ emitOnPresence: true
298
+ importNamespaces:
299
+ - Aws\S3
300
+ - League\Flysystem\AwsS3V3
301
+ packageNames:
302
+ - aws/aws-sdk-php
303
+ - league/flysystem-aws-s3-v3
304
+ callNames:
305
+ - "new S3Client"
306
+ - "new AwsS3V3Adapter"
307
+ - putObject
308
+ - getObject
309
+ - createMultipartUpload
310
+ urlRegex: '["''](https?:\/\/[^"'']+)["'']'
311
+ confidence: 0.85
@@ -27,6 +27,7 @@ services:
27
27
  patternId: external_api_call
28
28
  importFragments:
29
29
  - stripe
30
+ - stripe/stripe-php
30
31
  confidence: 0.85
31
32
  url_host_patterns:
32
33
  - stripe.com
@@ -35,6 +36,7 @@ services:
35
36
  patternId: external_api_call
36
37
  importFragments:
37
38
  - sendgrid
39
+ - sendgrid/sendgrid
38
40
  confidence: 0.85
39
41
  url_host_patterns:
40
42
  - sendgrid.com
@@ -42,6 +44,7 @@ services:
42
44
  patternId: external_api_call
43
45
  importFragments:
44
46
  - twilio
47
+ - twilio/sdk
45
48
  confidence: 0.85
46
49
  url_host_patterns:
47
50
  - twilio.com
@@ -94,6 +97,10 @@ services:
94
97
  - awssdk
95
98
  - amazon.
96
99
  - aws/
100
+ - aws/aws-sdk-php
101
+ # PHP Flysystem S3 adapter (BookStack, Laravel filesystems, etc.)
102
+ - league/flysystem-aws-s3-v3
103
+ - flysystem-aws-s3
97
104
  confidence: 0.85
98
105
  url_host_patterns:
99
106
  - amazonaws.com
@@ -103,6 +110,7 @@ services:
103
110
  importFragments:
104
111
  - "@auth0/"
105
112
  - "auth0"
113
+ - auth0/auth0-php
106
114
  confidence: 0.85
107
115
  url_host_patterns:
108
116
  - auth0.com
@@ -111,6 +119,7 @@ services:
111
119
  patternId: external_api_call
112
120
  importFragments:
113
121
  - firebase
122
+ - kreait/firebase-php
114
123
  confidence: 0.85
115
124
  url_host_patterns:
116
125
  - firebase.com
@@ -165,6 +174,7 @@ services:
165
174
  importFragments:
166
175
  - "@sentry/"
167
176
  - sentry
177
+ - sentry/sentry
168
178
  confidence: 0.85
169
179
  url_host_patterns:
170
180
  - sentry.io