snyk-broker 4.138.4 → 4.140.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.
- package/README.md +9 -0
- package/dist/cli/exec.js +2 -2
- package/dist/cli/exec.js.map +1 -1
- package/dist/client-templates/azure-repos/accept.json.sample +8 -0
- package/dist/client-templates/bitbucket-server/accept.json.sample +44 -0
- package/dist/client-templates/github-com/accept.json.sample +112 -0
- package/dist/client-templates/github-enterprise/accept.json.sample +64 -0
- package/dist/client-templates/gitlab/accept.json.sample +84 -0
- package/dist/lib/client/dispatcher/client/api.js +36 -0
- package/dist/lib/client/dispatcher/client/api.js.map +1 -0
- package/dist/lib/client/dispatcher/client/axios.js +15 -0
- package/dist/lib/client/dispatcher/client/axios.js.map +1 -0
- package/dist/lib/client/dispatcher/config.js +3 -0
- package/dist/lib/client/dispatcher/config.js.map +1 -0
- package/dist/lib/client/dispatcher/dispatcher-service.js +10 -0
- package/dist/lib/client/dispatcher/dispatcher-service.js.map +1 -0
- package/dist/lib/client/dispatcher/index.js +45 -0
- package/dist/lib/client/dispatcher/index.js.map +1 -0
- package/dist/lib/client/index.js +20 -3
- package/dist/lib/client/index.js.map +1 -1
- package/dist/lib/client/socket.js +5 -5
- package/dist/lib/client/socket.js.map +1 -1
- package/dist/lib/index.js +4 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/relay.js +3 -3
- package/dist/lib/relay.js.map +1 -1
- package/dist/lib/server/index.js +4 -15
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/prometheus-middleware.js +21 -0
- package/dist/lib/server/prometheus-middleware.js.map +1 -0
- package/dist/lib/stream-posts.js +8 -5
- package/dist/lib/stream-posts.js.map +1 -1
- package/dist/package.json +7 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -602,6 +602,15 @@ If `scheme` is `bearer` or `token`, you must provide a `token`, and if it's `bas
|
|
|
602
602
|
|
|
603
603
|
This will override any other configured authentication method (e.g., setting the token in the `origin` field, or in the `.env` file).
|
|
604
604
|
|
|
605
|
+
#### Multi-tenant
|
|
606
|
+
To use Broker with different multi-tenant environments, set `BROKER_SERVER_URL` to be one of the following URLs depending which environment you are using:
|
|
607
|
+
|
|
608
|
+
Europe: `https://broker.eu.snyk.io`<br>
|
|
609
|
+
Australia: `https://broker.au.snyk.io`<br>
|
|
610
|
+
|
|
611
|
+
```
|
|
612
|
+
-e BROKER_SERVER_URL=<BROKER_SERVER_URL>
|
|
613
|
+
```
|
|
605
614
|
|
|
606
615
|
### Credential Pooling
|
|
607
616
|
Under some circumstances it can be desirable to create a "pool" of credentials, e.g., to work around rate-limiting issues.
|
package/dist/cli/exec.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const commands = ['server', 'client'];
|
|
2
|
-
module.exports = (args) => {
|
|
2
|
+
module.exports = async (args) => {
|
|
3
3
|
const command = args._[0] || 'client';
|
|
4
4
|
if (!commands.includes(command)) {
|
|
5
5
|
throw new Error(`unknown command "${command}"`);
|
|
6
6
|
}
|
|
7
7
|
args.client = command === 'client';
|
|
8
|
-
require(`${__dirname}/../lib/index`).main(args);
|
|
8
|
+
await require(`${__dirname}/../lib/index`).main(args);
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=exec.js.map
|
package/dist/cli/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../cli/exec.js"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEtC,MAAM,CAAC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../cli/exec.js"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEtC,MAAM,CAAC,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE;IAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC;IACtC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,GAAG,CAAC,CAAC;KACjD;IAED,IAAI,CAAC,MAAM,GAAG,OAAO,KAAK,QAAQ,CAAC;IAEnC,MAAM,OAAO,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC,CAAC"}
|
|
@@ -102,6 +102,10 @@
|
|
|
102
102
|
"**%2F*req*.txt",
|
|
103
103
|
"**/requirements/*.txt",
|
|
104
104
|
"**%2Frequirements%2F*.txt",
|
|
105
|
+
"**/pyproject.toml",
|
|
106
|
+
"**%2Fpyproject.toml",
|
|
107
|
+
"**/poetry.lock",
|
|
108
|
+
"**%2Fpoetry.lock",
|
|
105
109
|
"**/build.gradle",
|
|
106
110
|
"**%2Fbuild.gradle",
|
|
107
111
|
"**/gradle.lockfile",
|
|
@@ -187,6 +191,10 @@
|
|
|
187
191
|
"**%2F*req*.txt",
|
|
188
192
|
"**/requirements/*.txt",
|
|
189
193
|
"**%2Frequirements%2F*.txt",
|
|
194
|
+
"**/pyproject.toml",
|
|
195
|
+
"**%2Fpyproject.toml",
|
|
196
|
+
"**/poetry.lock",
|
|
197
|
+
"**%2Fpoetry.lock",
|
|
190
198
|
"**/build.gradle",
|
|
191
199
|
"**%2Fbuild.gradle",
|
|
192
200
|
"**/gradle.lockfile",
|
|
@@ -216,6 +216,50 @@
|
|
|
216
216
|
"password": "${BITBUCKET_PASSWORD}"
|
|
217
217
|
}
|
|
218
218
|
},
|
|
219
|
+
{
|
|
220
|
+
"//": "used to determine the full dependency tree",
|
|
221
|
+
"method": "GET",
|
|
222
|
+
"path": "/projects/:project/repos/:repo/browse*/pyproject.toml",
|
|
223
|
+
"origin": "https://${BITBUCKET_API}",
|
|
224
|
+
"auth": {
|
|
225
|
+
"scheme": "basic",
|
|
226
|
+
"username": "${BITBUCKET_USERNAME}",
|
|
227
|
+
"password": "${BITBUCKET_PASSWORD}"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"//": "used to determine the full dependency tree",
|
|
232
|
+
"method": "GET",
|
|
233
|
+
"path": "/projects/:project/repos/:repo/browse*%2Fpyproject.toml",
|
|
234
|
+
"origin": "https://${BITBUCKET_API}",
|
|
235
|
+
"auth": {
|
|
236
|
+
"scheme": "basic",
|
|
237
|
+
"username": "${BITBUCKET_USERNAME}",
|
|
238
|
+
"password": "${BITBUCKET_PASSWORD}"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"//": "used to determine the full dependency tree",
|
|
243
|
+
"method": "GET",
|
|
244
|
+
"path": "/projects/:project/repos/:repo/browse*/poetry.lock",
|
|
245
|
+
"origin": "https://${BITBUCKET_API}",
|
|
246
|
+
"auth": {
|
|
247
|
+
"scheme": "basic",
|
|
248
|
+
"username": "${BITBUCKET_USERNAME}",
|
|
249
|
+
"password": "${BITBUCKET_PASSWORD}"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"//": "used to determine the full dependency tree",
|
|
254
|
+
"method": "GET",
|
|
255
|
+
"path": "/projects/:project/repos/:repo/browse*%poetry.lock",
|
|
256
|
+
"origin": "https://${BITBUCKET_API}",
|
|
257
|
+
"auth": {
|
|
258
|
+
"scheme": "basic",
|
|
259
|
+
"username": "${BITBUCKET_USERNAME}",
|
|
260
|
+
"password": "${BITBUCKET_PASSWORD}"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
219
263
|
{
|
|
220
264
|
"//": "used to determine the full dependency tree",
|
|
221
265
|
"method": "GET",
|
|
@@ -58,6 +58,22 @@
|
|
|
58
58
|
"path": "commits.*.modified.*",
|
|
59
59
|
"value": "requirements/*.txt"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"path": "commits.*.added.*",
|
|
63
|
+
"value": "pyproject.toml"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "commits.*.modified.*",
|
|
67
|
+
"value": "pyproject.toml"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"path": "commits.*.added.*",
|
|
71
|
+
"value": "poetry.lock"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "commits.*.modified.*",
|
|
75
|
+
"value": "poetry.lock"
|
|
76
|
+
},
|
|
61
77
|
{
|
|
62
78
|
"path": "commits.*.added.*",
|
|
63
79
|
"value": "pom.xml"
|
|
@@ -543,6 +559,54 @@
|
|
|
543
559
|
"path": "/:name/:repo/:path*%2Frequirements%2F*.txt",
|
|
544
560
|
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
545
561
|
},
|
|
562
|
+
{
|
|
563
|
+
"//": "used to determine the full dependency tree",
|
|
564
|
+
"method": "GET",
|
|
565
|
+
"path": "/repos/:name/:repo/contents/:path*/pyproject.toml",
|
|
566
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"//": "used to determine the full dependency tree",
|
|
570
|
+
"method": "GET",
|
|
571
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpyproject.toml",
|
|
572
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"//": "used to determine the full dependency tree",
|
|
576
|
+
"method": "GET",
|
|
577
|
+
"path": "/:name/:repo/:path*/pyproject.toml",
|
|
578
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"//": "used to determine the full dependency tree",
|
|
582
|
+
"method": "GET",
|
|
583
|
+
"path": "/:name/:repo/:path*%2Fpyproject.toml",
|
|
584
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"//": "used to determine the full dependency tree",
|
|
588
|
+
"method": "GET",
|
|
589
|
+
"path": "/repos/:name/:repo/contents/:path*/poetry.lock",
|
|
590
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
"//": "used to determine the full dependency tree",
|
|
594
|
+
"method": "GET",
|
|
595
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpoetry.lock",
|
|
596
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"//": "used to determine the full dependency tree",
|
|
600
|
+
"method": "GET",
|
|
601
|
+
"path": "/:name/:repo/:path*/poetry.lock",
|
|
602
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"//": "used to determine the full dependency tree",
|
|
606
|
+
"method": "GET",
|
|
607
|
+
"path": "/:name/:repo/:path*%2Fpoetry.lock",
|
|
608
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
609
|
+
},
|
|
546
610
|
{
|
|
547
611
|
"//": "used to determine the full dependency tree",
|
|
548
612
|
"method": "GET",
|
|
@@ -1288,6 +1352,54 @@
|
|
|
1288
1352
|
"path": "/:name/:repo/:path*%2F*req*.txt",
|
|
1289
1353
|
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
1290
1354
|
},
|
|
1355
|
+
{
|
|
1356
|
+
"//": "used to update manifest or lock",
|
|
1357
|
+
"method": "PUT",
|
|
1358
|
+
"path": "/repos/:name/:repo/contents/:path*/pyproject.toml",
|
|
1359
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
"//": "used to update manifest or lock",
|
|
1363
|
+
"method": "PUT",
|
|
1364
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpyproject.toml",
|
|
1365
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
"//": "used to update manifest or lock",
|
|
1369
|
+
"method": "PUT",
|
|
1370
|
+
"path": "/:name/:repo/:path*/pyproject.toml",
|
|
1371
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
"//": "used to update manifest or lock",
|
|
1375
|
+
"method": "PUT",
|
|
1376
|
+
"path": "/:name/:repo/:path*%2Fpyproject.toml",
|
|
1377
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
"//": "used to update manifest or lock",
|
|
1381
|
+
"method": "PUT",
|
|
1382
|
+
"path": "/repos/:name/:repo/contents/:path*/poetry.lock",
|
|
1383
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
"//": "used to update manifest or lock",
|
|
1387
|
+
"method": "PUT",
|
|
1388
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpoetry.lock",
|
|
1389
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
"//": "used to update manifest or lock",
|
|
1393
|
+
"method": "PUT",
|
|
1394
|
+
"path": "/:name/:repo/:path*/poetry.lock",
|
|
1395
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
"//": "used to update manifest or lock",
|
|
1399
|
+
"method": "PUT",
|
|
1400
|
+
"path": "/:name/:repo/:path*%2Fpoetry.lock",
|
|
1401
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_RAW}"
|
|
1402
|
+
},
|
|
1291
1403
|
{
|
|
1292
1404
|
"//": "used to update manifest or lock",
|
|
1293
1405
|
"method": "PUT",
|
|
@@ -58,6 +58,22 @@
|
|
|
58
58
|
"path": "commits.*.modified.*",
|
|
59
59
|
"value": "requirements/*.txt"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"path": "commits.*.added.*",
|
|
63
|
+
"value": "pyproject.toml"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "commits.*.modified.*",
|
|
67
|
+
"value": "pyproject.toml"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"path": "commits.*.added.*",
|
|
71
|
+
"value": "poetry.lock"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "commits.*.modified.*",
|
|
75
|
+
"value": "poetry.lock"
|
|
76
|
+
},
|
|
61
77
|
{
|
|
62
78
|
"path": "commits.*.added.*",
|
|
63
79
|
"value": "pom.xml"
|
|
@@ -459,6 +475,30 @@
|
|
|
459
475
|
"path": "/repos/:name/:repo/contents/:path*%2Frequirements%2F*.txt",
|
|
460
476
|
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
461
477
|
},
|
|
478
|
+
{
|
|
479
|
+
"//": "used to determine the full dependency tree",
|
|
480
|
+
"method": "GET",
|
|
481
|
+
"path": "/repos/:name/:repo/contents/:path*/pyproject.toml",
|
|
482
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"//": "used to determine the full dependency tree",
|
|
486
|
+
"method": "GET",
|
|
487
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpyproject.toml",
|
|
488
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"//": "used to determine the full dependency tree",
|
|
492
|
+
"method": "GET",
|
|
493
|
+
"path": "/repos/:name/:repo/contents/:path*/poetry.lock",
|
|
494
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"//": "used to determine the full dependency tree",
|
|
498
|
+
"method": "GET",
|
|
499
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpoetry.lock",
|
|
500
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
501
|
+
},
|
|
462
502
|
{
|
|
463
503
|
"//": "used to determine the full dependency tree",
|
|
464
504
|
"method": "GET",
|
|
@@ -855,6 +895,30 @@
|
|
|
855
895
|
"path": "/repos/:name/:repo/contents/:path*%2F*req*.txt",
|
|
856
896
|
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
857
897
|
},
|
|
898
|
+
{
|
|
899
|
+
"//": "used to update manifest or lock",
|
|
900
|
+
"method": "PUT",
|
|
901
|
+
"path": "/repos/:name/:repo/contents/:path*/pyproject.toml",
|
|
902
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
"//": "used to update manifest or lock",
|
|
906
|
+
"method": "PUT",
|
|
907
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpyproject.toml",
|
|
908
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
"//": "used to update manifest or lock",
|
|
912
|
+
"method": "PUT",
|
|
913
|
+
"path": "/repos/:name/:repo/contents/:path*/poetry.lock",
|
|
914
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
"//": "used to update manifest or lock",
|
|
918
|
+
"method": "PUT",
|
|
919
|
+
"path": "/repos/:name/:repo/contents/:path*%2Fpoetry.lock",
|
|
920
|
+
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
|
|
921
|
+
},
|
|
858
922
|
{
|
|
859
923
|
"//": "used to update manifest or lock",
|
|
860
924
|
"method": "PUT",
|
|
@@ -134,6 +134,30 @@
|
|
|
134
134
|
"path": "/api/v4/projects/:project/repository/files*%2Frequirements%2F*.txt",
|
|
135
135
|
"origin": "https://${GITLAB}"
|
|
136
136
|
},
|
|
137
|
+
{
|
|
138
|
+
"//": "used to determine the full dependency tree",
|
|
139
|
+
"method": "GET",
|
|
140
|
+
"path": "/api/v4/projects/:project/repository/files*/pyproject.toml",
|
|
141
|
+
"origin": "https://${GITLAB}"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"//": "used to determine the full dependency tree",
|
|
145
|
+
"method": "GET",
|
|
146
|
+
"path": "/api/v4/projects/:project/repository/files*%2Fpyproject.toml",
|
|
147
|
+
"origin": "https://${GITLAB}"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"//": "used to determine the full dependency tree",
|
|
151
|
+
"method": "GET",
|
|
152
|
+
"path": "/api/v4/projects/:project/repository/files*/poetry.lock",
|
|
153
|
+
"origin": "https://${GITLAB}"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"//": "used to determine the full dependency tree",
|
|
157
|
+
"method": "GET",
|
|
158
|
+
"path": "/api/v4/projects/:project/repository/files*%2Fpoetry.lock",
|
|
159
|
+
"origin": "https://${GITLAB}"
|
|
160
|
+
},
|
|
137
161
|
{
|
|
138
162
|
"//": "used to determine the full dependency tree",
|
|
139
163
|
"method": "GET",
|
|
@@ -459,6 +483,10 @@
|
|
|
459
483
|
"**%2F*req*.txt",
|
|
460
484
|
"**/requirements/*.txt",
|
|
461
485
|
"**%2Frequirements%2F*.txt",
|
|
486
|
+
"**/pyproject.toml",
|
|
487
|
+
"**%2Fpyproject.toml",
|
|
488
|
+
"**/poetry.lock",
|
|
489
|
+
"**%2Fpoetry.lock",
|
|
462
490
|
"**/build.gradle",
|
|
463
491
|
"**%2Fbuild.gradle",
|
|
464
492
|
"**/gradle.lockfile",
|
|
@@ -574,6 +602,30 @@
|
|
|
574
602
|
"path": "/api/v4/projects/:project/repository/files*%2F*req*.txt",
|
|
575
603
|
"origin": "https://${GITLAB}"
|
|
576
604
|
},
|
|
605
|
+
{
|
|
606
|
+
"//": "used to create manifest file",
|
|
607
|
+
"method": "POST",
|
|
608
|
+
"path": "/api/v4/projects/:project/repository/files*/pyproject.toml",
|
|
609
|
+
"origin": "https://${GITLAB}"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"//": "used to create manifest file",
|
|
613
|
+
"method": "POST",
|
|
614
|
+
"path": "/api/v4/projects/:project/repository/files*%2Fpyproject.toml",
|
|
615
|
+
"origin": "https://${GITLAB}"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"//": "used to create manifest file",
|
|
619
|
+
"method": "POST",
|
|
620
|
+
"path": "/api/v4/projects/:project/repository/files*/poetry.lock",
|
|
621
|
+
"origin": "https://${GITLAB}"
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"//": "used to create manifest file",
|
|
625
|
+
"method": "POST",
|
|
626
|
+
"path": "/api/v4/projects/:project/repository/files*%2Fpoetry.lock",
|
|
627
|
+
"origin": "https://${GITLAB}"
|
|
628
|
+
},
|
|
577
629
|
{
|
|
578
630
|
"//": "used to create manifest file",
|
|
579
631
|
"method": "POST",
|
|
@@ -897,6 +949,10 @@
|
|
|
897
949
|
"**%2Fpom.xml",
|
|
898
950
|
"**/*req*.txt",
|
|
899
951
|
"**%2F*req*.txt",
|
|
952
|
+
"**/pyproject.toml",
|
|
953
|
+
"**%2Fpyproject.toml",
|
|
954
|
+
"**/poetry.lock",
|
|
955
|
+
"**%2Fpoetry.lock",
|
|
900
956
|
"**/build.gradle",
|
|
901
957
|
"**%2Fbuild.gradle",
|
|
902
958
|
"**/gradle.lockfile",
|
|
@@ -1011,6 +1067,30 @@
|
|
|
1011
1067
|
"path": "/api/v4/projects/:project/repository/files*%2F*req*.txt",
|
|
1012
1068
|
"origin": "https://${GITLAB}"
|
|
1013
1069
|
},
|
|
1070
|
+
{
|
|
1071
|
+
"//": "used to update manifest file",
|
|
1072
|
+
"method": "PUT",
|
|
1073
|
+
"path": "/api/v4/projects/:project/repository/files*/pyproject.toml",
|
|
1074
|
+
"origin": "https://${GITLAB}"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
"//": "used to update manifest file",
|
|
1078
|
+
"method": "PUT",
|
|
1079
|
+
"path": "/api/v4/projects/:project/repository/files*%2Fpyproject.toml",
|
|
1080
|
+
"origin": "https://${GITLAB}"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
"//": "used to update manifest file",
|
|
1084
|
+
"method": "PUT",
|
|
1085
|
+
"path": "/api/v4/projects/:project/repository/files*/poetry.lock",
|
|
1086
|
+
"origin": "https://${GITLAB}"
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
"//": "used to update manifest file",
|
|
1090
|
+
"method": "PUT",
|
|
1091
|
+
"path": "/api/v4/projects/:project/repository/files*%2Fpoetry.lock",
|
|
1092
|
+
"origin": "https://${GITLAB}"
|
|
1093
|
+
},
|
|
1014
1094
|
{
|
|
1015
1095
|
"//": "used to update manifest file",
|
|
1016
1096
|
"method": "PUT",
|
|
@@ -1334,6 +1414,10 @@
|
|
|
1334
1414
|
"**%2Fpom.xml",
|
|
1335
1415
|
"**/*req*.txt",
|
|
1336
1416
|
"**%2F*req*.txt",
|
|
1417
|
+
"**/pyproject.toml",
|
|
1418
|
+
"**%2Fpyproject.toml",
|
|
1419
|
+
"**/poetry.lock",
|
|
1420
|
+
"**%2Fpoetry.lock",
|
|
1337
1421
|
"**/build.gradle",
|
|
1338
1422
|
"**%2Fbuild.gradle",
|
|
1339
1423
|
"**/gradle.lockfile",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpDispatcherServiceClient = void 0;
|
|
4
|
+
const axios_1 = require("./axios");
|
|
5
|
+
const logger = require("../../../log");
|
|
6
|
+
class HttpDispatcherServiceClient {
|
|
7
|
+
constructor(baseUrl) {
|
|
8
|
+
this.version = '2022-12-01~experimental';
|
|
9
|
+
this.baseUrl = baseUrl;
|
|
10
|
+
}
|
|
11
|
+
async createConnection(params, data) {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
const path = `/hidden/broker/${params.hashedBrokerToken}/connections/${params.brokerClientId}`;
|
|
14
|
+
const response = await axios_1.axiosInstance.post(path, {
|
|
15
|
+
data: {
|
|
16
|
+
attributes: {
|
|
17
|
+
deployment_location: data.deployment_location,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}, {
|
|
21
|
+
baseURL: this.baseUrl,
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-type': 'application/vnd.api+json',
|
|
24
|
+
},
|
|
25
|
+
params: { version: this.version },
|
|
26
|
+
validateStatus: () => true,
|
|
27
|
+
});
|
|
28
|
+
const apiResponse = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
29
|
+
const snykRequestId = response.headers['snyk-request-id'] || '';
|
|
30
|
+
logger.trace({ snykRequestId, apiResponse }, 'createConnection API response');
|
|
31
|
+
const serverId = ((_d = (_c = (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.attributes) === null || _d === void 0 ? void 0 : _d.server_id) || '-1';
|
|
32
|
+
return response.status === 201 ? serverId : '-1';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.HttpDispatcherServiceClient = HttpDispatcherServiceClient;
|
|
36
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../lib/client/dispatcher/client/api.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AACxC,uCAAwC;AASxC,MAAa,2BAA2B;IAItC,YAAY,OAAe;QAHV,YAAO,GAAG,yBAAyB,CAAC;QAInD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,MAAqC,EACrC,IAAiC;;QAEjC,MAAM,IAAI,GAAG,kBAAkB,MAAM,CAAC,iBAAiB,gBAAgB,MAAM,CAAC,cAAc,EAAE,CAAC;QAE/F,MAAM,QAAQ,GAAG,MAAM,qBAAa,CAAC,IAAI,CACvC,IAAI,EACJ;YACE,IAAI,EAAE;gBACJ,UAAU,EAAE;oBACV,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;iBAC9C;aACF;SACF,EACD;YACE,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE;gBACP,cAAc,EAAE,0BAA0B;aAC3C;YACD,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACjC,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI;SAC3B,CACF,CAAC;QAEF,MAAM,WAAW,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,IAAI,CAAC;QACzC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAChE,MAAM,CAAC,KAAK,CACV,EAAE,aAAa,EAAE,WAAW,EAAE,EAC9B,+BAA+B,CAChC,CAAC;QAEF,MAAM,QAAQ,GAAG,CAAA,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,IAAI,0CAAE,UAAU,0CAAE,SAAS,KAAI,IAAI,CAAC;QACrE,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;CACF;AA3CD,kEA2CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.axiosInstance = void 0;
|
|
4
|
+
const axios_1 = require("axios");
|
|
5
|
+
const axios_retry_1 = require("axios-retry");
|
|
6
|
+
const axiosInstance = axios_1.default.create({
|
|
7
|
+
timeout: 5000,
|
|
8
|
+
});
|
|
9
|
+
exports.axiosInstance = axiosInstance;
|
|
10
|
+
(0, axios_retry_1.default)(axiosInstance, {
|
|
11
|
+
retries: 3,
|
|
12
|
+
retryCondition: () => true,
|
|
13
|
+
retryDelay: axios_retry_1.default.exponentialDelay,
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=axios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../../../lib/client/dispatcher/client/axios.ts"],"names":[],"mappings":";;;AAAA,iCAA0B;AAC1B,6CAAqC;AAErC,MAAM,aAAa,GAAG,eAAK,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAQM,sCAAa;AANtB,IAAA,qBAAU,EAAC,aAAa,EAAE;IACxB,OAAO,EAAE,CAAC;IACV,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI;IAC1B,UAAU,EAAE,qBAAU,CAAC,gBAAgB;CACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../lib/client/dispatcher/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getServerIdFromDispatcher = void 0;
|
|
4
|
+
async function getServerIdFromDispatcher(client, params) {
|
|
5
|
+
return await client.createConnection(params, {
|
|
6
|
+
deployment_location: 'snyk-broker-client',
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
exports.getServerIdFromDispatcher = getServerIdFromDispatcher;
|
|
10
|
+
//# sourceMappingURL=dispatcher-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher-service.js","sourceRoot":"","sources":["../../../../lib/client/dispatcher/dispatcher-service.ts"],"names":[],"mappings":";;;AAsBO,KAAK,UAAU,yBAAyB,CAC7C,MAA+B,EAC/B,MAAqC;IAErC,OAAO,MAAM,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE;QAC3C,mBAAmB,EAAE,oBAAoB;KAC1C,CAAC,CAAC;AACL,CAAC;AAPD,8DAOC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getServerId = exports.highAvailabilityModeEnabled = exports.defaultBrokerDispatcherBaseUrl = void 0;
|
|
4
|
+
const crypto = require("crypto");
|
|
5
|
+
const logger = require("../../log");
|
|
6
|
+
const api_1 = require("./client/api");
|
|
7
|
+
const dispatcher_service_1 = require("./dispatcher-service");
|
|
8
|
+
exports.defaultBrokerDispatcherBaseUrl = 'https://api.snyk.io';
|
|
9
|
+
function highAvailabilityModeEnabled(config) {
|
|
10
|
+
const haConfig = getHAConfig(config);
|
|
11
|
+
logger.info({ enabled: haConfig.BROKER_HA_MODE_ENABLED }, 'checking for HA mode');
|
|
12
|
+
return haConfig.BROKER_HA_MODE_ENABLED;
|
|
13
|
+
}
|
|
14
|
+
exports.highAvailabilityModeEnabled = highAvailabilityModeEnabled;
|
|
15
|
+
async function getServerId(config, brokerToken, brokerClientId) {
|
|
16
|
+
const haConfig = getHAConfig(config);
|
|
17
|
+
const baseUrl = haConfig.BROKER_DISPATCHER_BASE_URL || exports.defaultBrokerDispatcherBaseUrl;
|
|
18
|
+
const client = new api_1.HttpDispatcherServiceClient(baseUrl);
|
|
19
|
+
const token = hash(config.BROKER_TOKEN);
|
|
20
|
+
const maxRetries = 30;
|
|
21
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
22
|
+
try {
|
|
23
|
+
return await (0, dispatcher_service_1.getServerIdFromDispatcher)(client, {
|
|
24
|
+
brokerClientId: brokerClientId,
|
|
25
|
+
hashedBrokerToken: token,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
const timeout = 2 ** attempt * 100;
|
|
30
|
+
logger.warn({ attempt, timeout }, `waiting for ${timeout}ms before next Broker Dispatcher API call`);
|
|
31
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, timeout);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
exports.getServerId = getServerId;
|
|
37
|
+
function getHAConfig(config) {
|
|
38
|
+
return config;
|
|
39
|
+
}
|
|
40
|
+
function hash(token) {
|
|
41
|
+
const shasum = crypto.createHash('sha256');
|
|
42
|
+
shasum.update(token);
|
|
43
|
+
return shasum.digest('hex');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/client/dispatcher/index.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAClC,oCAAqC;AAErC,sCAA2D;AAC3D,6DAA2E;AAE9D,QAAA,8BAA8B,GAAG,qBAAqB,CAAC;AAEpE,SAAgB,2BAA2B,CAAC,MAAW;IACrD,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAErC,MAAM,CAAC,IAAI,CACT,EAAE,OAAO,EAAE,QAAQ,CAAC,sBAAsB,EAAE,EAC5C,sBAAsB,CACvB,CAAC;IAEF,OAAO,QAAQ,CAAC,sBAAsB,CAAC;AACzC,CAAC;AATD,kEASC;AAEM,KAAK,UAAU,WAAW,CAC/B,MAAW,EACX,WAAmB,EACnB,cAAsB;IAEtB,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,OAAO,GACX,QAAQ,CAAC,0BAA0B,IAAI,sCAA8B,CAAC;IACxE,MAAM,MAAM,GAAG,IAAI,iCAA2B,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAExC,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,UAAU,EAAE,OAAO,EAAE,EAAE;QACtD,IAAI;YACF,OAAO,MAAM,IAAA,8CAAyB,EAAC,MAAM,EAAE;gBAC7C,cAAc,EAAE,cAAc;gBAC9B,iBAAiB,EAAE,KAAK;aACzB,CAAC,CAAC;SACJ;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,GAAG,CAAC;YACnC,MAAM,CAAC,IAAI,CACT,EAAE,OAAO,EAAE,OAAO,EAAE,EACpB,eAAe,OAAO,2CAA2C,CAClE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;SACvE;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AA7BD,kCA6BC;AAED,SAAS,WAAW,CAAC,MAAW;IAC9B,OAAO,MAAyB,CAAC;AACnC,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACzB,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
package/dist/lib/client/index.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
const primus = require('primus');
|
|
2
2
|
const rp = require('request-promise-native');
|
|
3
|
+
const { v4: uuidv4 } = require('uuid');
|
|
3
4
|
const socket = require('./socket');
|
|
4
5
|
const relay = require('../relay');
|
|
5
6
|
const logger = require('../log');
|
|
6
7
|
const version = require('../version');
|
|
7
|
-
|
|
8
|
+
const { getServerId, highAvailabilityModeEnabled } = require('./dispatcher');
|
|
9
|
+
module.exports = async ({ port = null, config = {}, filters = {} }) => {
|
|
8
10
|
logger.info({ version }, 'running in client mode');
|
|
11
|
+
const brokerClientId = uuidv4();
|
|
12
|
+
logger.info({ brokerClientId }, 'generated broker client id');
|
|
13
|
+
let serverId = '';
|
|
14
|
+
if (highAvailabilityModeEnabled(config)) {
|
|
15
|
+
serverId = await getServerId(config, config.BROKER_TOKEN, brokerClientId);
|
|
16
|
+
if (serverId === null) {
|
|
17
|
+
logger.warn({}, 'could not receive server id from Broker Dispatcher');
|
|
18
|
+
serverId = '';
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
logger.info({ serverId }, 'received server id');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
9
24
|
const identifyingMetadata = {
|
|
10
25
|
version,
|
|
11
26
|
filters,
|
|
12
27
|
capabilities: ['post-streams'],
|
|
28
|
+
clientId: brokerClientId,
|
|
13
29
|
};
|
|
14
30
|
const io = socket({
|
|
15
31
|
token: config.brokerToken,
|
|
@@ -17,6 +33,7 @@ module.exports = ({ port = null, config = {}, filters = {} }) => {
|
|
|
17
33
|
filters: filters.private,
|
|
18
34
|
config,
|
|
19
35
|
identifyingMetadata,
|
|
36
|
+
serverId,
|
|
20
37
|
});
|
|
21
38
|
// start the local webserver to listen for relay requests
|
|
22
39
|
const { app, server } = require('../webserver')(config, port);
|
|
@@ -154,7 +171,7 @@ async function checkCredentials(auth, config, brokerClientValidationMethod, brok
|
|
|
154
171
|
.then((response) => {
|
|
155
172
|
// test logic requires to surface internal data
|
|
156
173
|
// which is best not exposed in production
|
|
157
|
-
if (process.env.
|
|
174
|
+
if (process.env.JEST_WORKER_ID) {
|
|
158
175
|
data.testResponse = response;
|
|
159
176
|
}
|
|
160
177
|
const responseStatusCode = response && response.statusCode;
|
|
@@ -176,7 +193,7 @@ async function checkCredentials(auth, config, brokerClientValidationMethod, brok
|
|
|
176
193
|
.catch((error) => {
|
|
177
194
|
// test logic requires to surface internal data
|
|
178
195
|
// which is best not exposed in production
|
|
179
|
-
if (process.env.
|
|
196
|
+
if (process.env.JEST_WORKER_ID) {
|
|
180
197
|
data.testError = error;
|
|
181
198
|
}
|
|
182
199
|
data.ok = false;
|