snyk 1.1161.0 → 1.1163.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/784.index.js +68 -63
- package/dist/cli/784.index.js.map +1 -1
- package/dist/cli/95.index.js +63 -22
- package/dist/cli/95.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +10 -10
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +10 -10
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/784.index.js
CHANGED
|
@@ -1492,10 +1492,6 @@ async function isFeatureFlagSupportedForOrg(featureFlag, org) {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
exports.isFeatureFlagSupportedForOrg = isFeatureFlagSupportedForOrg;
|
|
1494
1494
|
async function hasFeatureFlag(featureFlag, options) {
|
|
1495
|
-
if (featureFlag === 'iacIntegratedExperience' &&
|
|
1496
|
-
config_1.default.API.includes('snykgov')) {
|
|
1497
|
-
return true;
|
|
1498
|
-
}
|
|
1499
1495
|
const { code, error, ok } = await isFeatureFlagSupportedForOrg(featureFlag, options.org);
|
|
1500
1496
|
if (code === 401 || code === 403) {
|
|
1501
1497
|
throw errors_1.AuthFailedError(error, code);
|
|
@@ -4097,9 +4093,20 @@ async function buildDepGraph(root, manifestFilePath, lockfilePath, lockfileVersi
|
|
|
4097
4093
|
const lockFileContents = fs.readFileSync(lockFileFullPath, 'utf-8');
|
|
4098
4094
|
switch (lockfileVersion) {
|
|
4099
4095
|
case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.YarnLockV1:
|
|
4100
|
-
return await lockFileParser.parseYarnLockV1Project(manifestFileContents, lockFileContents,
|
|
4096
|
+
return await lockFileParser.parseYarnLockV1Project(manifestFileContents, lockFileContents, {
|
|
4097
|
+
includeDevDeps: options.includeDevDeps,
|
|
4098
|
+
includeOptionalDeps: options.includeOptionalDeps,
|
|
4099
|
+
includePeerDeps: options.includePeerDeps || false,
|
|
4100
|
+
pruneLevel: 'withinTopLevelDeps',
|
|
4101
|
+
strictOutOfSync: options.strictOutOfSync,
|
|
4102
|
+
});
|
|
4101
4103
|
case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.YarnLockV2:
|
|
4102
|
-
return await lockFileParser.parseYarnLockV2Project(manifestFileContents, lockFileContents,
|
|
4104
|
+
return await lockFileParser.parseYarnLockV2Project(manifestFileContents, lockFileContents, {
|
|
4105
|
+
includeDevDeps: options.includeDevDeps,
|
|
4106
|
+
includeOptionalDeps: options.includeOptionalDeps,
|
|
4107
|
+
pruneWithinTopLevelDeps: true,
|
|
4108
|
+
strictOutOfSync: options.strictOutOfSync,
|
|
4109
|
+
});
|
|
4103
4110
|
case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.NpmLockV2:
|
|
4104
4111
|
case snyk_nodejs_lockfile_parser_1.NodeLockfileVersion.NpmLockV3:
|
|
4105
4112
|
return await lockFileParser.parseNpmLockV2Project(manifestFileContents, lockFileContents, options);
|
|
@@ -4354,7 +4361,6 @@ async function processYarnWorkspaces(root, settings, targetFiles) {
|
|
|
4354
4361
|
},
|
|
4355
4362
|
scannedProjects: [],
|
|
4356
4363
|
};
|
|
4357
|
-
let rootWorkspaceManifestContent = {};
|
|
4358
4364
|
// the folders must be ordered highest first
|
|
4359
4365
|
for (const directory of Object.keys(yarnTargetFiles)) {
|
|
4360
4366
|
debug(`Processing ${directory} as a potential Yarn workspace`);
|
|
@@ -4377,7 +4383,6 @@ async function processYarnWorkspaces(root, settings, targetFiles) {
|
|
|
4377
4383
|
}
|
|
4378
4384
|
if (packageJsonFileName === workspaceRoot) {
|
|
4379
4385
|
isRootPackageJson = true;
|
|
4380
|
-
rootWorkspaceManifestContent = JSON.parse(packageJson.content);
|
|
4381
4386
|
}
|
|
4382
4387
|
}
|
|
4383
4388
|
if (!(isYarnWorkspacePackage || isRootPackageJson)) {
|
|
@@ -4389,21 +4394,38 @@ async function processYarnWorkspaces(root, settings, targetFiles) {
|
|
|
4389
4394
|
? pathUtil.dirname(yarnWorkspacesFilesMap[packageJsonFileName].root)
|
|
4390
4395
|
: pathUtil.dirname(packageJsonFileName);
|
|
4391
4396
|
const rootYarnLockfileName = pathUtil.join(rootDir, 'yarn.lock');
|
|
4392
|
-
const yarnLock =
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4397
|
+
const yarnLock = get_file_contents_1.getFileContents(root, rootYarnLockfileName);
|
|
4398
|
+
const lockfileVersion = lockFileParser.getYarnLockfileVersion(yarnLock.content);
|
|
4399
|
+
let res;
|
|
4400
|
+
switch (lockfileVersion) {
|
|
4401
|
+
case lockFileParser.NodeLockfileVersion.YarnLockV1:
|
|
4402
|
+
res = await lockFileParser.parseYarnLockV1Project(packageJson.content, yarnLock.content, {
|
|
4403
|
+
includeDevDeps: settings.dev || false,
|
|
4404
|
+
includeOptionalDeps: false,
|
|
4405
|
+
includePeerDeps: false,
|
|
4406
|
+
pruneLevel: 'withinTopLevelDeps',
|
|
4407
|
+
strictOutOfSync: settings.strictOutOfSync === undefined
|
|
4408
|
+
? true
|
|
4409
|
+
: settings.strictOutOfSync,
|
|
4410
|
+
});
|
|
4411
|
+
break;
|
|
4412
|
+
case lockFileParser.NodeLockfileVersion.YarnLockV2:
|
|
4413
|
+
res = await lockFileParser.parseYarnLockV2Project(packageJson.content, yarnLock.content, {
|
|
4414
|
+
includeDevDeps: settings.dev || false,
|
|
4415
|
+
includeOptionalDeps: false,
|
|
4416
|
+
pruneWithinTopLevelDeps: true,
|
|
4417
|
+
strictOutOfSync: settings.strictOutOfSync === undefined
|
|
4418
|
+
? true
|
|
4419
|
+
: settings.strictOutOfSync,
|
|
4420
|
+
});
|
|
4421
|
+
break;
|
|
4422
|
+
default:
|
|
4423
|
+
throw new Error('Failed to build dep graph from current project');
|
|
4401
4424
|
}
|
|
4402
|
-
const res = await lockFileParser.buildDepTree(packageJson.content, yarnLock.content, settings.dev, lockFileParser.LockfileType.yarn, settings.strictOutOfSync !== false);
|
|
4403
4425
|
const project = {
|
|
4404
4426
|
packageManager: 'yarn',
|
|
4405
4427
|
targetFile: pathUtil.relative(root, packageJson.fileName),
|
|
4406
|
-
|
|
4428
|
+
depGraph: res,
|
|
4407
4429
|
plugin: {
|
|
4408
4430
|
name: 'snyk-nodejs-lockfile-parser',
|
|
4409
4431
|
runtime: process.version,
|
|
@@ -6256,11 +6278,13 @@ const snyk_module_1 = __webpack_require__(60390);
|
|
|
6256
6278
|
const depGraphLib = __webpack_require__(71479);
|
|
6257
6279
|
const theme = __webpack_require__(86988);
|
|
6258
6280
|
const json_1 = __webpack_require__(27019);
|
|
6281
|
+
const pMap = __webpack_require__(86301);
|
|
6259
6282
|
const legacy_1 = __webpack_require__(34013);
|
|
6260
6283
|
const errors_1 = __webpack_require__(55191);
|
|
6261
6284
|
const snyk = __webpack_require__(9146);
|
|
6262
6285
|
const is_ci_1 = __webpack_require__(10090);
|
|
6263
6286
|
const common = __webpack_require__(53110);
|
|
6287
|
+
const common_1 = __webpack_require__(53110);
|
|
6264
6288
|
const config_1 = __webpack_require__(25425);
|
|
6265
6289
|
const analytics = __webpack_require__(82744);
|
|
6266
6290
|
const print_deps_1 = __webpack_require__(79792);
|
|
@@ -6276,8 +6300,7 @@ const assemble_payloads_1 = __webpack_require__(38080);
|
|
|
6276
6300
|
const request_1 = __webpack_require__(52050);
|
|
6277
6301
|
const spinner_1 = __webpack_require__(86766);
|
|
6278
6302
|
const dep_graph_1 = __webpack_require__(73399);
|
|
6279
|
-
const
|
|
6280
|
-
const common_2 = __webpack_require__(53110);
|
|
6303
|
+
const common_2 = __webpack_require__(70527);
|
|
6281
6304
|
const debug = debugModule('snyk:run-test');
|
|
6282
6305
|
// Controls the number of simultaneous test requests that can be in-flight.
|
|
6283
6306
|
const MAX_CONCURRENCY = 5;
|
|
@@ -6384,53 +6407,35 @@ async function sendAndParseResults(payloads, spinnerLbl, root, options) {
|
|
|
6384
6407
|
if (!options.quiet) {
|
|
6385
6408
|
await spinner_1.spinner(spinnerLbl);
|
|
6386
6409
|
}
|
|
6387
|
-
const
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6410
|
+
const sendRequest = async (originalPayload) => {
|
|
6411
|
+
let step = 0;
|
|
6412
|
+
let error;
|
|
6413
|
+
while (step < common_1.RETRY_ATTEMPTS) {
|
|
6414
|
+
debug(`sendTestPayload retry step ${step} out of ${common_1.RETRY_ATTEMPTS}`);
|
|
6415
|
+
try {
|
|
6416
|
+
/** sendTestPayload() deletes the request.body from the payload once completed. */
|
|
6417
|
+
const payload = Object.assign({}, originalPayload);
|
|
6418
|
+
const response = await sendTestPayload(payload);
|
|
6419
|
+
return { payload, originalPayload, response };
|
|
6420
|
+
}
|
|
6421
|
+
catch (err) {
|
|
6422
|
+
error = err;
|
|
6423
|
+
step++;
|
|
6424
|
+
if (err instanceof errors_1.InternalServerError ||
|
|
6425
|
+
err instanceof errors_1.BadGatewayError ||
|
|
6426
|
+
err instanceof errors_1.ServiceUnavailableError) {
|
|
6427
|
+
await common_2.sleep(common_1.RETRY_DELAY);
|
|
6399
6428
|
}
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
step++;
|
|
6403
|
-
if (err instanceof errors_1.InternalServerError ||
|
|
6404
|
-
err instanceof errors_1.BadGatewayError ||
|
|
6405
|
-
err instanceof errors_1.ServiceUnavailableError) {
|
|
6406
|
-
await common_1.sleep(common_2.RETRY_DELAY);
|
|
6407
|
-
}
|
|
6408
|
-
else {
|
|
6409
|
-
break;
|
|
6410
|
-
}
|
|
6429
|
+
else {
|
|
6430
|
+
break;
|
|
6411
6431
|
}
|
|
6412
6432
|
}
|
|
6413
|
-
throw error;
|
|
6414
|
-
};
|
|
6415
|
-
requests.push(request);
|
|
6416
|
-
}
|
|
6417
|
-
// Start block adapted from https://gist.github.com/jcouyang/632709f30e12a7879a73e9e132c0d56b?permalink_comment_id=3591045#gistcomment-3591045
|
|
6418
|
-
let index = 0;
|
|
6419
|
-
const responses = [];
|
|
6420
|
-
const execRequest = async () => {
|
|
6421
|
-
while (index < requests.length) {
|
|
6422
|
-
// index is shared across "threads", so capture the current value for this
|
|
6423
|
-
// iteration on this "thread" and increment it for the rest of the world.
|
|
6424
|
-
const curIndex = index++;
|
|
6425
|
-
responses[curIndex] = await requests[curIndex]();
|
|
6426
6433
|
}
|
|
6434
|
+
throw error;
|
|
6427
6435
|
};
|
|
6428
|
-
const
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
}
|
|
6432
|
-
await Promise.all(threads);
|
|
6433
|
-
// End block adapted from https://gist.github.com/jcouyang/632709f30e12a7879a73e9e132c0d56b?permalink_comment_id=3591045#gistcomment-3591045
|
|
6436
|
+
const responses = await pMap(payloads, sendRequest, {
|
|
6437
|
+
concurrency: MAX_CONCURRENCY,
|
|
6438
|
+
});
|
|
6434
6439
|
for (const { payload, originalPayload, response } of responses) {
|
|
6435
6440
|
const { depGraph, payloadPolicy, pkgManager, targetFile, projectName, foundProjectCount, displayTargetFile, dockerfilePackages, platform, scanResult, hasUnknownVersions, } = prepareResponseForParsing(originalPayload, response, options);
|
|
6436
6441
|
const ecosystem = ecosystems_1.getEcosystem(options);
|