snyk 1.1233.0 → 1.1235.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/dist/cli/245.index.js +124 -17
- package/dist/cli/245.index.js.map +1 -1
- package/dist/cli/784.index.js +6 -1
- package/dist/cli/784.index.js.map +1 -1
- package/dist/cli/index.js +20 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/config/index.d.ts +1 -0
- package/dist/lib/organization.d.ts +1 -0
- package/help/cli-commands/code-test.md +2 -2
- package/help/cli-commands/iac-test.md +6 -6
- package/help/cli-commands/log4shell.md +2 -2
- package/help/cli-commands/sbom.md +8 -0
- package/help/cli-commands/test.md +3 -1
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +8 -8
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +8 -8
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/245.index.js
CHANGED
|
@@ -11080,7 +11080,16 @@ async function* prepareRemoteBundle(options) {
|
|
|
11080
11080
|
emitter_1.emitter.createBundleProgress(cumulativeProgress, options.files.length);
|
|
11081
11081
|
for (const chunkedFiles of files_1.composeFilePayloads(options.files)) {
|
|
11082
11082
|
const apiParams = {
|
|
11083
|
-
...lodash_pick_1.default(options, [
|
|
11083
|
+
...lodash_pick_1.default(options, [
|
|
11084
|
+
'baseURL',
|
|
11085
|
+
'sessionToken',
|
|
11086
|
+
'source',
|
|
11087
|
+
'extraHeaders',
|
|
11088
|
+
'removedFiles',
|
|
11089
|
+
'requestId',
|
|
11090
|
+
'org',
|
|
11091
|
+
'orgId',
|
|
11092
|
+
]),
|
|
11084
11093
|
files: chunkedFiles.reduce((d, f) => {
|
|
11085
11094
|
// deepcode ignore PrototypePollution: FP this is an internal code
|
|
11086
11095
|
d[f.bundlePath] = f.hash;
|
|
@@ -11122,6 +11131,7 @@ async function uploadRemoteBundle(options) {
|
|
|
11122
11131
|
'bundleHash',
|
|
11123
11132
|
'requestId',
|
|
11124
11133
|
'org',
|
|
11134
|
+
'orgId',
|
|
11125
11135
|
'extraHeaders',
|
|
11126
11136
|
]);
|
|
11127
11137
|
const uploadFileChunks = async (bucketFiles) => {
|
|
@@ -11152,7 +11162,15 @@ async function fullfillRemoteBundle(options) {
|
|
|
11152
11162
|
// Check remove bundle to make sure no missing files left
|
|
11153
11163
|
let attempts = 0;
|
|
11154
11164
|
let { remoteBundle } = options;
|
|
11155
|
-
const connectionOptions = lodash_pick_1.default(options, [
|
|
11165
|
+
const connectionOptions = lodash_pick_1.default(options, [
|
|
11166
|
+
'baseURL',
|
|
11167
|
+
'sessionToken',
|
|
11168
|
+
'source',
|
|
11169
|
+
'requestId',
|
|
11170
|
+
'org',
|
|
11171
|
+
'orgId',
|
|
11172
|
+
'extraHeaders',
|
|
11173
|
+
]);
|
|
11156
11174
|
while (remoteBundle.missingFiles.length && attempts < (options.maxAttempts || constants_1.MAX_UPLOAD_ATTEMPTS)) {
|
|
11157
11175
|
const missingFiles = await files_1.resolveBundleFiles(options.baseDir, remoteBundle.missingFiles);
|
|
11158
11176
|
await uploadRemoteBundle({
|
|
@@ -11179,6 +11197,7 @@ async function remoteBundleFactory(options) {
|
|
|
11179
11197
|
'baseDir',
|
|
11180
11198
|
'requestId',
|
|
11181
11199
|
'org',
|
|
11200
|
+
'orgId',
|
|
11182
11201
|
'extraHeaders',
|
|
11183
11202
|
]);
|
|
11184
11203
|
const bundleFactory = prepareRemoteBundle(lodash_omit_1.default(options, ['baseDir']));
|
|
@@ -11201,9 +11220,9 @@ exports.remoteBundleFactory = remoteBundleFactory;
|
|
|
11201
11220
|
* @param source
|
|
11202
11221
|
* @returns
|
|
11203
11222
|
*/
|
|
11204
|
-
async function getSupportedFiles(baseURL, source, requestId, languages) {
|
|
11223
|
+
async function getSupportedFiles(baseURL, source, requestId, languages, orgId) {
|
|
11205
11224
|
emitter_1.emitter.supportedFilesLoaded(null);
|
|
11206
|
-
const resp = await http_1.getFilters(baseURL, source,
|
|
11225
|
+
const resp = await http_1.getFilters(baseURL, source, constants_1.MAX_RETRY_ATTEMPTS, requestId, orgId);
|
|
11207
11226
|
if (resp.type === 'error') {
|
|
11208
11227
|
throw resp.error;
|
|
11209
11228
|
}
|
|
@@ -11233,7 +11252,7 @@ exports.getSupportedFiles = getSupportedFiles;
|
|
|
11233
11252
|
*/
|
|
11234
11253
|
async function createBundleFromFolders(options) {
|
|
11235
11254
|
// Fetch supported files to save network traffic
|
|
11236
|
-
const supportedFiles = await getSupportedFiles(options.baseURL, options.source, options.requestId, options.languages);
|
|
11255
|
+
const supportedFiles = await getSupportedFiles(options.baseURL, options.source, options.requestId, options.languages, options.orgId);
|
|
11237
11256
|
// Collect files and create a remote bundle
|
|
11238
11257
|
return await createBundleWithCustomFiles(options, supportedFiles);
|
|
11239
11258
|
}
|
|
@@ -11266,7 +11285,7 @@ async function createBundleWithCustomFiles(options, supportedFiles) {
|
|
|
11266
11285
|
emitter_1.emitter.scanFilesProgress(totalFiles);
|
|
11267
11286
|
}
|
|
11268
11287
|
const bundleOptions = {
|
|
11269
|
-
...lodash_pick_1.default(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'org', 'extraHeaders']),
|
|
11288
|
+
...lodash_pick_1.default(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'org', 'orgId', 'extraHeaders']),
|
|
11270
11289
|
baseDir,
|
|
11271
11290
|
files: bundleFiles,
|
|
11272
11291
|
};
|
|
@@ -11991,6 +12010,7 @@ const zlib_1 = __webpack_require__(59796);
|
|
|
11991
12010
|
const util_1 = __webpack_require__(73837);
|
|
11992
12011
|
const constants_1 = __webpack_require__(65765);
|
|
11993
12012
|
const needle_1 = __webpack_require__(14577);
|
|
12013
|
+
const httpUtils_1 = __webpack_require__(11294);
|
|
11994
12014
|
// The trick to typecast union type alias
|
|
11995
12015
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11996
12016
|
function isSubsetErrorCode(code, messages) {
|
|
@@ -12086,11 +12106,18 @@ async function checkSession(options) {
|
|
|
12086
12106
|
return generateError(res.errorCode, CHECK_SESSION_ERROR_MESSAGES, 'checkSession');
|
|
12087
12107
|
}
|
|
12088
12108
|
exports.checkSession = checkSession;
|
|
12089
|
-
async function getFilters(baseURL, source, attempts = constants_1.MAX_RETRY_ATTEMPTS, requestId) {
|
|
12109
|
+
async function getFilters(baseURL, source, attempts = constants_1.MAX_RETRY_ATTEMPTS, requestId, orgId) {
|
|
12090
12110
|
const apiName = 'filters';
|
|
12111
|
+
let url;
|
|
12112
|
+
try {
|
|
12113
|
+
url = httpUtils_1.getURL(baseURL, '/' + apiName, orgId);
|
|
12114
|
+
}
|
|
12115
|
+
catch (err) {
|
|
12116
|
+
return generateError(400, err.message, apiName);
|
|
12117
|
+
}
|
|
12091
12118
|
const res = await needle_1.makeRequest({
|
|
12092
12119
|
headers: { source, ...(requestId && { 'snyk-request-id': requestId }) },
|
|
12093
|
-
url
|
|
12120
|
+
url,
|
|
12094
12121
|
method: 'get',
|
|
12095
12122
|
}, attempts);
|
|
12096
12123
|
if (res.success) {
|
|
@@ -12118,13 +12145,20 @@ const CREATE_BUNDLE_ERROR_MESSAGES = {
|
|
|
12118
12145
|
};
|
|
12119
12146
|
async function createBundle(options) {
|
|
12120
12147
|
const payloadBody = await compressAndEncode(options.files);
|
|
12148
|
+
let url;
|
|
12149
|
+
try {
|
|
12150
|
+
url = httpUtils_1.getURL(options.baseURL, '/bundle', options.orgId);
|
|
12151
|
+
}
|
|
12152
|
+
catch (err) {
|
|
12153
|
+
return generateError(400, err.message, 'createBundle');
|
|
12154
|
+
}
|
|
12121
12155
|
const payload = {
|
|
12122
12156
|
headers: {
|
|
12123
12157
|
'content-type': 'application/octet-stream',
|
|
12124
12158
|
'content-encoding': 'gzip',
|
|
12125
12159
|
...commonHttpHeaders(options),
|
|
12126
12160
|
},
|
|
12127
|
-
url
|
|
12161
|
+
url,
|
|
12128
12162
|
method: 'post',
|
|
12129
12163
|
body: payloadBody,
|
|
12130
12164
|
isJson: false,
|
|
@@ -12143,11 +12177,18 @@ const CHECK_BUNDLE_ERROR_MESSAGES = {
|
|
|
12143
12177
|
[constants_1.ErrorCodes.notFound]: 'Uploaded bundle has expired',
|
|
12144
12178
|
};
|
|
12145
12179
|
async function checkBundle(options) {
|
|
12180
|
+
let url;
|
|
12181
|
+
try {
|
|
12182
|
+
url = httpUtils_1.getURL(options.baseURL, `/bundle/${options.bundleHash}`, options.orgId);
|
|
12183
|
+
}
|
|
12184
|
+
catch (err) {
|
|
12185
|
+
return generateError(400, err.message, 'checkBundle');
|
|
12186
|
+
}
|
|
12146
12187
|
const res = await needle_1.makeRequest({
|
|
12147
12188
|
headers: {
|
|
12148
12189
|
...commonHttpHeaders(options),
|
|
12149
12190
|
},
|
|
12150
|
-
url
|
|
12191
|
+
url,
|
|
12151
12192
|
method: 'get',
|
|
12152
12193
|
});
|
|
12153
12194
|
if (res.success)
|
|
@@ -12165,13 +12206,20 @@ const EXTEND_BUNDLE_ERROR_MESSAGES = {
|
|
|
12165
12206
|
};
|
|
12166
12207
|
async function extendBundle(options) {
|
|
12167
12208
|
const payloadBody = await compressAndEncode(lodash_pick_1.default(options, ['files', 'removedFiles']));
|
|
12209
|
+
let url;
|
|
12210
|
+
try {
|
|
12211
|
+
url = httpUtils_1.getURL(options.baseURL, `/bundle/${options.bundleHash}`, options.orgId);
|
|
12212
|
+
}
|
|
12213
|
+
catch (err) {
|
|
12214
|
+
return generateError(400, err.message, 'extendBundle');
|
|
12215
|
+
}
|
|
12168
12216
|
const res = await needle_1.makeRequest({
|
|
12169
12217
|
headers: {
|
|
12170
12218
|
'content-type': 'application/octet-stream',
|
|
12171
12219
|
'content-encoding': 'gzip',
|
|
12172
12220
|
...commonHttpHeaders(options),
|
|
12173
12221
|
},
|
|
12174
|
-
url
|
|
12222
|
+
url,
|
|
12175
12223
|
method: 'put',
|
|
12176
12224
|
body: payloadBody,
|
|
12177
12225
|
isJson: false,
|
|
@@ -12200,11 +12248,18 @@ const GET_ANALYSIS_ERROR_MESSAGES = {
|
|
|
12200
12248
|
[constants_1.ErrorCodes.serverError]: 'Getting analysis failed',
|
|
12201
12249
|
};
|
|
12202
12250
|
async function getAnalysis(options) {
|
|
12251
|
+
let url;
|
|
12252
|
+
try {
|
|
12253
|
+
url = httpUtils_1.getURL(options.baseURL, '/analysis', options.orgId);
|
|
12254
|
+
}
|
|
12255
|
+
catch (err) {
|
|
12256
|
+
return generateError(400, err.message, 'getAnalysis');
|
|
12257
|
+
}
|
|
12203
12258
|
const config = {
|
|
12204
12259
|
headers: {
|
|
12205
12260
|
...commonHttpHeaders(options),
|
|
12206
12261
|
},
|
|
12207
|
-
url
|
|
12262
|
+
url,
|
|
12208
12263
|
method: 'post',
|
|
12209
12264
|
body: {
|
|
12210
12265
|
key: {
|
|
@@ -12234,11 +12289,18 @@ const REPORT_ERROR_MESSAGES = {
|
|
|
12234
12289
|
* Trigger a file-based test with reporting.
|
|
12235
12290
|
*/
|
|
12236
12291
|
async function initReport(options) {
|
|
12292
|
+
let url;
|
|
12293
|
+
try {
|
|
12294
|
+
url = httpUtils_1.getURL(options.baseURL, `/report`, options.orgId);
|
|
12295
|
+
}
|
|
12296
|
+
catch (err) {
|
|
12297
|
+
return generateError(400, err.message, 'initReport');
|
|
12298
|
+
}
|
|
12237
12299
|
const config = {
|
|
12238
12300
|
headers: {
|
|
12239
12301
|
...commonHttpHeaders(options),
|
|
12240
12302
|
},
|
|
12241
|
-
url
|
|
12303
|
+
url,
|
|
12242
12304
|
method: 'post',
|
|
12243
12305
|
body: {
|
|
12244
12306
|
workflowData: {
|
|
@@ -12267,11 +12329,18 @@ exports.initReport = initReport;
|
|
|
12267
12329
|
*/
|
|
12268
12330
|
async function getReport(options) {
|
|
12269
12331
|
var _a;
|
|
12332
|
+
let url;
|
|
12333
|
+
try {
|
|
12334
|
+
url = httpUtils_1.getURL(options.baseURL, `/report/${options.pollId}`, options.orgId);
|
|
12335
|
+
}
|
|
12336
|
+
catch (err) {
|
|
12337
|
+
return generateError(400, err.message, 'getReport');
|
|
12338
|
+
}
|
|
12270
12339
|
const config = {
|
|
12271
12340
|
headers: {
|
|
12272
12341
|
...commonHttpHeaders(options),
|
|
12273
12342
|
},
|
|
12274
|
-
url
|
|
12343
|
+
url,
|
|
12275
12344
|
method: 'get',
|
|
12276
12345
|
};
|
|
12277
12346
|
const res = await needle_1.makeRequest(config);
|
|
@@ -12284,11 +12353,18 @@ exports.getReport = getReport;
|
|
|
12284
12353
|
* Trigger an SCM-based test with reporting.
|
|
12285
12354
|
*/
|
|
12286
12355
|
async function initScmReport(options) {
|
|
12356
|
+
let url;
|
|
12357
|
+
try {
|
|
12358
|
+
url = httpUtils_1.getURL(options.baseURL, `/test`, options.orgId);
|
|
12359
|
+
}
|
|
12360
|
+
catch (err) {
|
|
12361
|
+
return generateError(400, err.message, 'initReport');
|
|
12362
|
+
}
|
|
12287
12363
|
const config = {
|
|
12288
12364
|
headers: {
|
|
12289
12365
|
...commonHttpHeaders(options),
|
|
12290
12366
|
},
|
|
12291
|
-
url
|
|
12367
|
+
url,
|
|
12292
12368
|
method: 'post',
|
|
12293
12369
|
body: {
|
|
12294
12370
|
workflowData: {
|
|
@@ -12309,11 +12385,18 @@ exports.initScmReport = initScmReport;
|
|
|
12309
12385
|
*/
|
|
12310
12386
|
async function getScmReport(options) {
|
|
12311
12387
|
var _a;
|
|
12388
|
+
let url;
|
|
12389
|
+
try {
|
|
12390
|
+
url = httpUtils_1.getURL(options.baseURL, `/test/${options.pollId}`, options.orgId);
|
|
12391
|
+
}
|
|
12392
|
+
catch (err) {
|
|
12393
|
+
return generateError(400, err.message, 'getReport');
|
|
12394
|
+
}
|
|
12312
12395
|
const config = {
|
|
12313
12396
|
headers: {
|
|
12314
12397
|
...commonHttpHeaders(options),
|
|
12315
12398
|
},
|
|
12316
|
-
url
|
|
12399
|
+
url,
|
|
12317
12400
|
method: 'get',
|
|
12318
12401
|
};
|
|
12319
12402
|
const res = await needle_1.makeRequest(config);
|
|
@@ -12578,7 +12661,7 @@ async function initAndPollReportGeneric(initReportFunc, getReportFunc, options)
|
|
|
12578
12661
|
while (true) {
|
|
12579
12662
|
// eslint-disable-next-line no-await-in-loop
|
|
12580
12663
|
apiResponse = await getReportFunc({
|
|
12581
|
-
...lodash_pick_1.default(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'org']),
|
|
12664
|
+
...lodash_pick_1.default(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'org', 'orgId']),
|
|
12582
12665
|
pollId,
|
|
12583
12666
|
});
|
|
12584
12667
|
if (apiResponse.type === 'error') {
|
|
@@ -12653,6 +12736,30 @@ exports.reportScm = reportScm;
|
|
|
12653
12736
|
|
|
12654
12737
|
/***/ }),
|
|
12655
12738
|
|
|
12739
|
+
/***/ 11294:
|
|
12740
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
12741
|
+
|
|
12742
|
+
"use strict";
|
|
12743
|
+
|
|
12744
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12745
|
+
exports.getURL = void 0;
|
|
12746
|
+
function getURL(baseURL, path, orgId) {
|
|
12747
|
+
if (routeToGateway(baseURL)) {
|
|
12748
|
+
if (!orgId) {
|
|
12749
|
+
throw new Error('Org is required for this operation');
|
|
12750
|
+
}
|
|
12751
|
+
return `${baseURL}/hidden/orgs/${orgId}/code${path}`;
|
|
12752
|
+
}
|
|
12753
|
+
return `${baseURL}${path}`;
|
|
12754
|
+
}
|
|
12755
|
+
exports.getURL = getURL;
|
|
12756
|
+
function routeToGateway(baseURL) {
|
|
12757
|
+
return baseURL.includes('snykgov.io');
|
|
12758
|
+
}
|
|
12759
|
+
//# sourceMappingURL=httpUtils.js.map
|
|
12760
|
+
|
|
12761
|
+
/***/ }),
|
|
12762
|
+
|
|
12656
12763
|
/***/ 49503:
|
|
12657
12764
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
12658
12765
|
|