snyk 1.719.0 → 1.720.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/741.index.js +24 -16
- package/dist/cli/741.index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli/741.index.js
CHANGED
|
@@ -530,6 +530,7 @@ async function fix(entities, options = {
|
|
|
530
530
|
quiet: false,
|
|
531
531
|
stripAnsi: false,
|
|
532
532
|
}) {
|
|
533
|
+
debug('Running snyk fix with options:', options);
|
|
533
534
|
const spinner = ora({ isSilent: options.quiet, stream: process.stdout });
|
|
534
535
|
let resultsByPlugin = {};
|
|
535
536
|
const { vulnerable, notVulnerable: nothingToFix, } = await partition_by_vulnerable_1.partitionByVulnerable(entities);
|
|
@@ -2206,10 +2207,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
2206
2207
|
exports.pipenvAdd = void 0;
|
|
2207
2208
|
const pathLib = __webpack_require__(85622);
|
|
2208
2209
|
const pipenvPipfileFix = __webpack_require__(91989);
|
|
2210
|
+
const debugLib = __webpack_require__(15158);
|
|
2209
2211
|
const validate_required_data_1 = __webpack_require__(57894);
|
|
2210
2212
|
const attempted_changes_summary_1 = __webpack_require__(70145);
|
|
2211
2213
|
const command_failed_to_run_error_1 = __webpack_require__(72353);
|
|
2212
2214
|
const no_fixes_applied_1 = __webpack_require__(80799);
|
|
2215
|
+
const debug = debugLib('snyk-fix:python:pipenvAdd');
|
|
2213
2216
|
async function pipenvAdd(entity, options, upgrades) {
|
|
2214
2217
|
const changes = [];
|
|
2215
2218
|
let pipenvCommand;
|
|
@@ -2218,12 +2221,13 @@ async function pipenvAdd(entity, options, upgrades) {
|
|
|
2218
2221
|
const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);
|
|
2219
2222
|
const { dir } = pathLib.parse(targetFilePath);
|
|
2220
2223
|
if (!options.dryRun && upgrades.length) {
|
|
2221
|
-
const
|
|
2224
|
+
const { stderr, stdout, command, exitCode, } = await pipenvPipfileFix.pipenvInstall(dir, upgrades, {
|
|
2222
2225
|
python: entity.options.command,
|
|
2223
2226
|
});
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
+
debug('`pipenv add` returned:', { stderr, stdout, command });
|
|
2228
|
+
if (exitCode !== 0) {
|
|
2229
|
+
pipenvCommand = command;
|
|
2230
|
+
throwPipenvError(stderr, stdout, command);
|
|
2227
2231
|
}
|
|
2228
2232
|
}
|
|
2229
2233
|
changes.push(...attempted_changes_summary_1.generateSuccessfulChanges(upgrades, remediation.pin));
|
|
@@ -2234,19 +2238,19 @@ async function pipenvAdd(entity, options, upgrades) {
|
|
|
2234
2238
|
return changes;
|
|
2235
2239
|
}
|
|
2236
2240
|
exports.pipenvAdd = pipenvAdd;
|
|
2237
|
-
function throwPipenvError(stderr, command) {
|
|
2238
|
-
const errorStr = stderr.toLowerCase();
|
|
2241
|
+
function throwPipenvError(stderr, stdout, command) {
|
|
2239
2242
|
const incompatibleDeps = 'There are incompatible versions in the resolved dependencies';
|
|
2240
2243
|
const lockingFailed = 'Locking failed';
|
|
2241
2244
|
const versionNotFound = 'Could not find a version that matches';
|
|
2242
2245
|
const errorsToBubbleUp = [incompatibleDeps, lockingFailed, versionNotFound];
|
|
2243
2246
|
for (const error of errorsToBubbleUp) {
|
|
2244
|
-
if (
|
|
2247
|
+
if (stderr.toLowerCase().includes(error.toLowerCase()) ||
|
|
2248
|
+
stdout.toLowerCase().includes(error.toLowerCase())) {
|
|
2245
2249
|
throw new command_failed_to_run_error_1.CommandFailedError(error, command);
|
|
2246
2250
|
}
|
|
2247
2251
|
}
|
|
2248
2252
|
const SOLVER_PROBLEM = /SolverProblemError(.* version solving failed)/gms;
|
|
2249
|
-
const solverProblemError = SOLVER_PROBLEM.exec(stderr);
|
|
2253
|
+
const solverProblemError = SOLVER_PROBLEM.exec(stderr) || SOLVER_PROBLEM.exec(stdout);
|
|
2250
2254
|
if (solverProblemError) {
|
|
2251
2255
|
throw new command_failed_to_run_error_1.CommandFailedError(solverProblemError[0].trim(), command);
|
|
2252
2256
|
}
|
|
@@ -2461,11 +2465,13 @@ async function fixSequentially(entity, options) {
|
|
|
2461
2465
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2462
2466
|
exports.poetryAdd = void 0;
|
|
2463
2467
|
const pathLib = __webpack_require__(85622);
|
|
2468
|
+
const debugLib = __webpack_require__(15158);
|
|
2464
2469
|
const poetryFix = __webpack_require__(69671);
|
|
2465
2470
|
const validate_required_data_1 = __webpack_require__(57894);
|
|
2466
2471
|
const attempted_changes_summary_1 = __webpack_require__(70145);
|
|
2467
2472
|
const command_failed_to_run_error_1 = __webpack_require__(72353);
|
|
2468
2473
|
const no_fixes_applied_1 = __webpack_require__(80799);
|
|
2474
|
+
const debug = debugLib('snyk-fix:python:poetryAdd');
|
|
2469
2475
|
async function poetryAdd(entity, options, upgrades, dev) {
|
|
2470
2476
|
var _a;
|
|
2471
2477
|
const changes = [];
|
|
@@ -2475,13 +2481,14 @@ async function poetryAdd(entity, options, upgrades, dev) {
|
|
|
2475
2481
|
const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);
|
|
2476
2482
|
const { dir } = pathLib.parse(targetFilePath);
|
|
2477
2483
|
if (!options.dryRun && upgrades.length) {
|
|
2478
|
-
const
|
|
2484
|
+
const { stderr, stdout, command, exitCode } = await poetryFix.poetryAdd(dir, upgrades, {
|
|
2479
2485
|
dev,
|
|
2480
2486
|
python: (_a = entity.options.command) !== null && _a !== void 0 ? _a : undefined,
|
|
2481
2487
|
});
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2488
|
+
debug('`poetry add` returned:', { stderr, stdout, command });
|
|
2489
|
+
if (exitCode !== 0) {
|
|
2490
|
+
poetryCommand = command;
|
|
2491
|
+
throwPoetryError(stderr, stdout, command);
|
|
2485
2492
|
}
|
|
2486
2493
|
}
|
|
2487
2494
|
changes.push(...attempted_changes_summary_1.generateSuccessfulChanges(upgrades, remediation.pin));
|
|
@@ -2492,19 +2499,20 @@ async function poetryAdd(entity, options, upgrades, dev) {
|
|
|
2492
2499
|
return changes;
|
|
2493
2500
|
}
|
|
2494
2501
|
exports.poetryAdd = poetryAdd;
|
|
2495
|
-
function throwPoetryError(stderr, command) {
|
|
2502
|
+
function throwPoetryError(stderr, stdout, command) {
|
|
2496
2503
|
const ALREADY_UP_TO_DATE = 'No dependencies to install or update';
|
|
2497
2504
|
const INCOMPATIBLE_PYTHON = new RegExp(/Python requirement (.*) is not compatible/g, 'gm');
|
|
2498
2505
|
const SOLVER_PROBLEM = /SolverProblemError(.* version solving failed)/gms;
|
|
2499
|
-
const incompatiblePythonError = INCOMPATIBLE_PYTHON.exec(stderr);
|
|
2506
|
+
const incompatiblePythonError = INCOMPATIBLE_PYTHON.exec(stderr) || SOLVER_PROBLEM.exec(stdout);
|
|
2500
2507
|
if (incompatiblePythonError) {
|
|
2501
2508
|
throw new command_failed_to_run_error_1.CommandFailedError(`The current project's Python requirement ${incompatiblePythonError[1]} is not compatible with some of the required packages`, command);
|
|
2502
2509
|
}
|
|
2503
|
-
const solverProblemError = SOLVER_PROBLEM.exec(stderr);
|
|
2510
|
+
const solverProblemError = SOLVER_PROBLEM.exec(stderr) || SOLVER_PROBLEM.exec(stdout);
|
|
2504
2511
|
if (solverProblemError) {
|
|
2505
2512
|
throw new command_failed_to_run_error_1.CommandFailedError(solverProblemError[0].trim(), command);
|
|
2506
2513
|
}
|
|
2507
|
-
if (stderr.includes(ALREADY_UP_TO_DATE)
|
|
2514
|
+
if (stderr.includes(ALREADY_UP_TO_DATE) ||
|
|
2515
|
+
stdout.includes(ALREADY_UP_TO_DATE)) {
|
|
2508
2516
|
throw new command_failed_to_run_error_1.CommandFailedError('No dependencies could be updated as they seem to be at the correct versions. Make sure installed dependencies in the environment match those in the lockfile by running `poetry update`', command);
|
|
2509
2517
|
}
|
|
2510
2518
|
throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();
|
|
@@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,6BAA6B,4CAA4C,MAAM,eAAe;AAC9F;AACA;AACA,yBAAyB,uBAAuB,EAAE,kBAAkB,EAAE,yCAAyC,eAAe,OAAO,EAAE,2BAA2B,YAAY,OAAO;AACrL;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,oCAAoC,yBAAyB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA,8BAA8B,kBAAkB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB,eAAe,EAAE,QAAQ;AAC1D;AACA,aAAa;AACb;AACA,iCAAiC;AACjC;AACA;AACA,oCAAoC,yBAAyB;AAC7D;AACA;AACA;AACA,kCAAkC,sBAAsB,iBAAiB,uBAAuB;AAChG;AACA;AACA,aAAa,sBAAsB,EAAE,wBAAwB;AAC7D;AACA;AACA,aAAa,sBAAsB,EAAE,yBAAyB;AAC9D;AACA;AACA;AACA,aAAa,sBAAsB,EAAE,qBAAqB;AAC1D;AACA;AACA,oBAAoB,qBAAqB,MAAM,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa;AACjI;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,sCAAsC,8BAA8B;AACpE;AACA;AACA,2EAA2E,UAAU;AACrF;AACA;AACA,uEAAuE,MAAM;AAC7E;AACA;AACA,yEAAyE,QAAQ;AACjF;AACA;AACA,sEAAsE,KAAK;AAC3E;AACA;AACA;AACA,kCAAkC;AAClC,+BAA+B;AAC/B;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,4BAA4B;AAC5B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,6BAA6B;AACtD;AACA,6BAA6B,6BAA6B,UAAU,wBAAwB;AAC5F;AACA;AACA,YAAY,sBAAsB;AAClC,gDAAgD,0BAA0B;AAC1E;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA,gBAAgB,sBAAsB,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,sBAAsB,EAAE,mBAAmB;AACzI;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,gBAAgB,6BAA6B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;;;;;;AClQa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,6BAA6B;AAC7B;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB,iCAAiC,mBAAO,CAAC,KAAsC;AAC/E,iBAAiB,mBAAO,CAAC,KAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;;;;;;;ACnBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7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SAAS,KAAK,WAAW;AACvF;AACA;AACA,mBAAmB,QAAQ,GAAG,WAAW;AACzC,SAAS;AACT;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA,0BAA0B;AAC1B;;;;;;;ACvDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,2BAA2B,mBAAO,CAAC,KAAsC;AACzE,oCAAoC,mBAAO,CAAC,KAA6B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACpBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B,GAAG,mBAAmB,GAAG,4BAA4B;AAC/E;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,aAAa;AACb;AACA,0BAA0B;AAC1B;;;;;;;ACtCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC3Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB,aAAa,mBAAO,CAAC,KAAM;AAC3B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,mCAAmC,mBAAO,CAAC,KAAgD;AAC3F,qCAAqC,mBAAO,CAAC,IAA8B;AAC3E;AACA,mFAAmF;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;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ACA;AACA;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,oCAAoC;AACpC;AACA,YAAY,qDAAqD;AACjE;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,yBAAyB;AACrC,aAAa;AACb;AACA,qBAAqB;AACrB;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,2DAA2D,GAAG,eAAe;AACnG;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,sDAAsD,2DAA2D,GAAG,eAAe;AACnI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,YAAY,YAAY;AACxB,YAAY,YAAY;AACxB;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,4BAA4B;AAC5B;AACA;AACA,iBAAiB,UAAU;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACpMa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB;AACrB;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;;;;;;ACjBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B,qBAAqB,mBAAO,CAAC,KAAc;AAC3C,mCAAmC,mBAAO,CAAC,KAAmC;AAC9E;AACA;AACA,6CAA6C,MAAM;AACnD;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wDAAwD,GAAG,WAAW;AACpG;AACA;AACA,KAAK;AACL;AACA;AACA,8BAA8B;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AACA;AACA;AACA,wBAAwB;AACxB;;;;;;;ACtDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B;AAC1B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,wBAAwB,mBAAO,CAAC,IAAiB;AACjD,yBAAyB,mBAAO,CAAC,KAAkB;AACnD,4BAA4B,mBAAO,CAAC,KAAqB;AACzD,mCAAmC,mBAAO,CAAC,KAAoD;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,uDAAuD;AACnE;AACA;AACA;AACA;AACA;AACA,YAAY,gDAAgD;AAC5D;AACA;AACA;AACA;AACA,WAAW,0CAA0C;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;;;;;;;AC/Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;;;;;;ACTa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,mCAAmC,mBAAO,CAAC,KAAmC;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,aAAa;AACb;AACA,6BAA6B;AAC7B;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2CAA2C;AAC3D,iBAAiB;AACjB;AACA;AACA;;;;;;;ACvDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB;AACrB,iBAAiB,mBAAO,CAAC,KAAO;AAChC,YAAY,mBAAO,CAAC,KAAK;AACzB,iCAAiC,mBAAO,CAAC,KAAiC;AAC1E,8BAA8B,mBAAO,CAAC,KAAuB;AAC7D;AACA;AACA,8BAA8B,gBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,iDAAiD;AAC/E,iDAAiD,UAAU,GAAG,eAAe;AAC7E;AACA;AACA,gBAAgB,6BAA6B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;;;;;;AC9Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,mCAAmC,mBAAO,CAAC,KAAmC;AAC9E,iCAAiC,mBAAO,CAAC,KAA8B;AACvE;AACA,YAAY,cAAc;AAC1B,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA,yBAAyB,2DAA2D,IAAI,WAAW;AACnG;AACA,aAAa;AACb;AACA,wBAAwB;AACxB;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B;AAC1B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,qCAAqC,mBAAO,CAAC,KAAkC;AAC/E,2BAA2B,mBAAO,CAAC,KAA4C;AAC/E,4BAA4B,mBAAO,CAAC,KAAqB;AACzD,qBAAqB,mBAAO,CAAC,KAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,sCAAsC,YAAY,MAAM;AACvF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,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AAmC;AAC9E;AACA;AACA;AACA,YAAY,0BAA0B;AACtC;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA,0HAA0H;AAC1H,gIAAgI;AAChI;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2DAA2D,IAAI,WAAW;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,SAAS;AACvE;AACA;AACA,aAAa;AACb;AACA,wBAAwB;AACxB;;;;;;;AC5Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B;AAC1B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,4BAA4B,mBAAO,CAAC,KAAqB;AACzD,qBAAqB,mBAAO,CAAC,KAAc;AAC3C,2BAA2B,mBAAO,CAAC,KAA4C;AAC/E,qCAAqC,mBAAO,CAAC,KAAkC;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,wBAAwB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,sCAAsC,YAAY,MAAM;AACvF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,wBAAwB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,sCAAsC,YAAY,MAAM;AACvF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;ACvGa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,gBAAgB,mBAAO,CAAC,KAAM;AAC9B,kBA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gD,sBAAsB,EAAE,aAAa;AACrF,8CAA8C,sBAAsB,EAAE,aAAa;AACnF;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,+BAA+B;AACnD;AACA,oBAAoB,6BAA6B;AACjD;AACA;AACA;AACA;AACA;AACA,mCAAmC,sBAAsB,EAAE,aAAa,oBAAoB,UAAU;AACtG,+DAA+D,uBAAuB;AACtF;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,iBAAiB;AACjB;;;;;;;AChEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB,2BAA2B,mBAAO,CAAC,KAA6B;AAChE,yBAAyB,mBAAO,CAAC,KAA2B;AAC5D,iBAAiB,mBAAO,CAAC,KAAmB;AAC5C,kCAAkC,mBAAO,CAAC,KAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;;;;;;;ACxBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iCAAiC;AACjC,iBAAiB,mBAAO,CAAC,KAAO;AAChC,2BAA2B,mBAAO,CAAC,KAAoB;AACvD,kCAAkC,mBAAO,CAAC,KAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,uCAAuC;AACtE;AACA,uBAAuB,+BAA+B;AACtD;AACA,aAAa;AACb;AACA,iCAAiC;AACjC;;;;;;;AC3Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gEAAgE,+BAA+B,KAAK;AACrG","sources":["webpack://snyk/./src/cli/commands/fix/convert-legacy-test-result-to-new.ts","webpack://snyk/./src/cli/commands/fix/convert-legacy-test-result-to-scan-result.ts","webpack://snyk/./src/cli/commands/fix/convert-legacy-tests-results-to-fix-entities.ts","webpack://snyk/./src/cli/commands/fix/get-display-path.ts","webpack://snyk/./src/cli/commands/fix/index.ts","webpack://snyk/./src/cli/commands/fix/validate-fix-command-is-supported.ts","webpack://snyk/./src/cli/commands/process-command-args.ts","webpack://snyk/./src/cli/commands/test/format-test-error.ts","webpack://snyk/./src/cli/commands/test/set-default-test-options.ts","webpack://snyk/./src/cli/commands/test/validate-credentials.ts","webpack://snyk/./src/cli/commands/test/validate-test-options.ts","webpack://snyk/./src/lib/errors/fail-on-error.ts.ts","webpack://snyk/./src/lib/errors/not-supported-by-ecosystem.ts","webpack://snyk/./packages/snyk-fix/dist/index.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/command-failed-to-run-error.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/common.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/custom-error.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/error-to-user-message.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/failed-to-parse-manifest.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/missing-file-name.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/missing-remediation-data.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/no-fixes-applied.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/unsupported-type-error.js","webpack://snyk/./packages/snyk-fix/dist/lib/issues/fixable-issues.js","webpack://snyk/./packages/snyk-fix/dist/lib/issues/issues-by-severity.js","webpack://snyk/./packages/snyk-fix/dist/lib/issues/total-issues-count.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/format-display-name.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/format-successful-item.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/format-unresolved-item.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/show-results-summary.js","webpack://snyk/./packages/snyk-fix/dist/partition-by-vulnerable.js","webpack://snyk/./packages/snyk-fix/dist/plugins/load-plugin.js","webpack://snyk/./packages/snyk-fix/dist/plugins/package-tool-supported.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/get-handler-type.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/attempted-changes-summary.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/fail-if-no-updates-applied.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/is-supported.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/contains-require-directive.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/extract-version-provenance.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/apply-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/calculate-relevant-fixes.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/generate-pins.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/generate-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/is-defined.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/requirements-file-parser.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/update-dependencies/generate-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/update-dependencies/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/update-dependencies/pipenv-add.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/update-dependencies/generate-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/update-dependencies/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/update-dependencies/poetry-add.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/validate-required-data.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/load-handler.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/map-entities-per-handler-type.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/standardize-package-name.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/supported-handler-types.js"],"sourcesContent":["import { DepGraphData } from '@snyk/dep-graph';\nimport { IssuesData, Issue, TestResult } from '../../../lib/ecosystems/types';\nimport {\n AnnotatedIssue,\n TestResult as LegacyTestResult,\n} from '../../../lib/snyk-test/legacy';\n\nfunction convertVulnerabilities(\n vulns: AnnotatedIssue[],\n): {\n issuesData: IssuesData;\n issues: Issue[];\n} {\n const issuesData: IssuesData = {};\n const issues: Issue[] = [];\n\n vulns.forEach((vuln) => {\n issuesData[vuln.id] = {\n id: vuln.id,\n severity: vuln.severity,\n title: vuln.title,\n };\n issues.push({\n pkgName: vuln.packageName,\n pkgVersion: vuln.version,\n issueId: vuln.id,\n // TODO: add fixInfo when needed\n fixInfo: {} as any,\n });\n });\n return { issuesData, issues };\n}\n\nexport function convertLegacyTestResultToNew(\n testResult: LegacyTestResult,\n): TestResult {\n const { issues, issuesData } = convertVulnerabilities(\n testResult.vulnerabilities,\n );\n return {\n issuesData,\n issues,\n remediation: testResult.remediation,\n // TODO: grab this once Ecosystems flow starts sending back ScanResult\n depGraphData: {} as DepGraphData,\n };\n}\n","import { ScanResult } from '../../../lib/ecosystems/types';\nimport { TestResult } from '../../../lib/snyk-test/legacy';\n\nexport function convertLegacyTestResultToScanResult(\n testResult: TestResult,\n): ScanResult {\n if (!testResult.packageManager) {\n throw new Error(\n 'Only results with packageManagers are supported for conversion',\n );\n }\n return {\n identity: {\n type: testResult.packageManager,\n // this is because not all plugins send it back today, but we should always have it\n targetFile: testResult.targetFile || testResult.displayTargetFile,\n },\n name: testResult.projectName,\n // TODO: grab this once Ecosystems flow starts sending back ScanResult\n facts: [],\n policy: testResult.policy,\n // TODO: grab this once Ecosystems flow starts sending back ScanResult\n target: {} as any,\n };\n}\n","import * as fs from 'fs';\nimport * as pathLib from 'path';\nimport { convertLegacyTestResultToNew } from './convert-legacy-test-result-to-new';\nimport { convertLegacyTestResultToScanResult } from './convert-legacy-test-result-to-scan-result';\nimport { TestResult } from '../../../lib/snyk-test/legacy';\nimport { EntityToFix } from '@snyk/fix';\nimport { Options, TestOptions } from '../../../lib/types';\n\nexport function convertLegacyTestResultToFixEntities(\n testResults: (TestResult | TestResult[]) | Error,\n root: string,\n options: Partial<Options & TestOptions>,\n): EntityToFix[] {\n if (testResults instanceof Error) {\n return [];\n }\n const oldResults = Array.isArray(testResults) ? testResults : [testResults];\n return oldResults.map((res) => ({\n options,\n workspace: {\n path: root,\n readFile: async (path: string) => {\n return fs.readFileSync(pathLib.resolve(root, path), 'utf8');\n },\n writeFile: async (path: string, content: string) => {\n return fs.writeFileSync(pathLib.resolve(root, path), content, 'utf8');\n },\n },\n scanResult: convertLegacyTestResultToScanResult(res),\n testResult: convertLegacyTestResultToNew(res),\n }));\n}\n","import * as pathLib from 'path';\n\nimport { isLocalFolder } from '../../../lib/detect';\n\nexport function getDisplayPath(path: string): string {\n if (!isLocalFolder(path)) {\n return path;\n }\n if (path === process.cwd()) {\n return pathLib.parse(path).name;\n }\n return pathLib.relative(process.cwd(), path);\n}\n","import * as Debug from 'debug';\nimport * as snykFix from '@snyk/fix';\nimport * as ora from 'ora';\n\nimport { MethodArgs } from '../../args';\nimport * as snyk from '../../../lib';\nimport { TestResult } from '../../../lib/snyk-test/legacy';\nimport * as analytics from '../../../lib/analytics';\n\nimport { convertLegacyTestResultToFixEntities } from './convert-legacy-tests-results-to-fix-entities';\nimport { formatTestError } from '../test/format-test-error';\nimport { processCommandArgs } from '../process-command-args';\nimport { validateCredentials } from '../test/validate-credentials';\nimport { validateTestOptions } from '../test/validate-test-options';\nimport { setDefaultTestOptions } from '../test/set-default-test-options';\nimport { validateFixCommandIsSupported } from './validate-fix-command-is-supported';\nimport { Options, TestOptions } from '../../../lib/types';\nimport { getDisplayPath } from './get-display-path';\nimport chalk from 'chalk';\nimport { icon, color } from '../../../lib/theme';\n\nconst debug = Debug('snyk-fix');\nconst snykFixFeatureFlag = 'cliSnykFix';\n\ninterface FixOptions {\n dryRun?: boolean;\n quiet?: boolean;\n sequential?: boolean;\n}\nexport default async function fix(...args: MethodArgs): Promise<string> {\n const { options: rawOptions, paths } = await processCommandArgs<FixOptions>(\n ...args,\n );\n const options = setDefaultTestOptions<FixOptions>(rawOptions);\n debug(options);\n await validateFixCommandIsSupported(options);\n validateTestOptions(options);\n validateCredentials(options);\n const results: snykFix.EntityToFix[] = [];\n results.push(...(await runSnykTestLegacy(options, paths)));\n // fix\n debug(\n `Organization has ${snykFixFeatureFlag} feature flag enabled for experimental Snyk fix functionality`,\n );\n const vulnerableResults = results.filter(\n (res) => Object.keys(res.testResult.issues).length,\n );\n const { dryRun, quiet, sequential: sequentialFix } = options;\n const { fixSummary, meta, results: resultsByPlugin } = await snykFix.fix(\n results,\n {\n dryRun,\n quiet,\n sequentialFix,\n },\n );\n\n setSnykFixAnalytics(\n fixSummary,\n meta,\n results,\n resultsByPlugin,\n vulnerableResults,\n );\n // `snyk test` did not return any test results\n if (results.length === 0) {\n throw new Error(fixSummary);\n }\n // `snyk test` returned no vulnerable results, so nothing to fix\n if (vulnerableResults.length === 0) {\n return fixSummary;\n }\n // `snyk test` returned vulnerable results\n // however some errors occurred during `snyk fix` and nothing was fixed in the end\n const anyFailed = meta.failed > 0;\n const noneFixed = meta.fixed === 0;\n if (anyFailed && noneFixed) {\n throw new Error(fixSummary);\n }\n return fixSummary;\n}\n\n/* @deprecated\n * TODO: once project envelope is default all code below will be deleted\n * we should be calling test via new Ecosystems instead\n */\nasync function runSnykTestLegacy(\n options: Options & TestOptions & FixOptions,\n paths: string[],\n): Promise<snykFix.EntityToFix[]> {\n const results: snykFix.EntityToFix[] = [];\n const stdOutSpinner = ora({\n isSilent: options.quiet,\n stream: process.stdout,\n });\n const stdErrSpinner = ora({\n isSilent: options.quiet,\n stream: process.stdout,\n });\n stdErrSpinner.start();\n stdOutSpinner.start();\n\n for (const path of paths) {\n let displayPath = path;\n const spinnerMessage = `Running \\`snyk test\\` for ${displayPath}`;\n\n try {\n displayPath = getDisplayPath(path);\n stdOutSpinner.text = spinnerMessage;\n stdOutSpinner.render();\n // Create a copy of the options so a specific test can\n // modify them i.e. add `options.file` etc. We'll need\n // these options later.\n const snykTestOptions = {\n ...options,\n path,\n projectName: options['project-name'],\n };\n\n const testResults: TestResult[] = [];\n\n const testResultForPath: TestResult | TestResult[] = await snyk.test(\n path,\n { ...snykTestOptions, quiet: true },\n );\n testResults.push(\n ...(Array.isArray(testResultForPath)\n ? testResultForPath\n : [testResultForPath]),\n );\n const newRes = convertLegacyTestResultToFixEntities(\n testResults,\n path,\n options,\n );\n results.push(...newRes);\n stdOutSpinner.stopAndPersist({\n text: spinnerMessage,\n symbol: `\\n${icon.RUN}`,\n });\n } catch (error) {\n const testError = formatTestError(error);\n const userMessage =\n color.status.error(`Failed! ${testError.message}.`) +\n `\\n Tip: run \\`snyk test ${displayPath} -d\\` for more information.`;\n stdOutSpinner.stopAndPersist({\n text: spinnerMessage,\n symbol: `\\n${icon.RUN}`,\n });\n stdErrSpinner.stopAndPersist({\n text: userMessage,\n symbol: chalk.red(' '),\n });\n debug(userMessage);\n }\n }\n stdOutSpinner.stop();\n stdErrSpinner.stop();\n return results;\n}\n\nfunction setSnykFixAnalytics(\n fixSummary: string,\n meta: snykFix.FixedMeta,\n snykTestResponses: snykFix.EntityToFix[],\n resultsByPlugin: snykFix.FixHandlerResultByPlugin,\n vulnerableResults: snykFix.EntityToFix[],\n) {\n // Analytics # of projects\n analytics.add('snykFixFailedProjects', meta.failed);\n analytics.add('snykFixFixedProjects', meta.fixed);\n analytics.add('snykFixTotalProjects', snykTestResponses.length);\n analytics.add('snykFixVulnerableProjects', vulnerableResults.length);\n\n // Analytics # of issues\n analytics.add('snykFixFixableIssues', meta.fixableIssues);\n analytics.add('snykFixFixedIssues', meta.fixedIssues);\n analytics.add('snykFixTotalIssues', meta.totalIssues);\n\n analytics.add('snykFixSummary', fixSummary);\n\n // Analytics for errors\n for (const plugin of Object.keys(resultsByPlugin)) {\n const errors: string[] = [];\n const failedToFix = resultsByPlugin[plugin].failed;\n if (failedToFix.length > 0) {\n errors.push(...failedToFix.map((f) => f.error?.message));\n }\n analytics.add('snykFixErrors', { [plugin]: errors });\n }\n}\n","import * as Debug from 'debug';\n\nimport { getEcosystemForTest } from '../../../lib/ecosystems';\n\nimport { isFeatureFlagSupportedForOrg } from '../../../lib/feature-flags';\nimport { FeatureNotSupportedByEcosystemError } from '../../../lib/errors/not-supported-by-ecosystem';\nimport { Options, TestOptions } from '../../../lib/types';\nimport { AuthFailedError } from '../../../lib/errors';\nimport chalk from 'chalk';\n\nconst debug = Debug('snyk-fix');\nconst snykFixFeatureFlag = 'cliSnykFix';\n\nexport async function validateFixCommandIsSupported(\n options: Options & TestOptions,\n): Promise<boolean> {\n if (options.docker) {\n throw new FeatureNotSupportedByEcosystemError('snyk fix', 'docker');\n }\n\n const ecosystem = getEcosystemForTest(options);\n if (ecosystem) {\n throw new FeatureNotSupportedByEcosystemError('snyk fix', ecosystem);\n }\n\n const snykFixSupported = await isFeatureFlagSupportedForOrg(\n snykFixFeatureFlag,\n options.org,\n );\n\n debug('Feature flag check returned: ', snykFixSupported);\n\n if (snykFixSupported.code === 401 || snykFixSupported.code === 403) {\n throw AuthFailedError(snykFixSupported.error, snykFixSupported.code);\n }\n\n if (!snykFixSupported.ok) {\n const snykFixErrorMessage =\n chalk.red(\n `\\`snyk fix\\` is not supported${\n options.org ? ` for org '${options.org}'` : ''\n }.`,\n ) +\n '\\nSee documentation on how to enable this beta feature: https://support.snyk.io/hc/en-us/articles/4403417279505-Automatic-remediation-with-snyk-fix';\n const unsupportedError = new Error(snykFixErrorMessage);\n throw unsupportedError;\n }\n\n return true;\n}\n","import { Options } from '../../lib/types';\n\nexport function processCommandArgs<CommandOptions>(\n ...args\n): { paths: string[]; options: Options & CommandOptions } {\n let options = ({} as any) as Options & CommandOptions;\n\n if (typeof args[args.length - 1] === 'object') {\n options = (args.pop() as any) as Options & CommandOptions;\n }\n args = args.filter(Boolean);\n\n // For repository scanning, populate with default path (cwd) if no path given\n if (args.length === 0 && !options.docker) {\n args.unshift(process.cwd());\n }\n\n return { options, paths: args };\n}\n","export function formatTestError(error) {\n // Possible error cases:\n // - the test found some vulns. `error.message` is a\n // JSON-stringified\n // test result.\n // - the flow failed, `error` is a real Error object.\n // - the flow failed, `error` is a number or string\n // describing the problem.\n //\n // To standardise this, make sure we use the best _object_ to\n // describe the error.\n let errorResponse;\n if (error instanceof Error) {\n errorResponse = error;\n } else if (typeof error !== 'object') {\n errorResponse = new Error(error);\n } else {\n try {\n errorResponse = JSON.parse(error.message);\n } catch (unused) {\n errorResponse = error;\n }\n }\n return errorResponse;\n}\n","import config from '../../../lib/config';\nimport { Options, ShowVulnPaths, TestOptions } from '../../../lib/types';\n\nexport function setDefaultTestOptions<CommandOptions>(\n options: Options & CommandOptions,\n): Options & TestOptions & CommandOptions {\n const svpSupplied = (options['show-vulnerable-paths'] || '')\n .toString()\n .toLowerCase();\n\n delete options['show-vulnerable-paths'];\n return {\n ...options,\n // org fallback to config unless specified\n org: options.org || config.org,\n // making `show-vulnerable-paths` 'some' by default.\n showVulnPaths: showVulnPathsMapping[svpSupplied] || 'some',\n };\n}\n\nconst showVulnPathsMapping: Record<string, ShowVulnPaths> = {\n false: 'none',\n none: 'none',\n true: 'some',\n some: 'some',\n all: 'all',\n};\n","import {\n apiTokenExists,\n getOAuthToken,\n getDockerToken,\n} from '../../../lib/api-token';\nimport { TestOptions, Options } from '../../../lib/types';\n\nexport function validateCredentials(options: Options & TestOptions): void {\n try {\n apiTokenExists();\n } catch (err) {\n if (getOAuthToken()) {\n return;\n } else if (options.docker && getDockerToken()) {\n options.testDepGraphDockerEndpoint = '/docker-jwt/test-dependencies';\n options.isDockerUser = true;\n } else {\n throw err;\n }\n }\n}\n","import { color } from '../../../lib/theme';\nimport { TestOptions, Options } from '../../../lib/types';\nimport { FAIL_ON, FailOn, SEVERITIES } from '../../../lib/snyk-test/common';\nimport { FailOnError } from '../../../lib/errors/fail-on-error.ts';\n\nexport function validateTestOptions(options: TestOptions & Options) {\n if (\n options.severityThreshold &&\n !validateSeverityThreshold(options.severityThreshold)\n ) {\n throw new Error('INVALID_SEVERITY_THRESHOLD');\n }\n\n if (options.failOn && !validateFailOn(options.failOn)) {\n const error = new FailOnError();\n throw color.status.error(error.message);\n }\n}\n\nfunction validateSeverityThreshold(severityThreshold) {\n return SEVERITIES.map((s) => s.verboseName).indexOf(severityThreshold) > -1;\n}\n\nfunction validateFailOn(arg: FailOn) {\n return Object.keys(FAIL_ON).includes(arg);\n}\n","import { CustomError } from './custom-error';\nimport { FAIL_ON } from '../snyk-test/common';\n\nexport class FailOnError extends CustomError {\n private static ERROR_MESSAGE =\n 'Invalid fail on argument, please use one of: ' +\n Object.keys(FAIL_ON).join(' | ');\n\n constructor() {\n super(FailOnError.ERROR_MESSAGE);\n }\n}\n","import { CustomError } from './custom-error';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { Ecosystem } from '../ecosystems/types';\n\nexport class FeatureNotSupportedByEcosystemError extends CustomError {\n public readonly feature: string;\n\n constructor(\n feature: string,\n ecosystem: SupportedPackageManagers | Ecosystem,\n ) {\n super(`Unsupported ecosystem ${ecosystem} for ${feature}.`);\n this.code = 422;\n this.feature = feature;\n\n this.userMessage = `\\`${feature}\\` is not supported for ecosystem '${ecosystem}'`;\n }\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.extractMeta = exports.groupEntitiesPerScanType = exports.fix = void 0;\nconst debugLib = require(\"debug\");\nconst pMap = require(\"p-map\");\nconst ora = require(\"ora\");\nconst chalk = require(\"chalk\");\nconst outputFormatter = require(\"./lib/output-formatters/show-results-summary\");\nconst load_plugin_1 = require(\"./plugins/load-plugin\");\nconst partition_by_vulnerable_1 = require(\"./partition-by-vulnerable\");\nconst error_to_user_message_1 = require(\"./lib/errors/error-to-user-message\");\nconst total_issues_count_1 = require(\"./lib/issues/total-issues-count\");\nconst fixable_issues_1 = require(\"./lib/issues/fixable-issues\");\nconst debug = debugLib('snyk-fix:main');\nasync function fix(entities, options = {\n dryRun: false,\n quiet: false,\n stripAnsi: false,\n}) {\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n let resultsByPlugin = {};\n const { vulnerable, notVulnerable: nothingToFix, } = await partition_by_vulnerable_1.partitionByVulnerable(entities);\n const entitiesPerType = groupEntitiesPerScanType(vulnerable);\n const exceptions = {};\n await pMap(Object.keys(entitiesPerType), async (scanType) => {\n try {\n const fixPlugin = load_plugin_1.loadPlugin(scanType);\n const results = await fixPlugin(entitiesPerType[scanType], options);\n resultsByPlugin = { ...resultsByPlugin, ...results };\n }\n catch (e) {\n debug(`Failed to processes ${scanType}`, e);\n exceptions[scanType] = {\n originals: entitiesPerType[scanType],\n userMessage: error_to_user_message_1.convertErrorToUserMessage(e),\n };\n }\n }, {\n concurrency: 3,\n });\n const fixSummary = await outputFormatter.showResultsSummary(nothingToFix, resultsByPlugin, exceptions, options, entities.length);\n const meta = extractMeta(resultsByPlugin, exceptions);\n spinner.start();\n if (meta.fixed > 0) {\n spinner.stopAndPersist({\n text: 'Done',\n symbol: chalk.green('✔'),\n });\n }\n else {\n spinner.stop();\n }\n return {\n results: resultsByPlugin,\n exceptions,\n fixSummary,\n meta,\n };\n}\nexports.fix = fix;\nfunction groupEntitiesPerScanType(entities) {\n var _a, _b, _c;\n const entitiesPerType = {};\n for (const entity of entities) {\n // TODO: group all node\n const type = (_c = (_b = (_a = entity.scanResult) === null || _a === void 0 ? void 0 : _a.identity) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : 'missing-type';\n if (entitiesPerType[type]) {\n entitiesPerType[type].push(entity);\n continue;\n }\n entitiesPerType[type] = [entity];\n }\n return entitiesPerType;\n}\nexports.groupEntitiesPerScanType = groupEntitiesPerScanType;\nfunction extractMeta(resultsByPlugin, exceptions) {\n const testResults = outputFormatter.getTestResults(resultsByPlugin, exceptions);\n const issueData = testResults.map((i) => i.issuesData);\n const failed = outputFormatter.calculateFailed(resultsByPlugin, exceptions);\n const fixed = outputFormatter.calculateFixed(resultsByPlugin);\n const totalIssueCount = total_issues_count_1.getTotalIssueCount(issueData);\n const { count: fixableCount } = fixable_issues_1.hasFixableIssues(testResults);\n const fixedIssueCount = outputFormatter.calculateFixedIssues(resultsByPlugin);\n return {\n fixed,\n failed,\n totalIssues: totalIssueCount,\n fixableIssues: fixableCount,\n fixedIssues: fixedIssueCount,\n };\n}\nexports.extractMeta = extractMeta;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CommandFailedError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass CommandFailedError extends custom_error_1.CustomError {\n constructor(customMessage, command) {\n super(customMessage, custom_error_1.ERROR_CODES.CommandFailed);\n this.command = command;\n }\n}\nexports.CommandFailedError = CommandFailedError;\n//# sourceMappingURL=command-failed-to-run-error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.contactSupportMessage = exports.reTryMessage = void 0;\nexports.reTryMessage = 'Tip: Re-run in debug mode to see more information: DEBUG=*snyk* <COMMAND>';\nexports.contactSupportMessage = 'If the issue persists contact support@snyk.io';\n//# sourceMappingURL=common.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ERROR_CODES = exports.CustomError = void 0;\nclass CustomError extends Error {\n constructor(message, errorCode) {\n super(message);\n this.name = this.constructor.name;\n this.innerError = undefined;\n this.errorCode = errorCode;\n }\n}\nexports.CustomError = CustomError;\nvar ERROR_CODES;\n(function (ERROR_CODES) {\n ERROR_CODES[\"UnsupportedTypeError\"] = \"G10\";\n ERROR_CODES[\"MissingRemediationData\"] = \"G11\";\n ERROR_CODES[\"MissingFileName\"] = \"G12\";\n ERROR_CODES[\"FailedToParseManifest\"] = \"G13\";\n ERROR_CODES[\"CommandFailed\"] = \"G14\";\n ERROR_CODES[\"NoFixesCouldBeApplied\"] = \"G15\";\n})(ERROR_CODES = exports.ERROR_CODES || (exports.ERROR_CODES = {}));\n//# sourceMappingURL=custom-error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.convertErrorToUserMessage = void 0;\nconst unsupported_type_error_1 = require(\"./unsupported-type-error\");\nfunction convertErrorToUserMessage(error) {\n if (error instanceof unsupported_type_error_1.UnsupportedTypeError) {\n return `${error.scanType} is not supported.`;\n }\n return error.message;\n}\nexports.convertErrorToUserMessage = convertErrorToUserMessage;\n//# sourceMappingURL=error-to-user-message.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FailedToParseManifest = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass FailedToParseManifest extends custom_error_1.CustomError {\n constructor() {\n super('Failed to parse manifest', custom_error_1.ERROR_CODES.FailedToParseManifest);\n }\n}\nexports.FailedToParseManifest = FailedToParseManifest;\n//# sourceMappingURL=failed-to-parse-manifest.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MissingFileNameError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass MissingFileNameError extends custom_error_1.CustomError {\n constructor() {\n super('Filename is missing from test result', custom_error_1.ERROR_CODES.MissingFileName);\n }\n}\nexports.MissingFileNameError = MissingFileNameError;\n//# sourceMappingURL=missing-file-name.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MissingRemediationDataError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass MissingRemediationDataError extends custom_error_1.CustomError {\n constructor() {\n super('Remediation data is required to apply fixes', custom_error_1.ERROR_CODES.MissingRemediationData);\n }\n}\nexports.MissingRemediationDataError = MissingRemediationDataError;\n//# sourceMappingURL=missing-remediation-data.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NoFixesCouldBeAppliedError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass NoFixesCouldBeAppliedError extends custom_error_1.CustomError {\n constructor(message, tip) {\n super(message || 'No fixes could be applied', custom_error_1.ERROR_CODES.NoFixesCouldBeApplied);\n this.tip = tip;\n }\n}\nexports.NoFixesCouldBeAppliedError = NoFixesCouldBeAppliedError;\n//# sourceMappingURL=no-fixes-applied.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UnsupportedTypeError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass UnsupportedTypeError extends custom_error_1.CustomError {\n constructor(scanType) {\n super('Provided scan type is not supported', custom_error_1.ERROR_CODES.UnsupportedTypeError);\n this.scanType = scanType;\n }\n}\nexports.UnsupportedTypeError = UnsupportedTypeError;\n//# sourceMappingURL=unsupported-type-error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasFixableIssues = void 0;\nfunction hasFixableIssues(results) {\n let hasFixes = false;\n let count = 0;\n for (const result of Object.values(results)) {\n const { remediation } = result;\n if (remediation) {\n const { upgrade, pin, patch } = remediation;\n const upgrades = Object.keys(upgrade);\n const pins = Object.keys(pin);\n if (pins.length || upgrades.length) {\n hasFixes = true;\n // pins & upgrades are mutually exclusive\n count += getUpgradableIssues(pins.length ? pin : upgrade);\n }\n const patches = Object.keys(patch);\n if (patches.length) {\n hasFixes = true;\n count += patches.length;\n }\n }\n }\n return {\n hasFixes,\n count,\n };\n}\nexports.hasFixableIssues = hasFixableIssues;\nfunction getUpgradableIssues(updates) {\n const issues = [];\n for (const id of Object.keys(updates)) {\n issues.push(...updates[id].vulns);\n }\n return issues.length;\n}\n//# sourceMappingURL=fixable-issues.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getIssueCountBySeverity = void 0;\nfunction getIssueCountBySeverity(issueData) {\n const total = {\n low: [],\n medium: [],\n high: [],\n critical: [],\n };\n for (const entry of issueData) {\n for (const issue of Object.values(entry)) {\n const { severity, id } = issue;\n total[severity.toLowerCase()].push(id);\n }\n }\n return total;\n}\nexports.getIssueCountBySeverity = getIssueCountBySeverity;\n//# sourceMappingURL=issues-by-severity.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getTotalIssueCount = void 0;\nfunction getTotalIssueCount(issueData) {\n let total = 0;\n for (const entry of issueData) {\n total += Object.keys(entry).length;\n }\n return total;\n}\nexports.getTotalIssueCount = getTotalIssueCount;\n//# sourceMappingURL=total-issues-count.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatDisplayName = void 0;\nconst pathLib = require(\"path\");\nfunction formatDisplayName(path, identity) {\n if (!identity.targetFile) {\n return `${identity.type} project`;\n }\n // show paths relative to where `snyk fix` is running\n return pathLib.relative(process.cwd(), pathLib.join(path, identity.targetFile));\n}\nexports.formatDisplayName = formatDisplayName;\n//# sourceMappingURL=format-display-name.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatChangesSummary = void 0;\nconst chalk = require(\"chalk\");\nconst format_display_name_1 = require(\"./format-display-name\");\nconst show_results_summary_1 = require(\"./show-results-summary\");\n/*\n * Generate formatted output that describes what changes were applied, which failed.\n */\nfunction formatChangesSummary(entity, changes) {\n return `${show_results_summary_1.PADDING_SPACE}${format_display_name_1.formatDisplayName(entity.workspace.path, entity.scanResult.identity)}\\n${changes.map((c) => formatAppliedChange(c)).join('\\n')}`;\n}\nexports.formatChangesSummary = formatChangesSummary;\nfunction formatAppliedChange(change) {\n if (change.success === true) {\n return `${show_results_summary_1.PADDING_SPACE}${chalk.green('✔')} ${change.userMessage}`;\n }\n if (change.success === false) {\n return `${show_results_summary_1.PADDING_SPACE}${chalk.red('x')} ${chalk.red(change.userMessage)}\\n${show_results_summary_1.PADDING_SPACE}Reason:${show_results_summary_1.PADDING_SPACE}${change.reason}${change.tip ? `.\\n${show_results_summary_1.PADDING_SPACE}Tip: ${change.tip}` : undefined}`;\n }\n return '';\n}\n//# sourceMappingURL=format-successful-item.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatUnresolved = void 0;\nconst chalk = require(\"chalk\");\nconst format_display_name_1 = require(\"./format-display-name\");\nconst show_results_summary_1 = require(\"./show-results-summary\");\nfunction formatUnresolved(entity, userMessage, tip) {\n const name = format_display_name_1.formatDisplayName(entity.workspace.path, entity.scanResult.identity);\n const tipMessage = tip ? `\\n${show_results_summary_1.PADDING_SPACE}Tip: ${tip}` : '';\n const errorMessage = `${show_results_summary_1.PADDING_SPACE}${name}\\n${show_results_summary_1.PADDING_SPACE}${chalk.red('✖')} ${chalk.red(userMessage)}`;\n return errorMessage + tipMessage;\n}\nexports.formatUnresolved = formatUnresolved;\n//# sourceMappingURL=format-unresolved-item.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getTestResults = exports.generateIssueSummary = exports.getSeveritiesColour = exports.defaultSeverityColor = exports.severitiesColourMapping = exports.formatIssueCountBySeverity = exports.calculateFailed = exports.calculateFixedIssues = exports.calculateFixed = exports.generateOverallSummary = exports.generateUnresolvedSummary = exports.generateSuccessfulFixesSummary = exports.showResultsSummary = exports.PADDING_SPACE = void 0;\nconst chalk = require(\"chalk\");\nconst stripAnsi = require(\"strip-ansi\");\nconst common_1 = require(\"../errors/common\");\nconst error_to_user_message_1 = require(\"../errors/error-to-user-message\");\nconst fixable_issues_1 = require(\"../issues/fixable-issues\");\nconst issues_by_severity_1 = require(\"../issues/issues-by-severity\");\nconst total_issues_count_1 = require(\"../issues/total-issues-count\");\nconst format_successful_item_1 = require(\"./format-successful-item\");\nconst format_unresolved_item_1 = require(\"./format-unresolved-item\");\nexports.PADDING_SPACE = ' '; // 2 spaces\nasync function showResultsSummary(nothingToFix, resultsByPlugin, exceptions, options, total) {\n const successfulFixesSummary = generateSuccessfulFixesSummary(resultsByPlugin);\n const { summary: unresolvedSummary, count: unresolvedCount, } = generateUnresolvedSummary(resultsByPlugin, exceptions);\n const { summary: overallSummary, count: changedCount, } = generateOverallSummary(resultsByPlugin, exceptions, nothingToFix, options);\n const getHelpText = `${common_1.reTryMessage}. ${common_1.contactSupportMessage}`;\n // called without any `snyk test` results\n if (total === 0) {\n const summary = `\\n${chalk.red(' ✖ No successful fixes')}`;\n return options.stripAnsi ? stripAnsi(summary) : summary;\n }\n // 100% not vulnerable and had no errors/unsupported\n if (nothingToFix.length === total && unresolvedCount === 0) {\n const summary = `\\n${chalk.green('✔ No vulnerable items to fix')}\\n\\n${overallSummary}`;\n return options.stripAnsi ? stripAnsi(summary) : summary;\n }\n const summary = `\\n${successfulFixesSummary}${unresolvedSummary}${unresolvedCount || changedCount ? `\\n\\n${overallSummary}` : ''}${unresolvedSummary ? `\\n\\n${getHelpText}` : ''}`;\n return options.stripAnsi ? stripAnsi(summary) : summary;\n}\nexports.showResultsSummary = showResultsSummary;\nfunction generateSuccessfulFixesSummary(resultsByPlugin) {\n const sectionTitle = 'Successful fixes:';\n const formattedTitleHeader = `${chalk.bold(sectionTitle)}`;\n let summary = '';\n for (const plugin of Object.keys(resultsByPlugin)) {\n const fixedSuccessfully = resultsByPlugin[plugin].succeeded;\n if (fixedSuccessfully.length > 0) {\n summary +=\n '\\n\\n' +\n fixedSuccessfully\n .map((s) => format_successful_item_1.formatChangesSummary(s.original, s.changes))\n .join('\\n\\n');\n }\n }\n if (summary) {\n return formattedTitleHeader + summary;\n }\n return chalk.red(' ✖ No successful fixes\\n');\n}\nexports.generateSuccessfulFixesSummary = generateSuccessfulFixesSummary;\nfunction generateUnresolvedSummary(resultsByPlugin, exceptionsByScanType) {\n const title = 'Unresolved items:';\n const formattedTitle = `${chalk.bold(title)}`;\n let summary = '';\n let count = 0;\n for (const plugin of Object.keys(resultsByPlugin)) {\n const skipped = resultsByPlugin[plugin].skipped;\n if (skipped.length > 0) {\n count += skipped.length;\n summary +=\n '\\n\\n' +\n skipped\n .map((s) => format_unresolved_item_1.formatUnresolved(s.original, s.userMessage))\n .join('\\n\\n');\n }\n const failed = resultsByPlugin[plugin].failed;\n if (failed.length > 0) {\n count += failed.length;\n summary +=\n '\\n\\n' +\n failed\n .map((s) => format_unresolved_item_1.formatUnresolved(s.original, error_to_user_message_1.convertErrorToUserMessage(s.error), s.tip))\n .join('\\n\\n');\n }\n }\n if (Object.keys(exceptionsByScanType).length) {\n for (const ecosystem of Object.keys(exceptionsByScanType)) {\n const unresolved = exceptionsByScanType[ecosystem];\n count += unresolved.originals.length;\n summary +=\n '\\n\\n' +\n unresolved.originals\n .map((s) => format_unresolved_item_1.formatUnresolved(s, unresolved.userMessage))\n .join('\\n\\n');\n }\n }\n if (summary) {\n return { summary: `\\n\\n${formattedTitle}${summary}`, count };\n }\n return { summary: '', count: 0 };\n}\nexports.generateUnresolvedSummary = generateUnresolvedSummary;\nfunction generateOverallSummary(resultsByPlugin, exceptions, nothingToFix, options) {\n const sectionTitle = 'Summary:';\n const formattedTitleHeader = `${chalk.bold(sectionTitle)}`;\n const fixed = calculateFixed(resultsByPlugin);\n const failed = calculateFailed(resultsByPlugin, exceptions);\n const dryRunText = options.dryRun\n ? chalk.hex('#EDD55E')(`${exports.PADDING_SPACE}Command run in ${chalk.bold('dry run')} mode. Fixes are not applied.\\n`)\n : '';\n const notFixedMessage = failed > 0\n ? `${exports.PADDING_SPACE}${chalk.bold.red(failed)} items were not fixed\\n`\n : '';\n const fixedMessage = fixed > 0\n ? `${exports.PADDING_SPACE}${chalk.green.bold(fixed)} items were successfully fixed\\n`\n : '';\n const vulnsSummary = generateIssueSummary(resultsByPlugin, exceptions);\n const notVulnerableSummary = nothingToFix.length > 0\n ? `${exports.PADDING_SPACE}${nothingToFix.length} items were not vulnerable\\n`\n : '';\n return {\n summary: `${formattedTitleHeader}\\n\\n${dryRunText}${notFixedMessage}${fixedMessage}${notVulnerableSummary}${vulnsSummary}`,\n count: fixed + failed,\n };\n}\nexports.generateOverallSummary = generateOverallSummary;\nfunction calculateFixed(resultsByPlugin) {\n let fixed = 0;\n for (const plugin of Object.keys(resultsByPlugin)) {\n fixed += resultsByPlugin[plugin].succeeded.length;\n }\n return fixed;\n}\nexports.calculateFixed = calculateFixed;\nfunction calculateFixedIssues(resultsByPlugin) {\n const fixedIssues = [];\n for (const plugin of Object.keys(resultsByPlugin)) {\n for (const entity of resultsByPlugin[plugin].succeeded) {\n // count unique vulns fixed per scanned entity\n // some fixed may need to be made in multiple places\n // and would count multiple times otherwise.\n const fixedPerEntity = new Set();\n entity.changes\n .filter((c) => c.success)\n .forEach((c) => {\n c.issueIds.map((i) => fixedPerEntity.add(i));\n });\n fixedIssues.push(...Array.from(fixedPerEntity));\n }\n }\n return fixedIssues.length;\n}\nexports.calculateFixedIssues = calculateFixedIssues;\nfunction calculateFailed(resultsByPlugin, exceptions) {\n let failed = 0;\n for (const plugin of Object.keys(resultsByPlugin)) {\n const results = resultsByPlugin[plugin];\n failed += results.failed.length + results.skipped.length;\n }\n if (Object.keys(exceptions).length) {\n for (const ecosystem of Object.keys(exceptions)) {\n const unresolved = exceptions[ecosystem];\n failed += unresolved.originals.length;\n }\n }\n return failed;\n}\nexports.calculateFailed = calculateFailed;\nfunction formatIssueCountBySeverity({ critical, high, medium, low, }) {\n const summary = [];\n if (critical && critical > 0) {\n summary.push(exports.severitiesColourMapping.critical.colorFunc(`${critical} Critical`));\n }\n if (high && high > 0) {\n summary.push(exports.severitiesColourMapping.high.colorFunc(`${high} High`));\n }\n if (medium && medium > 0) {\n summary.push(exports.severitiesColourMapping.medium.colorFunc(`${medium} Medium`));\n }\n if (low && low > 0) {\n summary.push(exports.severitiesColourMapping.low.colorFunc(`${low} Low`));\n }\n return summary.join(' | ');\n}\nexports.formatIssueCountBySeverity = formatIssueCountBySeverity;\nexports.severitiesColourMapping = {\n low: {\n colorFunc(text) {\n return chalk.hex('#BCBBC8')(text);\n },\n },\n medium: {\n colorFunc(text) {\n return chalk.hex('#EDD55E')(text);\n },\n },\n high: {\n colorFunc(text) {\n return chalk.hex('#FF872F')(text);\n },\n },\n critical: {\n colorFunc(text) {\n return chalk.hex('#FF0B0B')(text);\n },\n },\n};\nexports.defaultSeverityColor = {\n colorFunc(text) {\n return chalk.grey(text);\n },\n};\nfunction getSeveritiesColour(severity) {\n var _a;\n return (_a = exports.severitiesColourMapping[severity]) !== null && _a !== void 0 ? _a : exports.defaultSeverityColor;\n}\nexports.getSeveritiesColour = getSeveritiesColour;\nfunction generateIssueSummary(resultsByPlugin, exceptions) {\n const testResults = getTestResults(resultsByPlugin, exceptions);\n const issueData = testResults.map((i) => i.issuesData);\n const bySeverity = issues_by_severity_1.getIssueCountBySeverity(issueData);\n const issuesBySeverityMessage = formatIssueCountBySeverity({\n critical: bySeverity.critical.length,\n high: bySeverity.high.length,\n medium: bySeverity.medium.length,\n low: bySeverity.low.length,\n });\n // can't use .flat() or .flatMap() because it's not supported in Node 10\n const issues = [];\n for (const result of testResults) {\n issues.push(...result.issues);\n }\n const totalIssueCount = total_issues_count_1.getTotalIssueCount(issueData);\n let totalIssues = '';\n if (totalIssueCount > 0) {\n totalIssues = `${chalk.bold(totalIssueCount)} issues\\n`;\n if (issuesBySeverityMessage) {\n totalIssues = `${chalk.bold(totalIssueCount)} issues: ${issuesBySeverityMessage}\\n`;\n }\n }\n const { count: fixableCount } = fixable_issues_1.hasFixableIssues(testResults);\n const fixableIssues = fixableCount > 0 ? `${chalk.bold(fixableCount)} issues are fixable\\n` : '';\n const fixedIssueCount = calculateFixedIssues(resultsByPlugin);\n const fixedIssuesSummary = fixedIssueCount > 0\n ? `${chalk.bold(fixedIssueCount)} issues were successfully fixed\\n`\n : '';\n return `\\n${exports.PADDING_SPACE}${totalIssues}${exports.PADDING_SPACE}${fixableIssues}${exports.PADDING_SPACE}${fixedIssuesSummary}`;\n}\nexports.generateIssueSummary = generateIssueSummary;\nfunction getTestResults(resultsByPlugin, exceptionsByScanType) {\n const testResults = [];\n for (const plugin of Object.keys(resultsByPlugin)) {\n const { skipped, failed, succeeded } = resultsByPlugin[plugin];\n testResults.push(...skipped.map((i) => i.original.testResult));\n testResults.push(...failed.map((i) => i.original.testResult));\n testResults.push(...succeeded.map((i) => i.original.testResult));\n }\n if (Object.keys(exceptionsByScanType).length) {\n for (const ecosystem of Object.keys(exceptionsByScanType)) {\n const unresolved = exceptionsByScanType[ecosystem];\n testResults.push(...unresolved.originals.map((i) => i.testResult));\n }\n }\n return testResults;\n}\nexports.getTestResults = getTestResults;\n//# sourceMappingURL=show-results-summary.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.partitionByVulnerable = void 0;\nfunction partitionByVulnerable(entities) {\n const vulnerable = [];\n const notVulnerable = [];\n for (const entity of entities) {\n const hasIssues = entity.testResult.issues.length > 0;\n if (hasIssues) {\n vulnerable.push(entity);\n }\n else {\n notVulnerable.push(entity);\n }\n }\n return { vulnerable, notVulnerable };\n}\nexports.partitionByVulnerable = partitionByVulnerable;\n//# sourceMappingURL=partition-by-vulnerable.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.loadPlugin = void 0;\nconst unsupported_type_error_1 = require(\"../lib/errors/unsupported-type-error\");\nconst python_1 = require(\"./python\");\nfunction loadPlugin(type) {\n switch (type) {\n case 'pip': {\n return python_1.pythonFix;\n }\n case 'poetry': {\n return python_1.pythonFix;\n }\n default: {\n throw new unsupported_type_error_1.UnsupportedTypeError(type);\n }\n }\n}\nexports.loadPlugin = loadPlugin;\n//# sourceMappingURL=load-plugin.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkPackageToolSupported = void 0;\nconst chalk = require(\"chalk\");\nconst pipenvPipfileFix = require(\"@snyk/fix-pipenv-pipfile\");\nconst poetryFix = require(\"@snyk/fix-poetry\");\nconst ora = require(\"ora\");\nconst supportFunc = {\n pipenv: {\n isInstalled: () => pipenvPipfileFix.isPipenvInstalled(),\n isSupportedVersion: (version) => pipenvPipfileFix.isPipenvSupportedVersion(version),\n },\n poetry: {\n isInstalled: () => poetryFix.isPoetryInstalled(),\n isSupportedVersion: (version) => poetryFix.isPoetrySupportedVersion(version),\n },\n};\nasync function checkPackageToolSupported(packageManager, options) {\n const { version } = await supportFunc[packageManager].isInstalled();\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n spinner.clear();\n spinner.text = `Checking ${packageManager} version`;\n spinner.indent = 2;\n spinner.start();\n if (!version) {\n spinner.stopAndPersist({\n text: chalk.hex('#EDD55E')(`Could not detect ${packageManager} version, proceeding anyway. Some operations may fail.`),\n symbol: chalk.hex('#EDD55E')('⚠️'),\n });\n return;\n }\n const { supported, versions } = supportFunc[packageManager].isSupportedVersion(version);\n if (!supported) {\n const spinnerMessage = ` ${version} ${packageManager} version detected. Currently the following ${packageManager} versions are supported: ${versions.join(',')}`;\n spinner.stopAndPersist({\n text: chalk.hex('#EDD55E')(spinnerMessage),\n symbol: chalk.hex('#EDD55E')('⚠️'),\n });\n }\n else {\n spinner.stop();\n }\n}\nexports.checkPackageToolSupported = checkPackageToolSupported;\n//# sourceMappingURL=package-tool-supported.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isRequirementsTxtManifest = exports.getHandlerType = void 0;\nconst pathLib = require(\"path\");\nconst supported_handler_types_1 = require(\"./supported-handler-types\");\nfunction getHandlerType(entity) {\n const targetFile = entity.scanResult.identity.targetFile;\n if (!targetFile) {\n return null;\n }\n const path = pathLib.parse(targetFile);\n if (isRequirementsTxtManifest(targetFile)) {\n return supported_handler_types_1.SUPPORTED_HANDLER_TYPES.REQUIREMENTS;\n }\n else if (['Pipfile'].includes(path.base)) {\n return supported_handler_types_1.SUPPORTED_HANDLER_TYPES.PIPFILE;\n }\n else if (['pyproject.toml', 'poetry.lock'].includes(path.base)) {\n return supported_handler_types_1.SUPPORTED_HANDLER_TYPES.POETRY;\n }\n return null;\n}\nexports.getHandlerType = getHandlerType;\nfunction isRequirementsTxtManifest(targetFile) {\n return targetFile.endsWith('.txt');\n}\nexports.isRequirementsTxtManifest = isRequirementsTxtManifest;\n//# sourceMappingURL=get-handler-type.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSuccessfulChange = exports.generateSuccessfulChanges = exports.generateFailedChanges = void 0;\nfunction generateFailedChanges(attemptedUpdates, pins, error, command) {\n const changes = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n if (!attemptedUpdates\n .map((update) => update.replace('==', '@'))\n .includes(pin.upgradeTo)) {\n continue;\n }\n const updatedMessage = pin.isTransitive ? 'pin' : 'upgrade';\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName, version] = pkgAtVersion.split('@');\n changes.push({\n success: false,\n reason: error.message,\n userMessage: `Failed to ${updatedMessage} ${pkgName} from ${version} to ${newVersion}`,\n tip: command ? `Try running \\`${command}\\`` : undefined,\n issueIds: pin.vulns,\n from: pkgAtVersion,\n to: `${pkgName}@${newVersion}`,\n });\n }\n return changes;\n}\nexports.generateFailedChanges = generateFailedChanges;\nfunction generateSuccessfulChanges(appliedUpgrades, pins) {\n const changes = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n if (!appliedUpgrades\n .map((upgrade) => upgrade.replace('==', '@'))\n .includes(pin.upgradeTo)) {\n continue;\n }\n const updatedMessage = pin.isTransitive ? 'Pinned' : 'Upgraded';\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName, version] = pkgAtVersion.split('@');\n changes.push({\n success: true,\n userMessage: `${updatedMessage} ${pkgName} from ${version} to ${newVersion}`,\n issueIds: pin.vulns,\n from: pkgAtVersion,\n to: `${pkgName}@${newVersion}`,\n });\n }\n return changes;\n}\nexports.generateSuccessfulChanges = generateSuccessfulChanges;\nfunction isSuccessfulChange(change) {\n return change.success === true;\n}\nexports.isSuccessfulChange = isSuccessfulChange;\n//# sourceMappingURL=attempted-changes-summary.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.failIfNoUpdatesApplied = void 0;\nconst debugLib = require(\"debug\");\nconst no_fixes_applied_1 = require(\"../../../lib/errors/no-fixes-applied\");\nconst attempted_changes_summary_1 = require(\"./attempted-changes-summary\");\nconst debug = debugLib('snyk-fix:python:ensure-changes-applied');\nfunction failIfNoUpdatesApplied(changes) {\n if (!changes.length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n }\n if (!changes.some((c) => attempted_changes_summary_1.isSuccessfulChange(c))) {\n debug('Manifest has not changed as no changes got applied!');\n // throw the first error tip since 100% failed, they all failed with the same\n // error\n const { reason, tip } = changes[0];\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError(reason, tip);\n }\n}\nexports.failIfNoUpdatesApplied = failIfNoUpdatesApplied;\n//# sourceMappingURL=fail-if-no-updates-applied.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.partitionByFixable = exports.isSupported = exports.projectTypeSupported = void 0;\nfunction projectTypeSupported(res) {\n return !('reason' in res);\n}\nexports.projectTypeSupported = projectTypeSupported;\nasync function isSupported(entity) {\n const remediationData = entity.testResult.remediation;\n if (!remediationData) {\n return { supported: false, reason: 'No remediation data available' };\n }\n if (!remediationData.pin || Object.keys(remediationData.pin).length === 0) {\n return {\n supported: false,\n reason: 'There is no actionable remediation to apply',\n };\n }\n return { supported: true };\n}\nexports.isSupported = isSupported;\nasync function partitionByFixable(entities) {\n const fixable = [];\n const skipped = [];\n for (const entity of entities) {\n const isSupportedResponse = await isSupported(entity);\n if (projectTypeSupported(isSupportedResponse)) {\n fixable.push(entity);\n continue;\n }\n skipped.push({\n original: entity,\n userMessage: isSupportedResponse.reason,\n });\n }\n return { fixable, skipped };\n}\nexports.partitionByFixable = partitionByFixable;\n//# sourceMappingURL=is-supported.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.containsRequireDirective = void 0;\n/* Requires like -r, -c are not supported at the moment, as multiple files\n * would have to be identified and fixed together\n * https://pip.pypa.io/en/stable/reference/pip_install/#options\n */\nasync function containsRequireDirective(requirementsTxt) {\n const allMatches = [];\n const REQUIRE_PATTERN = new RegExp(/^[^\\S\\n]*-(r|c)\\s+(.+)/, 'gm');\n const matches = getAllMatchedGroups(REQUIRE_PATTERN, requirementsTxt);\n for (const match of matches) {\n if (match && match.length > 1) {\n allMatches.push(match);\n }\n }\n return { containsRequire: allMatches.length > 0, matches: allMatches };\n}\nexports.containsRequireDirective = containsRequireDirective;\nfunction getAllMatchedGroups(re, str) {\n const groups = [];\n let match;\n while ((match = re.exec(str))) {\n groups.push(match);\n }\n return groups;\n}\n//# sourceMappingURL=contains-require-directive.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.extractProvenance = void 0;\nconst path = require(\"path\");\nconst debugLib = require(\"debug\");\nconst requirements_file_parser_1 = require(\"./update-dependencies/requirements-file-parser\");\nconst contains_require_directive_1 = require(\"./contains-require-directive\");\nconst debug = debugLib('snyk-fix:python:extract-version-provenance');\nasync function extractProvenance(workspace, rootDir, dir, fileName, provenance = {}) {\n const requirementsFileName = path.join(dir, fileName);\n const requirementsTxt = await workspace.readFile(requirementsFileName);\n // keep all provenance paths with `/` as a separator\n const relativeTargetFileName = path\n .normalize(path.relative(rootDir, requirementsFileName))\n .replace(path.sep, '/');\n provenance = {\n ...provenance,\n [relativeTargetFileName]: requirements_file_parser_1.parseRequirementsFile(requirementsTxt),\n };\n const { containsRequire, matches } = await contains_require_directive_1.containsRequireDirective(requirementsTxt);\n if (containsRequire) {\n for (const match of matches) {\n const requiredFilePath = match[2];\n if (provenance[requiredFilePath]) {\n debug('Detected recursive require directive, skipping');\n continue;\n }\n const { dir: requireDir, base } = path.parse(path.join(dir, requiredFilePath));\n provenance = {\n ...provenance,\n ...(await extractProvenance(workspace, rootDir, requireDir, base, provenance)),\n };\n }\n }\n return provenance;\n}\nexports.extractProvenance = extractProvenance;\n//# sourceMappingURL=extract-version-provenance.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.selectFileForPinning = exports.applyAllFixes = exports.fixIndividualRequirementsTxt = exports.pipRequirementsTxt = void 0;\nconst debugLib = require(\"debug\");\nconst pathLib = require(\"path\");\nconst sortBy = require('lodash.sortby');\nconst groupBy = require('lodash.groupby');\nconst update_dependencies_1 = require(\"./update-dependencies\");\nconst no_fixes_applied_1 = require(\"../../../../lib/errors/no-fixes-applied\");\nconst extract_version_provenance_1 = require(\"./extract-version-provenance\");\nconst requirements_file_parser_1 = require(\"./update-dependencies/requirements-file-parser\");\nconst standardize_package_name_1 = require(\"../../standardize-package-name\");\nconst contains_require_directive_1 = require(\"./contains-require-directive\");\nconst validate_required_data_1 = require(\"../validate-required-data\");\nconst format_display_name_1 = require(\"../../../../lib/output-formatters/format-display-name\");\nconst debug = debugLib('snyk-fix:python:requirements.txt');\nasync function pipRequirementsTxt(fixable, options) {\n debug(`Preparing to fix ${fixable.length} Python requirements.txt projects`);\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const ordered = sortByDirectory(fixable);\n let fixedFilesCache = {};\n for (const dir of Object.keys(ordered)) {\n debug(`Fixing entities in directory ${dir}`);\n const entitiesPerDirectory = ordered[dir].map((e) => e.entity);\n const { failed, succeeded, skipped, fixedCache } = await fixAll(entitiesPerDirectory, options, fixedFilesCache);\n fixedFilesCache = {\n ...fixedFilesCache,\n ...fixedCache,\n };\n handlerResult.succeeded.push(...succeeded);\n handlerResult.failed.push(...failed);\n handlerResult.skipped.push(...skipped);\n }\n return handlerResult;\n}\nexports.pipRequirementsTxt = pipRequirementsTxt;\nasync function fixAll(entities, options, fixedCache) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n for (const entity of entities) {\n const targetFile = entity.scanResult.identity.targetFile;\n try {\n const { dir, base } = pathLib.parse(targetFile);\n // parse & join again to support correct separator\n const filePath = pathLib.normalize(pathLib.join(dir, base));\n if (Object.keys(fixedCache).includes(pathLib.normalize(pathLib.join(dir, base)))) {\n handlerResult.succeeded.push({\n original: entity,\n changes: [\n {\n success: true,\n userMessage: `Fixed through ${format_display_name_1.formatDisplayName(entity.workspace.path, {\n type: entity.scanResult.identity.type,\n targetFile: fixedCache[filePath].fixedIn,\n })}`,\n issueIds: getFixedEntityIssues(fixedCache[filePath].issueIds, entity.testResult.issues),\n },\n ],\n });\n continue;\n }\n const { changes, fixedMeta } = await applyAllFixes(entity, options);\n if (!changes.length) {\n debug('Manifest has not changed!');\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n }\n // keep issues were successfully fixed unique across files that are part of the same project\n // the test result is for 1 entry entity.\n const uniqueIssueIds = new Set();\n for (const c of changes) {\n c.issueIds.map((i) => uniqueIssueIds.add(i));\n }\n Object.keys(fixedMeta).forEach((f) => {\n fixedCache[f] = {\n fixedIn: targetFile,\n issueIds: Array.from(uniqueIssueIds),\n };\n });\n handlerResult.succeeded.push({ original: entity, changes });\n }\n catch (e) {\n debug(`Failed to fix ${targetFile}.\\nERROR: ${e}`);\n handlerResult.failed.push({ original: entity, error: e });\n }\n }\n return { ...handlerResult, fixedCache };\n}\n// TODO: optionally verify the deps install\nasync function fixIndividualRequirementsTxt(workspace, dir, entryFileName, fileName, remediation, parsedRequirements, options, directUpgradesOnly) {\n const entryFilePath = pathLib.normalize(pathLib.join(dir, entryFileName));\n const fullFilePath = pathLib.normalize(pathLib.join(dir, fileName));\n const { updatedManifest, changes } = update_dependencies_1.updateDependencies(parsedRequirements, remediation.pin, directUpgradesOnly, entryFilePath !== fullFilePath\n ? format_display_name_1.formatDisplayName(workspace.path, {\n type: 'pip',\n targetFile: fullFilePath,\n })\n : undefined);\n if (!changes.length) {\n return { changes };\n }\n if (!options.dryRun) {\n debug('Writing changes to file');\n await workspace.writeFile(pathLib.join(dir, fileName), updatedManifest);\n }\n else {\n debug('Skipping writing changes to file in --dry-run mode');\n }\n return { changes };\n}\nexports.fixIndividualRequirementsTxt = fixIndividualRequirementsTxt;\nasync function applyAllFixes(entity, options) {\n const { remediation, targetFile: entryFileName, workspace, } = validate_required_data_1.validateRequiredData(entity);\n const fixedMeta = {};\n const { dir, base } = pathLib.parse(entryFileName);\n const provenance = await extract_version_provenance_1.extractProvenance(workspace, dir, dir, base);\n const upgradeChanges = [];\n /* Apply all upgrades first across all files that are included */\n for (const fileName of Object.keys(provenance)) {\n const skipApplyingPins = true;\n const { changes } = await fixIndividualRequirementsTxt(workspace, dir, base, fileName, remediation, provenance[fileName], options, skipApplyingPins);\n upgradeChanges.push(...changes);\n fixedMeta[pathLib.normalize(pathLib.join(dir, fileName))] = upgradeChanges;\n }\n /* Apply all left over remediation as pins in the entry targetFile */\n const toPin = filterOutAppliedUpgrades(remediation, upgradeChanges);\n const directUpgradesOnly = false;\n const fileForPinning = await selectFileForPinning(entity);\n const { changes: pinnedChanges } = await fixIndividualRequirementsTxt(workspace, dir, base, fileForPinning.fileName, toPin, requirements_file_parser_1.parseRequirementsFile(fileForPinning.fileContent), options, directUpgradesOnly);\n return { changes: [...upgradeChanges, ...pinnedChanges], fixedMeta };\n}\nexports.applyAllFixes = applyAllFixes;\nfunction filterOutAppliedUpgrades(remediation, upgradeChanges) {\n const pinRemediation = {\n ...remediation,\n pin: {},\n };\n const pins = remediation.pin;\n const normalizedAppliedRemediation = upgradeChanges\n .map((c) => {\n var _a;\n if (c.success && c.from) {\n const [pkgName, versionAndMore] = (_a = c.from) === null || _a === void 0 ? void 0 : _a.split('@');\n return `${standardize_package_name_1.standardizePackageName(pkgName)}@${versionAndMore}`;\n }\n return false;\n })\n .filter(Boolean);\n for (const pkgAtVersion of Object.keys(pins)) {\n const [pkgName, versionAndMore] = pkgAtVersion.split('@');\n if (!normalizedAppliedRemediation.includes(`${standardize_package_name_1.standardizePackageName(pkgName)}@${versionAndMore}`)) {\n pinRemediation.pin[pkgAtVersion] = pins[pkgAtVersion];\n }\n }\n return pinRemediation;\n}\nfunction sortByDirectory(entities) {\n const mapped = entities.map((e) => ({\n entity: e,\n ...pathLib.parse(e.scanResult.identity.targetFile),\n }));\n const sorted = sortBy(mapped, 'dir');\n return groupBy(sorted, 'dir');\n}\nasync function selectFileForPinning(entity) {\n const targetFile = entity.scanResult.identity.targetFile;\n const { dir, base } = pathLib.parse(targetFile);\n const { workspace } = entity;\n // default to adding pins in the scanned file\n let fileName = base;\n let requirementsTxt = await workspace.readFile(targetFile);\n const { containsRequire, matches } = await contains_require_directive_1.containsRequireDirective(requirementsTxt);\n const constraintsMatch = matches.filter((m) => m.includes('c'));\n if (containsRequire && constraintsMatch[0]) {\n // prefer to pin in constraints file if present\n fileName = constraintsMatch[0][2];\n requirementsTxt = await workspace.readFile(pathLib.join(dir, fileName));\n }\n return { fileContent: requirementsTxt, fileName };\n}\nexports.selectFileForPinning = selectFileForPinning;\nfunction getFixedEntityIssues(fixedIssueIds, issues) {\n const fixed = [];\n for (const { issueId } of issues) {\n if (fixedIssueIds.includes(issueId)) {\n fixed.push(issueId);\n }\n }\n return fixed;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.applyUpgrades = void 0;\nfunction applyUpgrades(originalRequirements, upgradedRequirements) {\n const updated = [];\n for (const requirement of originalRequirements) {\n const { originalText } = requirement;\n if (upgradedRequirements[originalText]) {\n updated.push(upgradedRequirements[originalText]);\n }\n else {\n updated.push(originalText);\n }\n }\n return updated;\n}\nexports.applyUpgrades = applyUpgrades;\n//# sourceMappingURL=apply-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.calculateRelevantFixes = void 0;\nconst is_defined_1 = require(\"./is-defined\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nfunction calculateRelevantFixes(requirements, updates, type) {\n const lowerCasedUpdates = {};\n const topLevelDeps = requirements.map(({ name }) => name).filter(is_defined_1.isDefined);\n Object.keys(updates).forEach((update) => {\n const { upgradeTo } = updates[update];\n const [pkgName] = update.split('@');\n const isTransitive = topLevelDeps.indexOf(standardize_package_name_1.standardizePackageName(pkgName)) < 0;\n if (type === 'transitive-pins' ? isTransitive : !isTransitive) {\n const [name, newVersion] = upgradeTo.split('@');\n lowerCasedUpdates[update] = {\n ...updates[update],\n upgradeTo: `${standardize_package_name_1.standardizePackageName(name)}@${newVersion}`,\n };\n }\n });\n return lowerCasedUpdates;\n}\nexports.calculateRelevantFixes = calculateRelevantFixes;\n//# sourceMappingURL=calculate-relevant-fixes.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generatePins = void 0;\nconst calculate_relevant_fixes_1 = require(\"./calculate-relevant-fixes\");\nconst is_defined_1 = require(\"./is-defined\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nfunction generatePins(requirements, updates, referenceFileInChanges) {\n // Lowercase the upgrades object. This might be overly defensive, given that\n // we control this input internally, but its a low cost guard rail. Outputs a\n // mapping of upgrade to -> from, instead of the nested upgradeTo object.\n const standardizedPins = calculate_relevant_fixes_1.calculateRelevantFixes(requirements, updates, 'transitive-pins');\n if (Object.keys(standardizedPins).length === 0) {\n return {\n pinnedRequirements: [],\n changes: [],\n };\n }\n const changes = [];\n const pinnedRequirements = Object.keys(standardizedPins)\n .map((pkgNameAtVersion) => {\n const [pkgName, version] = pkgNameAtVersion.split('@');\n const newVersion = standardizedPins[pkgNameAtVersion].upgradeTo.split('@')[1];\n const newRequirement = `${standardize_package_name_1.standardizePackageName(pkgName)}>=${newVersion}`;\n changes.push({\n from: `${pkgName}@${version}`,\n to: `${pkgName}@${newVersion}`,\n issueIds: standardizedPins[pkgNameAtVersion].vulns,\n success: true,\n userMessage: `Pinned ${standardize_package_name_1.standardizePackageName(pkgName)} from ${version} to ${newVersion}${referenceFileInChanges ? ` (pinned in ${referenceFileInChanges})` : ''}`,\n });\n return `${newRequirement} # not directly required, pinned by Snyk to avoid a vulnerability`;\n })\n .filter(is_defined_1.isDefined);\n return {\n pinnedRequirements,\n changes,\n };\n}\nexports.generatePins = generatePins;\n//# sourceMappingURL=generate-pins.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateUpgrades = void 0;\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst calculate_relevant_fixes_1 = require(\"./calculate-relevant-fixes\");\nfunction generateUpgrades(requirements, updates, referenceFileInChanges) {\n // Lowercase the upgrades object. This might be overly defensive, given that\n // we control this input internally, but its a low cost guard rail. Outputs a\n // mapping of upgrade to -> from, instead of the nested upgradeTo object.\n const normalizedUpgrades = calculate_relevant_fixes_1.calculateRelevantFixes(requirements, updates, 'direct-upgrades');\n if (Object.keys(normalizedUpgrades).length === 0) {\n return {\n updatedRequirements: {},\n changes: [],\n };\n }\n const changes = [];\n const updatedRequirements = {};\n requirements.map(({ name, originalName, versionComparator, version, originalText, extras, }) => {\n // Defensive patching; if any of these are undefined, return\n if (typeof name === 'undefined' ||\n typeof versionComparator === 'undefined' ||\n typeof version === 'undefined' ||\n originalText === '') {\n return;\n }\n // Check if we have an upgrade; if we do, replace the version string with\n // the upgrade, but keep the rest of the content\n const upgrade = Object.keys(normalizedUpgrades).filter((packageVersionUpgrade) => {\n const [pkgName, versionAndMore] = packageVersionUpgrade.split('@');\n return `${standardize_package_name_1.standardizePackageName(pkgName)}@${versionAndMore}`.startsWith(`${standardize_package_name_1.standardizePackageName(name)}@${version}`);\n })[0];\n if (!upgrade) {\n return;\n }\n const newVersion = normalizedUpgrades[upgrade].upgradeTo.split('@')[1];\n const updatedRequirement = `${originalName}${versionComparator}${newVersion}`;\n changes.push({\n issueIds: normalizedUpgrades[upgrade].vulns,\n from: `${originalName}@${version}`,\n to: `${originalName}@${newVersion}`,\n success: true,\n userMessage: `Upgraded ${originalName} from ${version} to ${newVersion}${referenceFileInChanges\n ? ` (upgraded in ${referenceFileInChanges})`\n : ''}`,\n });\n updatedRequirements[originalText] = `${updatedRequirement}${extras ? extras : ''}`;\n });\n return {\n updatedRequirements,\n changes,\n };\n}\nexports.generateUpgrades = generateUpgrades;\n//# sourceMappingURL=generate-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateDependencies = void 0;\nconst debugLib = require(\"debug\");\nconst generate_pins_1 = require(\"./generate-pins\");\nconst apply_upgrades_1 = require(\"./apply-upgrades\");\nconst generate_upgrades_1 = require(\"./generate-upgrades\");\nconst failed_to_parse_manifest_1 = require(\"../../../../../lib/errors/failed-to-parse-manifest\");\nconst debug = debugLib('snyk-fix:python:update-dependencies');\n/*\n * Given contents of manifest file(s) and a set of upgrades, apply the given\n * upgrades to a manifest and return the upgraded manifest.\n *\n * Currently only supported for `requirements.txt` - at least one file named\n * `requirements.txt` must be in the manifests.\n */\nfunction updateDependencies(parsedRequirementsData, updates, directUpgradesOnly = false, referenceFileInChanges) {\n const { requirements, endsWithNewLine: shouldEndWithNewLine, } = parsedRequirementsData;\n if (!requirements.length) {\n debug('Error: Expected to receive parsed manifest data. Is manifest empty?');\n throw new failed_to_parse_manifest_1.FailedToParseManifest();\n }\n debug('Finished parsing manifest');\n const { updatedRequirements, changes: upgradedChanges } = generate_upgrades_1.generateUpgrades(requirements, updates, referenceFileInChanges);\n debug('Finished generating upgrades to apply');\n let pinnedRequirements = [];\n let pinChanges = [];\n if (!directUpgradesOnly) {\n ({ pinnedRequirements, changes: pinChanges } = generate_pins_1.generatePins(requirements, updates, referenceFileInChanges));\n debug('Finished generating pins to apply');\n }\n let updatedManifest = [\n ...apply_upgrades_1.applyUpgrades(requirements, updatedRequirements),\n ...pinnedRequirements,\n ].join('\\n');\n // This is a bit of a hack, but an easy one to follow. If a file ends with a\n // new line, ensure we keep it this way. Don't hijack customers formatting.\n if (shouldEndWithNewLine) {\n updatedManifest += '\\n';\n }\n debug('Finished applying changes to manifest');\n return {\n updatedManifest,\n changes: [...pinChanges, ...upgradedChanges],\n };\n}\nexports.updateDependencies = updateDependencies;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isDefined = void 0;\n// TS is not capable of determining when Array.filter has removed undefined\n// values without a manual Type Guard, so thats what this does\nfunction isDefined(t) {\n return typeof t !== 'undefined';\n}\nexports.isDefined = isDefined;\n//# sourceMappingURL=is-defined.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseRequirementsFile = void 0;\nconst debugLib = require(\"debug\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst debug = debugLib('snyk-fix:python:requirements-file-parser');\nfunction parseRequirementsFile(requirementsFile) {\n const endsWithNewLine = requirementsFile.endsWith('\\n');\n const lines = requirementsFile.replace(/\\n$/, '').split('\\n');\n const requirements = [];\n lines.map((requirementText, line) => {\n const requirement = extractDependencyDataFromLine(requirementText, line);\n if (requirement) {\n requirements.push(requirement);\n }\n });\n return { requirements, endsWithNewLine };\n}\nexports.parseRequirementsFile = parseRequirementsFile;\nfunction extractDependencyDataFromLine(requirementText, line) {\n try {\n const requirement = { originalText: requirementText, line };\n const trimmedText = requirementText.trim();\n // Quick returns for cases we cannot remediate\n // - Empty line i.e. ''\n // - 'editable' packages i.e. '-e git://git.myproject.org/MyProject.git#egg=MyProject'\n // - Comments i.e. # This is a comment\n // - Local files i.e. file:../../lib/project#egg=MyProject\n if (requirementText === '' ||\n trimmedText.startsWith('-e') ||\n trimmedText.startsWith('#') ||\n trimmedText.startsWith('file:')) {\n return requirement;\n }\n // Regex to match against a Python package specifier. Any invalid lines (or\n // lines we can't handle) should have been returned this point.\n const regex = /([A-Z0-9-._]*)(!=|===|==|>=|<=|>|<|~=)(\\d*\\.?\\d*\\.?\\d*[A-Z0-9]*)(.*)/i;\n const result = regex.exec(requirementText);\n if (result !== null) {\n requirement.name = standardize_package_name_1.standardizePackageName(result[1]);\n requirement.originalName = result[1];\n requirement.versionComparator = result[2];\n requirement.version = result[3];\n requirement.extras = result[4];\n }\n if (!(requirement.version && requirement.name)) {\n throw new Error('Failed to extract dependency data');\n }\n return requirement;\n }\n catch (err) {\n debug({ error: err.message, requirementText, line }, 'failed to parse requirement');\n return { originalText: requirementText, line };\n }\n}\n//# sourceMappingURL=requirements-file-parser.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pipenvPipfile = void 0;\nconst debugLib = require(\"debug\");\nconst ora = require(\"ora\");\nconst package_tool_supported_1 = require(\"../../../package-tool-supported\");\nconst update_dependencies_1 = require(\"./update-dependencies\");\nconst debug = debugLib('snyk-fix:python:Pipfile');\nasync function pipenvPipfile(fixable, options) {\n debug(`Preparing to fix ${fixable.length} Python Pipfile projects`);\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n await package_tool_supported_1.checkPackageToolSupported('pipenv', options);\n for (const [index, entity] of fixable.entries()) {\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n const spinnerMessage = `Fixing Pipfile ${index + 1}/${fixable.length}`;\n spinner.text = spinnerMessage;\n spinner.start();\n const { failed, succeeded, skipped } = await update_dependencies_1.updateDependencies(entity, options);\n handlerResult.succeeded.push(...succeeded);\n handlerResult.failed.push(...failed);\n handlerResult.skipped.push(...skipped);\n spinner.stop();\n }\n return handlerResult;\n}\nexports.pipenvPipfile = pipenvPipfile;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateUpgrades = void 0;\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nfunction generateUpgrades(entity) {\n const { remediation } = validate_required_data_1.validateRequiredData(entity);\n const { pin: pins } = remediation;\n const upgrades = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName] = pkgAtVersion.split('@');\n upgrades.push(`${standardize_package_name_1.standardizePackageName(pkgName)}==${newVersion}`);\n }\n return { upgrades };\n}\nexports.generateUpgrades = generateUpgrades;\n//# sourceMappingURL=generate-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateDependencies = void 0;\nconst debugLib = require(\"debug\");\nconst fail_if_no_updates_applied_1 = require(\"../../fail-if-no-updates-applied\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nconst generate_upgrades_1 = require(\"./generate-upgrades\");\nconst pipenv_add_1 = require(\"./pipenv-add\");\nconst debug = debugLib('snyk-fix:python:Pipfile');\nfunction chooseFixStrategy(options) {\n return options.sequentialFix ? fixSequentially : fixAll;\n}\nasync function updateDependencies(entity, options) {\n const handlerResult = await chooseFixStrategy(options)(entity, options);\n return handlerResult;\n}\nexports.updateDependencies = updateDependencies;\nasync function fixAll(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const changes = [];\n try {\n const { upgrades } = await generate_upgrades_1.generateUpgrades(entity);\n if (!upgrades.length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n // Currently this is not possible as there is no Pipfile parser that would do this.\n // update prod dependencies first\n if (upgrades.length) {\n changes.push(...(await pipenv_add_1.pipenvAdd(entity, options, upgrades)));\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n error,\n tip: error.tip,\n });\n }\n return handlerResult;\n}\nasync function fixSequentially(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const { upgrades } = await generate_upgrades_1.generateUpgrades(entity);\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n // at the moment we do not parse Pipfile and therefore can't tell the difference\n // between prod & dev updates\n const changes = [];\n try {\n if (!upgrades.length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // update prod dependencies first\n if (upgrades.length) {\n for (const upgrade of upgrades) {\n changes.push(...(await pipenv_add_1.pipenvAdd(entity, options, [upgrade])));\n }\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n tip: error.tip,\n error,\n });\n }\n return handlerResult;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pipenvAdd = void 0;\nconst pathLib = require(\"path\");\nconst pipenvPipfileFix = require(\"@snyk/fix-pipenv-pipfile\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nconst attempted_changes_summary_1 = require(\"../../attempted-changes-summary\");\nconst command_failed_to_run_error_1 = require(\"../../../../../lib/errors/command-failed-to-run-error\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nasync function pipenvAdd(entity, options, upgrades) {\n const changes = [];\n let pipenvCommand;\n const { remediation, targetFile } = validate_required_data_1.validateRequiredData(entity);\n try {\n const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);\n const { dir } = pathLib.parse(targetFilePath);\n if (!options.dryRun && upgrades.length) {\n const res = await pipenvPipfileFix.pipenvInstall(dir, upgrades, {\n python: entity.options.command,\n });\n if (res.exitCode !== 0) {\n pipenvCommand = res.command;\n throwPipenvError(res.stderr ? res.stderr : res.stdout, res.command);\n }\n }\n changes.push(...attempted_changes_summary_1.generateSuccessfulChanges(upgrades, remediation.pin));\n }\n catch (error) {\n changes.push(...attempted_changes_summary_1.generateFailedChanges(upgrades, remediation.pin, error, pipenvCommand));\n }\n return changes;\n}\nexports.pipenvAdd = pipenvAdd;\nfunction throwPipenvError(stderr, command) {\n const errorStr = stderr.toLowerCase();\n const incompatibleDeps = 'There are incompatible versions in the resolved dependencies';\n const lockingFailed = 'Locking failed';\n const versionNotFound = 'Could not find a version that matches';\n const errorsToBubbleUp = [incompatibleDeps, lockingFailed, versionNotFound];\n for (const error of errorsToBubbleUp) {\n if (errorStr.includes(error.toLowerCase())) {\n throw new command_failed_to_run_error_1.CommandFailedError(error, command);\n }\n }\n const SOLVER_PROBLEM = /SolverProblemError(.* version solving failed)/gms;\n const solverProblemError = SOLVER_PROBLEM.exec(stderr);\n if (solverProblemError) {\n throw new command_failed_to_run_error_1.CommandFailedError(solverProblemError[0].trim(), command);\n }\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n}\n//# sourceMappingURL=pipenv-add.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.poetry = void 0;\nconst debugLib = require(\"debug\");\nconst ora = require(\"ora\");\nconst package_tool_supported_1 = require(\"../../../package-tool-supported\");\nconst update_dependencies_1 = require(\"./update-dependencies\");\nconst debug = debugLib('snyk-fix:python:Poetry');\nasync function poetry(fixable, options) {\n debug(`Preparing to fix ${fixable.length} Python Poetry projects`);\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n await package_tool_supported_1.checkPackageToolSupported('poetry', options);\n for (const [index, entity] of fixable.entries()) {\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n const spinnerMessage = `Fixing pyproject.toml ${index + 1}/${fixable.length}`;\n spinner.text = spinnerMessage;\n spinner.start();\n const { failed, succeeded, skipped } = await update_dependencies_1.updateDependencies(entity, options);\n handlerResult.succeeded.push(...succeeded);\n handlerResult.failed.push(...failed);\n handlerResult.skipped.push(...skipped);\n spinner.stop();\n }\n return handlerResult;\n}\nexports.poetry = poetry;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateUpgrades = void 0;\nconst pathLib = require(\"path\");\nconst toml = require(\"toml\");\nconst debugLib = require(\"debug\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst debug = debugLib('snyk-fix:python:Poetry');\nasync function generateUpgrades(entity) {\n var _a, _b;\n const { remediation, targetFile } = validate_required_data_1.validateRequiredData(entity);\n const pins = remediation.pin;\n const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);\n const { dir } = pathLib.parse(targetFilePath);\n const pyProjectTomlRaw = await entity.workspace.readFile(pathLib.resolve(dir, 'pyproject.toml'));\n const pyProjectToml = toml.parse(pyProjectTomlRaw);\n const prodTopLevelDeps = Object.keys((_a = pyProjectToml.tool.poetry.dependencies) !== null && _a !== void 0 ? _a : {}).map((dep) => standardize_package_name_1.standardizePackageName(dep));\n const devTopLevelDeps = Object.keys((_b = pyProjectToml.tool.poetry['dev-dependencies']) !== null && _b !== void 0 ? _b : {}).map((dep) => standardize_package_name_1.standardizePackageName(dep));\n const upgrades = [];\n const devUpgrades = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName] = pkgAtVersion.split('@');\n const upgrade = `${standardize_package_name_1.standardizePackageName(pkgName)}==${newVersion}`;\n if (pin.isTransitive || prodTopLevelDeps.includes(pkgName)) {\n // transitive and it could have come from a dev or prod dep\n // since we can't tell right now let be pinned into production deps\n upgrades.push(upgrade);\n }\n else if (prodTopLevelDeps.includes(pkgName)) {\n upgrades.push(upgrade);\n }\n else if (entity.options.dev && devTopLevelDeps.includes(pkgName)) {\n devUpgrades.push(upgrade);\n }\n else {\n debug(`Could not determine what type of upgrade ${upgrade} is. When choosing between: transitive upgrade, production or dev direct upgrade. `);\n }\n }\n return { upgrades, devUpgrades };\n}\nexports.generateUpgrades = generateUpgrades;\n//# sourceMappingURL=generate-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateDependencies = void 0;\nconst debugLib = require(\"debug\");\nconst generate_upgrades_1 = require(\"./generate-upgrades\");\nconst poetry_add_1 = require(\"./poetry-add\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nconst fail_if_no_updates_applied_1 = require(\"../../fail-if-no-updates-applied\");\nconst debug = debugLib('snyk-fix:python:Poetry');\nfunction chooseFixStrategy(options) {\n return options.sequentialFix ? fixSequentially : fixAll;\n}\nasync function updateDependencies(entity, options) {\n const handlerResult = await chooseFixStrategy(options)(entity, options);\n return handlerResult;\n}\nexports.updateDependencies = updateDependencies;\nasync function fixAll(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const { upgrades, devUpgrades } = await generate_upgrades_1.generateUpgrades(entity);\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n const changes = [];\n try {\n if (![...upgrades, ...devUpgrades].length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // update prod dependencies first\n if (upgrades.length) {\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, upgrades)));\n }\n // update dev dependencies second\n if (devUpgrades.length) {\n const installDev = true;\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, devUpgrades, installDev)));\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n tip: error.tip,\n error,\n });\n }\n return handlerResult;\n}\nasync function fixSequentially(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const { upgrades, devUpgrades } = await generate_upgrades_1.generateUpgrades(entity);\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n const changes = [];\n try {\n if (![...upgrades, ...devUpgrades].length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // update prod dependencies first\n if (upgrades.length) {\n for (const upgrade of upgrades) {\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, [upgrade])));\n }\n }\n // update dev dependencies second\n if (devUpgrades.length) {\n for (const upgrade of devUpgrades) {\n const installDev = true;\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, [upgrade], installDev)));\n }\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n tip: error.tip,\n error,\n });\n }\n return handlerResult;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.poetryAdd = void 0;\nconst pathLib = require(\"path\");\nconst poetryFix = require(\"@snyk/fix-poetry\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nconst attempted_changes_summary_1 = require(\"../../attempted-changes-summary\");\nconst command_failed_to_run_error_1 = require(\"../../../../../lib/errors/command-failed-to-run-error\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nasync function poetryAdd(entity, options, upgrades, dev) {\n var _a;\n const changes = [];\n let poetryCommand;\n const { remediation, targetFile } = validate_required_data_1.validateRequiredData(entity);\n try {\n const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);\n const { dir } = pathLib.parse(targetFilePath);\n if (!options.dryRun && upgrades.length) {\n const res = await poetryFix.poetryAdd(dir, upgrades, {\n dev,\n python: (_a = entity.options.command) !== null && _a !== void 0 ? _a : undefined,\n });\n if (res.exitCode !== 0) {\n poetryCommand = res.command;\n throwPoetryError(res.stderr ? res.stderr : res.stdout, res.command);\n }\n }\n changes.push(...attempted_changes_summary_1.generateSuccessfulChanges(upgrades, remediation.pin));\n }\n catch (error) {\n changes.push(...attempted_changes_summary_1.generateFailedChanges(upgrades, remediation.pin, error, poetryCommand));\n }\n return changes;\n}\nexports.poetryAdd = poetryAdd;\nfunction throwPoetryError(stderr, command) {\n const ALREADY_UP_TO_DATE = 'No dependencies to install or update';\n const INCOMPATIBLE_PYTHON = new RegExp(/Python requirement (.*) is not compatible/g, 'gm');\n const SOLVER_PROBLEM = /SolverProblemError(.* version solving failed)/gms;\n const incompatiblePythonError = INCOMPATIBLE_PYTHON.exec(stderr);\n if (incompatiblePythonError) {\n throw new command_failed_to_run_error_1.CommandFailedError(`The current project's Python requirement ${incompatiblePythonError[1]} is not compatible with some of the required packages`, command);\n }\n const solverProblemError = SOLVER_PROBLEM.exec(stderr);\n if (solverProblemError) {\n throw new command_failed_to_run_error_1.CommandFailedError(solverProblemError[0].trim(), command);\n }\n if (stderr.includes(ALREADY_UP_TO_DATE)) {\n throw new command_failed_to_run_error_1.CommandFailedError('No dependencies could be updated as they seem to be at the correct versions. Make sure installed dependencies in the environment match those in the lockfile by running `poetry update`', command);\n }\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n}\n//# sourceMappingURL=poetry-add.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateRequiredData = void 0;\nconst missing_remediation_data_1 = require(\"../../../lib/errors/missing-remediation-data\");\nconst missing_file_name_1 = require(\"../../../lib/errors/missing-file-name\");\nconst no_fixes_applied_1 = require(\"../../../lib/errors/no-fixes-applied\");\nfunction validateRequiredData(entity) {\n const { remediation } = entity.testResult;\n if (!remediation) {\n throw new missing_remediation_data_1.MissingRemediationDataError();\n }\n const { targetFile } = entity.scanResult.identity;\n if (!targetFile) {\n throw new missing_file_name_1.MissingFileNameError();\n }\n const { workspace } = entity;\n if (!workspace) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n }\n return { targetFile, remediation, workspace };\n}\nexports.validateRequiredData = validateRequiredData;\n//# sourceMappingURL=validate-required-data.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pythonFix = void 0;\nconst debugLib = require(\"debug\");\nconst pMap = require(\"p-map\");\nconst ora = require(\"ora\");\nconst load_handler_1 = require(\"./load-handler\");\nconst map_entities_per_handler_type_1 = require(\"./map-entities-per-handler-type\");\nconst chalk = require(\"chalk\");\nconst is_supported_1 = require(\"./handlers/is-supported\");\nconst debug = debugLib('snyk-fix:python');\nasync function pythonFix(entities, options) {\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n const spinnerMessage = 'Looking for supported Python items';\n spinner.text = spinnerMessage;\n spinner.start();\n const handlerResult = {\n python: {\n succeeded: [],\n failed: [],\n skipped: [],\n },\n };\n const results = handlerResult.python;\n const { entitiesPerType, skipped: notSupported } = map_entities_per_handler_type_1.mapEntitiesPerHandlerType(entities);\n results.skipped.push(...notSupported);\n spinner.stopAndPersist({\n text: spinnerMessage,\n symbol: chalk.green('\\n✔'),\n });\n await pMap(Object.keys(entitiesPerType), async (projectType) => {\n const projectsToFix = entitiesPerType[projectType];\n if (!projectsToFix.length) {\n return;\n }\n const processingMessage = `Processing ${projectsToFix.length} ${projectType} items`;\n const processedMessage = `Processed ${projectsToFix.length} ${projectType} items`;\n spinner.text = processingMessage;\n spinner.render();\n try {\n const handler = load_handler_1.loadHandler(projectType);\n // drop unsupported Python entities early so only potentially fixable items get\n // attempted to be fixed\n const { fixable, skipped: notFixable } = await is_supported_1.partitionByFixable(projectsToFix);\n results.skipped.push(...notFixable);\n const { failed, skipped, succeeded } = await handler(fixable, options);\n results.failed.push(...failed);\n results.skipped.push(...skipped);\n results.succeeded.push(...succeeded);\n }\n catch (e) {\n debug(`Failed to fix ${projectsToFix.length} ${projectType} projects.\\nError: ${e.message}`);\n results.failed.push(...projectsToFix.map((p) => ({ original: p, error: e })));\n }\n spinner.stopAndPersist({\n text: processedMessage,\n symbol: chalk.green('✔'),\n });\n }, {\n concurrency: 5,\n });\n return handlerResult;\n}\nexports.pythonFix = pythonFix;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.loadHandler = void 0;\nconst pip_requirements_1 = require(\"./handlers/pip-requirements\");\nconst pipenv_pipfile_1 = require(\"./handlers/pipenv-pipfile\");\nconst poetry_1 = require(\"./handlers/poetry\");\nconst supported_handler_types_1 = require(\"./supported-handler-types\");\nfunction loadHandler(type) {\n switch (type) {\n case supported_handler_types_1.SUPPORTED_HANDLER_TYPES.REQUIREMENTS: {\n return pip_requirements_1.pipRequirementsTxt;\n }\n case supported_handler_types_1.SUPPORTED_HANDLER_TYPES.PIPFILE: {\n return pipenv_pipfile_1.pipenvPipfile;\n }\n case supported_handler_types_1.SUPPORTED_HANDLER_TYPES.POETRY: {\n return poetry_1.poetry;\n }\n default: {\n throw new Error('No handler available for requested project type');\n }\n }\n}\nexports.loadHandler = loadHandler;\n//# sourceMappingURL=load-handler.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.mapEntitiesPerHandlerType = void 0;\nconst debugLib = require(\"debug\");\nconst get_handler_type_1 = require(\"./get-handler-type\");\nconst supported_handler_types_1 = require(\"./supported-handler-types\");\nconst debug = debugLib('snyk-fix:python');\nfunction mapEntitiesPerHandlerType(entities) {\n const entitiesPerType = {\n [supported_handler_types_1.SUPPORTED_HANDLER_TYPES.REQUIREMENTS]: [],\n [supported_handler_types_1.SUPPORTED_HANDLER_TYPES.PIPFILE]: [],\n [supported_handler_types_1.SUPPORTED_HANDLER_TYPES.POETRY]: [],\n };\n const skipped = [];\n for (const entity of entities) {\n const type = get_handler_type_1.getHandlerType(entity);\n if (type) {\n entitiesPerType[type].push(entity);\n continue;\n }\n const userMessage = `${entity.scanResult.identity.targetFile} is not supported`;\n debug(userMessage);\n skipped.push({ original: entity, userMessage });\n }\n return { entitiesPerType, skipped };\n}\nexports.mapEntitiesPerHandlerType = mapEntitiesPerHandlerType;\n//# sourceMappingURL=map-entities-per-handler-type.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.standardizePackageName = void 0;\n/*\n * https://www.python.org/dev/peps/pep-0426/#name\n * All comparisons of distribution names MUST be case insensitive,\n * and MUST consider hyphens and underscores to be equivalent.\n *\n */\nfunction standardizePackageName(name) {\n return name.replace('_', '-').toLowerCase();\n}\nexports.standardizePackageName = standardizePackageName;\n//# sourceMappingURL=standardize-package-name.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SUPPORTED_HANDLER_TYPES = void 0;\nvar SUPPORTED_HANDLER_TYPES;\n(function (SUPPORTED_HANDLER_TYPES) {\n // shortname = display name\n SUPPORTED_HANDLER_TYPES[\"REQUIREMENTS\"] = \"requirements.txt\";\n SUPPORTED_HANDLER_TYPES[\"PIPFILE\"] = \"Pipfile\";\n SUPPORTED_HANDLER_TYPES[\"POETRY\"] = \"pyproject.toml\";\n})(SUPPORTED_HANDLER_TYPES = exports.SUPPORTED_HANDLER_TYPES || (exports.SUPPORTED_HANDLER_TYPES = {}));\n//# sourceMappingURL=supported-handler-types.js.map"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"741.index.js","mappings":";;;;;;;;;;;AAOA,SAAS,sBAAsB,CAC7B,KAAuB;IAKvB,MAAM,UAAU,GAAe,EAAE,CAAC;IAClC,MAAM,MAAM,GAAY,EAAE,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;AACA;AACA,oCAAoC,yBAAyB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA,8BAA8B,kBAAkB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB,eAAe,EAAE,QAAQ;AAC1D;AACA,aAAa;AACb;AACA,iCAAiC;AACjC;AACA;AACA,oCAAoC,yBAAyB;AAC7D;AACA;AACA;AACA,kCAAkC,sBAAsB,iBAAiB,uBAAuB;AAChG;AACA;AACA,aAAa,sBAAsB,EAAE,wBAAwB;AAC7D;AACA;AACA,aAAa,sBAAsB,EAAE,yBAAyB;AAC9D;AACA;AACA;AACA,aAAa,sBAAsB,EAAE,qBAAqB;AAC1D;AACA;AACA,oBAAoB,qBAAqB,MAAM,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa;AACjI;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,sCAAsC,8BAA8B;AACpE;AACA;AACA,2EAA2E,UAAU;AACrF;AACA;AACA,uEAAuE,MAAM;AAC7E;AACA;AACA,yEAAyE,QAAQ;AACjF;AACA;AACA,sEAAsE,KAAK;AAC3E;AACA;AACA;AACA,kCAAkC;AAClC,+BAA+B;AAC/B;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,4BAA4B;AAC5B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,6BAA6B;AACtD;AACA,6BAA6B,6BAA6B,UAAU,wBAAwB;AAC5F;AACA;AACA,YAAY,sBAAsB;AAClC,gDAAgD,0BAA0B;AAC1E;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA,gBAAgB,sBAAsB,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,sBAAsB,EAAE,mBAAmB;AACzI;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,gBAAgB,6BAA6B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;;;;;;AClQa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,6BAA6B;AAC7B;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB,iCAAiC,mBAAO,CAAC,KAAsC;AAC/E,iBAAiB,mBAAO,CAAC,KAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;;;;;;;ACnBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iCAAiC;AACjC,cAAc,mBAAO,CAAC,KAAO;AAC7B,yBAAyB,mBAAO,CAAC,KAA0B;AAC3D,kBAAkB,mBAAO,CAAC,KAAkB;AAC5C,YAAY,mBAAO,CAAC,KAAK;AACzB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,YAAY,UAAU;AACtB,0BAA0B,iDAAiD;AAC3E;AACA,+BAA+B,gBAAgB;AAC/C;AACA;AACA;AACA;AACA,2DAA2D,gBAAgB;AAC3E;AACA,SAAS;AACT;AACA;AACA,YAAY,sBAAsB;AAClC;AACA,mCAAmC,SAAS,EAAE,gBAAgB,4CAA4C,gBAAgB,0BAA0B,mBAAmB;AACvK;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;;;;;;;AC5Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iCAAiC,GAAG,sBAAsB;AAC1D,gBAAgB,mBAAO,CAAC,KAAM;AAC9B,kCAAkC,mBAAO,CAAC,KAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,iCAAiC;AACjC;;;;;;;AC3Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B,GAAG,iCAAiC,GAAG,6BAA6B;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,gBAAgB,EAAE,SAAS,OAAO,SAAS,KAAK,WAAW;AACjG,4CAA4C,QAAQ;AACpD;AACA;AACA,mBAAmB,QAAQ,GAAG,WAAW;AACzC,SAAS;AACT;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gBAAgB,EAAE,SAAS,OAAO,SAAS,KAAK,WAAW;AACvF;AACA;AACA,mBAAmB,QAAQ,GAAG,WAAW;AACzC,SAAS;AACT;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA,0BAA0B;AAC1B;;;;;;;ACvDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,2BAA2B,mBAAO,CAAC,KAAsC;AACzE,oCAAoC,mBAAO,CAAC,KAA6B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACpBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B,GAAG,mBAAmB,GAAG,4BAA4B;AAC/E;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,aAAa;AACb;AACA,0BAA0B;AAC1B;;;;;;;ACtCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC3Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB,aAAa,mBAAO,CAAC,KAAM;AAC3B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,mCAAmC,mBAAO,CAAC,KAAgD;AAC3F,qCAAqC,mBAAO,CAAC,IAA8B;AAC3E;AACA,mFAAmF;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,wBAAwB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;;;;;;ACrCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,4BAA4B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AACA,YAAY,qDAAqD;AACjE;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,yBAAyB;AACrC,aAAa;AACb;AACA,qBAAqB;AACrB;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,2DAA2D,GAAG,eAAe;AACnG;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,sDAAsD,2DAA2D,GAAG,eAAe;AACnI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,YAAY,YAAY;AACxB,YAAY,YAAY;AACxB;AACA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,4BAA4B;AAC5B;AACA;AACA,iBAAiB,UAAU;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACpMa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB;AACrB;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;;;;;;ACjBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B,qBAAqB,mBAAO,CAAC,KAAc;AAC3C,mCAAmC,mBAAO,CAAC,KAAmC;AAC9E;AACA;AACA,6CAA6C,MAAM;AACnD;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wDAAwD,GAAG,WAAW;AACpG;AACA;AACA,KAAK;AACL;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACvBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB;AACpB,mCAAmC,mBAAO,CAAC,KAA4B;AACvE,qBAAqB,mBAAO,CAAC,KAAc;AAC3C,mCAAmC,mBAAO,C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ACjD,yBAAyB,mBAAO,CAAC,KAAkB;AACnD,4BAA4B,mBAAO,CAAC,KAAqB;AACzD,mCAAmC,mBAAO,CAAC,KAAoD;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,uDAAuD;AACnE;AACA;AACA;AACA;AACA;AACA,YAAY,gDAAgD;AAC5D;AACA;AACA;AACA;AACA,WAAW,0CAA0C;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;;;;;;;AC/Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;;;;;;ACTa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,mCAAmC,mBAAO,CAAC,KAAmC;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,aAAa;AACb;AACA,6BAA6B;AAC7B;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2CAA2C;AAC3D,iBAAiB;AACjB;AACA;AACA;;;;;;;ACvDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB;AACrB,iBAAiB,mBAAO,CAAC,KAAO;AAChC,YAAY,mBAAO,CAAC,KAAK;AACzB,iCAAiC,mBAAO,CAAC,KAAiC;AAC1E,8BAA8B,mBAAO,CAAC,KAAuB;AAC7D;AACA;AACA,8BAA8B,gBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,iDAAiD;AAC/E,iDAAiD,UAAU,GAAG,eAAe;AAC7E;AACA;AACA,gBAAgB,6BAA6B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;;;;;;AC9Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,mCAAmC,mBAAO,CAAC,KAAmC;AAC9E,iCAAiC,mBAAO,CAAC,KAA8B;AACvE;AACA,YAAY,cAAc;AAC1B,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA,yBAAyB,2DAA2D,IAAI,WAAW;AACnG;AACA,aAAa;AACb;AACA,wBAAwB;AACxB;;;;;;;AClBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B;AAC1B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,qCAAqC,mBAAO,CAAC,KAAkC;AAC/E,2BAA2B,mBAAO,CAAC,KAA4C;AAC/E,4BAA4B,mBAAO,CAAC,KAAqB;AACzD,qBAAqB,mBAAO,CAAC,KAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,sCAAsC,YAAY,MAAM;AACvF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,sCAAsC,YAAY,MAAM;AACvF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;AC9Fa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,gBAAgB,mBAAO,CAAC,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ACA,0HAA0H;AAC1H,gIAAgI;AAChI;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2DAA2D,IAAI,WAAW;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,SAAS;AACvE;AACA;AACA,aAAa;AACb;AACA,wBAAwB;AACxB;;;;;;;AC5Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0BAA0B;AAC1B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,4BAA4B,mBAAO,CAAC,KAAqB;AACzD,qBAAqB,mBAAO,CAAC,KAAc;AAC3C,2BAA2B,mBAAO,CAAC,KAA4C;AAC/E,qCAAqC,mBAAO,CAAC,KAAkC;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,wBAAwB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,sCAAsC,YAAY,MAAM;AACvF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,wBAAwB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+BAA+B,sCAAsC,YAAY,MAAM;AACvF;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;;;;;ACvGa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,gBAAgB,mBAAO,CAAC,KAAM;AAC9B,iBAAiB,mBAAO,CAAC,KAAO;AAChC,kBAAkB,mBAAO,CAAC,KAAkB;AAC5C,iCAAiC,mBAAO,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AAgD,sBAAsB,EAAE,aAAa;AACrF,8CAA8C,sBAAsB,EAAE,aAAa;AACnF;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,+BAA+B;AACnD;AACA,oBAAoB,6BAA6B;AACjD;AACA;AACA;AACA;AACA;AACA,mCAAmC,sBAAsB,EAAE,aAAa,oBAAoB,UAAU;AACtG,+DAA+D,uBAAuB;AACtF;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,iBAAiB;AACjB;;;;;;;AChEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB,2BAA2B,mBAAO,CAAC,KAA6B;AAChE,yBAAyB,mBAAO,CAAC,KAA2B;AAC5D,iBAAiB,mBAAO,CAAC,KAAmB;AAC5C,kCAAkC,mBAAO,CAAC,KAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;;;;;;;ACxBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iCAAiC;AACjC,iBAAiB,mBAAO,CAAC,KAAO;AAChC,2BAA2B,mBAAO,CAAC,KAAoB;AACvD,kCAAkC,mBAAO,CAAC,KAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,uCAAuC;AACtE;AACA,uBAAuB,+BAA+B;AACtD;AACA,aAAa;AACb;AACA,iCAAiC;AACjC;;;;;;;AC3Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;ACba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gEAAgE,+BAA+B,KAAK;AACrG","sources":["webpack://snyk/./src/cli/commands/fix/convert-legacy-test-result-to-new.ts","webpack://snyk/./src/cli/commands/fix/convert-legacy-test-result-to-scan-result.ts","webpack://snyk/./src/cli/commands/fix/convert-legacy-tests-results-to-fix-entities.ts","webpack://snyk/./src/cli/commands/fix/get-display-path.ts","webpack://snyk/./src/cli/commands/fix/index.ts","webpack://snyk/./src/cli/commands/fix/validate-fix-command-is-supported.ts","webpack://snyk/./src/cli/commands/process-command-args.ts","webpack://snyk/./src/cli/commands/test/format-test-error.ts","webpack://snyk/./src/cli/commands/test/set-default-test-options.ts","webpack://snyk/./src/cli/commands/test/validate-credentials.ts","webpack://snyk/./src/cli/commands/test/validate-test-options.ts","webpack://snyk/./src/lib/errors/fail-on-error.ts.ts","webpack://snyk/./src/lib/errors/not-supported-by-ecosystem.ts","webpack://snyk/./packages/snyk-fix/dist/index.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/command-failed-to-run-error.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/common.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/custom-error.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/error-to-user-message.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/failed-to-parse-manifest.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/missing-file-name.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/missing-remediation-data.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/no-fixes-applied.js","webpack://snyk/./packages/snyk-fix/dist/lib/errors/unsupported-type-error.js","webpack://snyk/./packages/snyk-fix/dist/lib/issues/fixable-issues.js","webpack://snyk/./packages/snyk-fix/dist/lib/issues/issues-by-severity.js","webpack://snyk/./packages/snyk-fix/dist/lib/issues/total-issues-count.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/format-display-name.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/format-successful-item.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/format-unresolved-item.js","webpack://snyk/./packages/snyk-fix/dist/lib/output-formatters/show-results-summary.js","webpack://snyk/./packages/snyk-fix/dist/partition-by-vulnerable.js","webpack://snyk/./packages/snyk-fix/dist/plugins/load-plugin.js","webpack://snyk/./packages/snyk-fix/dist/plugins/package-tool-supported.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/get-handler-type.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/attempted-changes-summary.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/fail-if-no-updates-applied.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/is-supported.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/contains-require-directive.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/extract-version-provenance.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/apply-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/calculate-relevant-fixes.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/generate-pins.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/generate-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/is-defined.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pip-requirements/update-dependencies/requirements-file-parser.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/update-dependencies/generate-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/update-dependencies/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/pipenv-pipfile/update-dependencies/pipenv-add.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/update-dependencies/generate-upgrades.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/update-dependencies/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/poetry/update-dependencies/poetry-add.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/handlers/validate-required-data.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/index.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/load-handler.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/map-entities-per-handler-type.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/standardize-package-name.js","webpack://snyk/./packages/snyk-fix/dist/plugins/python/supported-handler-types.js"],"sourcesContent":["import { DepGraphData } from '@snyk/dep-graph';\nimport { IssuesData, Issue, TestResult } from '../../../lib/ecosystems/types';\nimport {\n AnnotatedIssue,\n TestResult as LegacyTestResult,\n} from '../../../lib/snyk-test/legacy';\n\nfunction convertVulnerabilities(\n vulns: AnnotatedIssue[],\n): {\n issuesData: IssuesData;\n issues: Issue[];\n} {\n const issuesData: IssuesData = {};\n const issues: Issue[] = [];\n\n vulns.forEach((vuln) => {\n issuesData[vuln.id] = {\n id: vuln.id,\n severity: vuln.severity,\n title: vuln.title,\n };\n issues.push({\n pkgName: vuln.packageName,\n pkgVersion: vuln.version,\n issueId: vuln.id,\n // TODO: add fixInfo when needed\n fixInfo: {} as any,\n });\n });\n return { issuesData, issues };\n}\n\nexport function convertLegacyTestResultToNew(\n testResult: LegacyTestResult,\n): TestResult {\n const { issues, issuesData } = convertVulnerabilities(\n testResult.vulnerabilities,\n );\n return {\n issuesData,\n issues,\n remediation: testResult.remediation,\n // TODO: grab this once Ecosystems flow starts sending back ScanResult\n depGraphData: {} as DepGraphData,\n };\n}\n","import { ScanResult } from '../../../lib/ecosystems/types';\nimport { TestResult } from '../../../lib/snyk-test/legacy';\n\nexport function convertLegacyTestResultToScanResult(\n testResult: TestResult,\n): ScanResult {\n if (!testResult.packageManager) {\n throw new Error(\n 'Only results with packageManagers are supported for conversion',\n );\n }\n return {\n identity: {\n type: testResult.packageManager,\n // this is because not all plugins send it back today, but we should always have it\n targetFile: testResult.targetFile || testResult.displayTargetFile,\n },\n name: testResult.projectName,\n // TODO: grab this once Ecosystems flow starts sending back ScanResult\n facts: [],\n policy: testResult.policy,\n // TODO: grab this once Ecosystems flow starts sending back ScanResult\n target: {} as any,\n };\n}\n","import * as fs from 'fs';\nimport * as pathLib from 'path';\nimport { convertLegacyTestResultToNew } from './convert-legacy-test-result-to-new';\nimport { convertLegacyTestResultToScanResult } from './convert-legacy-test-result-to-scan-result';\nimport { TestResult } from '../../../lib/snyk-test/legacy';\nimport { EntityToFix } from '@snyk/fix';\nimport { Options, TestOptions } from '../../../lib/types';\n\nexport function convertLegacyTestResultToFixEntities(\n testResults: (TestResult | TestResult[]) | Error,\n root: string,\n options: Partial<Options & TestOptions>,\n): EntityToFix[] {\n if (testResults instanceof Error) {\n return [];\n }\n const oldResults = Array.isArray(testResults) ? testResults : [testResults];\n return oldResults.map((res) => ({\n options,\n workspace: {\n path: root,\n readFile: async (path: string) => {\n return fs.readFileSync(pathLib.resolve(root, path), 'utf8');\n },\n writeFile: async (path: string, content: string) => {\n return fs.writeFileSync(pathLib.resolve(root, path), content, 'utf8');\n },\n },\n scanResult: convertLegacyTestResultToScanResult(res),\n testResult: convertLegacyTestResultToNew(res),\n }));\n}\n","import * as pathLib from 'path';\n\nimport { isLocalFolder } from '../../../lib/detect';\n\nexport function getDisplayPath(path: string): string {\n if (!isLocalFolder(path)) {\n return path;\n }\n if (path === process.cwd()) {\n return pathLib.parse(path).name;\n }\n return pathLib.relative(process.cwd(), path);\n}\n","import * as Debug from 'debug';\nimport * as snykFix from '@snyk/fix';\nimport * as ora from 'ora';\n\nimport { MethodArgs } from '../../args';\nimport * as snyk from '../../../lib';\nimport { TestResult } from '../../../lib/snyk-test/legacy';\nimport * as analytics from '../../../lib/analytics';\n\nimport { convertLegacyTestResultToFixEntities } from './convert-legacy-tests-results-to-fix-entities';\nimport { formatTestError } from '../test/format-test-error';\nimport { processCommandArgs } from '../process-command-args';\nimport { validateCredentials } from '../test/validate-credentials';\nimport { validateTestOptions } from '../test/validate-test-options';\nimport { setDefaultTestOptions } from '../test/set-default-test-options';\nimport { validateFixCommandIsSupported } from './validate-fix-command-is-supported';\nimport { Options, TestOptions } from '../../../lib/types';\nimport { getDisplayPath } from './get-display-path';\nimport chalk from 'chalk';\nimport { icon, color } from '../../../lib/theme';\n\nconst debug = Debug('snyk-fix');\nconst snykFixFeatureFlag = 'cliSnykFix';\n\ninterface FixOptions {\n dryRun?: boolean;\n quiet?: boolean;\n sequential?: boolean;\n}\nexport default async function fix(...args: MethodArgs): Promise<string> {\n const { options: rawOptions, paths } = await processCommandArgs<FixOptions>(\n ...args,\n );\n const options = setDefaultTestOptions<FixOptions>(rawOptions);\n debug(options);\n await validateFixCommandIsSupported(options);\n validateTestOptions(options);\n validateCredentials(options);\n const results: snykFix.EntityToFix[] = [];\n results.push(...(await runSnykTestLegacy(options, paths)));\n // fix\n debug(\n `Organization has ${snykFixFeatureFlag} feature flag enabled for experimental Snyk fix functionality`,\n );\n const vulnerableResults = results.filter(\n (res) => Object.keys(res.testResult.issues).length,\n );\n const { dryRun, quiet, sequential: sequentialFix } = options;\n const { fixSummary, meta, results: resultsByPlugin } = await snykFix.fix(\n results,\n {\n dryRun,\n quiet,\n sequentialFix,\n },\n );\n\n setSnykFixAnalytics(\n fixSummary,\n meta,\n results,\n resultsByPlugin,\n vulnerableResults,\n );\n // `snyk test` did not return any test results\n if (results.length === 0) {\n throw new Error(fixSummary);\n }\n // `snyk test` returned no vulnerable results, so nothing to fix\n if (vulnerableResults.length === 0) {\n return fixSummary;\n }\n // `snyk test` returned vulnerable results\n // however some errors occurred during `snyk fix` and nothing was fixed in the end\n const anyFailed = meta.failed > 0;\n const noneFixed = meta.fixed === 0;\n if (anyFailed && noneFixed) {\n throw new Error(fixSummary);\n }\n return fixSummary;\n}\n\n/* @deprecated\n * TODO: once project envelope is default all code below will be deleted\n * we should be calling test via new Ecosystems instead\n */\nasync function runSnykTestLegacy(\n options: Options & TestOptions & FixOptions,\n paths: string[],\n): Promise<snykFix.EntityToFix[]> {\n const results: snykFix.EntityToFix[] = [];\n const stdOutSpinner = ora({\n isSilent: options.quiet,\n stream: process.stdout,\n });\n const stdErrSpinner = ora({\n isSilent: options.quiet,\n stream: process.stdout,\n });\n stdErrSpinner.start();\n stdOutSpinner.start();\n\n for (const path of paths) {\n let displayPath = path;\n const spinnerMessage = `Running \\`snyk test\\` for ${displayPath}`;\n\n try {\n displayPath = getDisplayPath(path);\n stdOutSpinner.text = spinnerMessage;\n stdOutSpinner.render();\n // Create a copy of the options so a specific test can\n // modify them i.e. add `options.file` etc. We'll need\n // these options later.\n const snykTestOptions = {\n ...options,\n path,\n projectName: options['project-name'],\n };\n\n const testResults: TestResult[] = [];\n\n const testResultForPath: TestResult | TestResult[] = await snyk.test(\n path,\n { ...snykTestOptions, quiet: true },\n );\n testResults.push(\n ...(Array.isArray(testResultForPath)\n ? testResultForPath\n : [testResultForPath]),\n );\n const newRes = convertLegacyTestResultToFixEntities(\n testResults,\n path,\n options,\n );\n results.push(...newRes);\n stdOutSpinner.stopAndPersist({\n text: spinnerMessage,\n symbol: `\\n${icon.RUN}`,\n });\n } catch (error) {\n const testError = formatTestError(error);\n const userMessage =\n color.status.error(`Failed! ${testError.message}.`) +\n `\\n Tip: run \\`snyk test ${displayPath} -d\\` for more information.`;\n stdOutSpinner.stopAndPersist({\n text: spinnerMessage,\n symbol: `\\n${icon.RUN}`,\n });\n stdErrSpinner.stopAndPersist({\n text: userMessage,\n symbol: chalk.red(' '),\n });\n debug(userMessage);\n }\n }\n stdOutSpinner.stop();\n stdErrSpinner.stop();\n return results;\n}\n\nfunction setSnykFixAnalytics(\n fixSummary: string,\n meta: snykFix.FixedMeta,\n snykTestResponses: snykFix.EntityToFix[],\n resultsByPlugin: snykFix.FixHandlerResultByPlugin,\n vulnerableResults: snykFix.EntityToFix[],\n) {\n // Analytics # of projects\n analytics.add('snykFixFailedProjects', meta.failed);\n analytics.add('snykFixFixedProjects', meta.fixed);\n analytics.add('snykFixTotalProjects', snykTestResponses.length);\n analytics.add('snykFixVulnerableProjects', vulnerableResults.length);\n\n // Analytics # of issues\n analytics.add('snykFixFixableIssues', meta.fixableIssues);\n analytics.add('snykFixFixedIssues', meta.fixedIssues);\n analytics.add('snykFixTotalIssues', meta.totalIssues);\n\n analytics.add('snykFixSummary', fixSummary);\n\n // Analytics for errors\n for (const plugin of Object.keys(resultsByPlugin)) {\n const errors: string[] = [];\n const failedToFix = resultsByPlugin[plugin].failed;\n if (failedToFix.length > 0) {\n errors.push(...failedToFix.map((f) => f.error?.message));\n }\n analytics.add('snykFixErrors', { [plugin]: errors });\n }\n}\n","import * as Debug from 'debug';\n\nimport { getEcosystemForTest } from '../../../lib/ecosystems';\n\nimport { isFeatureFlagSupportedForOrg } from '../../../lib/feature-flags';\nimport { FeatureNotSupportedByEcosystemError } from '../../../lib/errors/not-supported-by-ecosystem';\nimport { Options, TestOptions } from '../../../lib/types';\nimport { AuthFailedError } from '../../../lib/errors';\nimport chalk from 'chalk';\n\nconst debug = Debug('snyk-fix');\nconst snykFixFeatureFlag = 'cliSnykFix';\n\nexport async function validateFixCommandIsSupported(\n options: Options & TestOptions,\n): Promise<boolean> {\n if (options.docker) {\n throw new FeatureNotSupportedByEcosystemError('snyk fix', 'docker');\n }\n\n const ecosystem = getEcosystemForTest(options);\n if (ecosystem) {\n throw new FeatureNotSupportedByEcosystemError('snyk fix', ecosystem);\n }\n\n const snykFixSupported = await isFeatureFlagSupportedForOrg(\n snykFixFeatureFlag,\n options.org,\n );\n\n debug('Feature flag check returned: ', snykFixSupported);\n\n if (snykFixSupported.code === 401 || snykFixSupported.code === 403) {\n throw AuthFailedError(snykFixSupported.error, snykFixSupported.code);\n }\n\n if (!snykFixSupported.ok) {\n const snykFixErrorMessage =\n chalk.red(\n `\\`snyk fix\\` is not supported${\n options.org ? ` for org '${options.org}'` : ''\n }.`,\n ) +\n '\\nSee documentation on how to enable this beta feature: https://support.snyk.io/hc/en-us/articles/4403417279505-Automatic-remediation-with-snyk-fix';\n const unsupportedError = new Error(snykFixErrorMessage);\n throw unsupportedError;\n }\n\n return true;\n}\n","import { Options } from '../../lib/types';\n\nexport function processCommandArgs<CommandOptions>(\n ...args\n): { paths: string[]; options: Options & CommandOptions } {\n let options = ({} as any) as Options & CommandOptions;\n\n if (typeof args[args.length - 1] === 'object') {\n options = (args.pop() as any) as Options & CommandOptions;\n }\n args = args.filter(Boolean);\n\n // For repository scanning, populate with default path (cwd) if no path given\n if (args.length === 0 && !options.docker) {\n args.unshift(process.cwd());\n }\n\n return { options, paths: args };\n}\n","export function formatTestError(error) {\n // Possible error cases:\n // - the test found some vulns. `error.message` is a\n // JSON-stringified\n // test result.\n // - the flow failed, `error` is a real Error object.\n // - the flow failed, `error` is a number or string\n // describing the problem.\n //\n // To standardise this, make sure we use the best _object_ to\n // describe the error.\n let errorResponse;\n if (error instanceof Error) {\n errorResponse = error;\n } else if (typeof error !== 'object') {\n errorResponse = new Error(error);\n } else {\n try {\n errorResponse = JSON.parse(error.message);\n } catch (unused) {\n errorResponse = error;\n }\n }\n return errorResponse;\n}\n","import config from '../../../lib/config';\nimport { Options, ShowVulnPaths, TestOptions } from '../../../lib/types';\n\nexport function setDefaultTestOptions<CommandOptions>(\n options: Options & CommandOptions,\n): Options & TestOptions & CommandOptions {\n const svpSupplied = (options['show-vulnerable-paths'] || '')\n .toString()\n .toLowerCase();\n\n delete options['show-vulnerable-paths'];\n return {\n ...options,\n // org fallback to config unless specified\n org: options.org || config.org,\n // making `show-vulnerable-paths` 'some' by default.\n showVulnPaths: showVulnPathsMapping[svpSupplied] || 'some',\n };\n}\n\nconst showVulnPathsMapping: Record<string, ShowVulnPaths> = {\n false: 'none',\n none: 'none',\n true: 'some',\n some: 'some',\n all: 'all',\n};\n","import {\n apiTokenExists,\n getOAuthToken,\n getDockerToken,\n} from '../../../lib/api-token';\nimport { TestOptions, Options } from '../../../lib/types';\n\nexport function validateCredentials(options: Options & TestOptions): void {\n try {\n apiTokenExists();\n } catch (err) {\n if (getOAuthToken()) {\n return;\n } else if (options.docker && getDockerToken()) {\n options.testDepGraphDockerEndpoint = '/docker-jwt/test-dependencies';\n options.isDockerUser = true;\n } else {\n throw err;\n }\n }\n}\n","import { color } from '../../../lib/theme';\nimport { TestOptions, Options } from '../../../lib/types';\nimport { FAIL_ON, FailOn, SEVERITIES } from '../../../lib/snyk-test/common';\nimport { FailOnError } from '../../../lib/errors/fail-on-error.ts';\n\nexport function validateTestOptions(options: TestOptions & Options) {\n if (\n options.severityThreshold &&\n !validateSeverityThreshold(options.severityThreshold)\n ) {\n throw new Error('INVALID_SEVERITY_THRESHOLD');\n }\n\n if (options.failOn && !validateFailOn(options.failOn)) {\n const error = new FailOnError();\n throw color.status.error(error.message);\n }\n}\n\nfunction validateSeverityThreshold(severityThreshold) {\n return SEVERITIES.map((s) => s.verboseName).indexOf(severityThreshold) > -1;\n}\n\nfunction validateFailOn(arg: FailOn) {\n return Object.keys(FAIL_ON).includes(arg);\n}\n","import { CustomError } from './custom-error';\nimport { FAIL_ON } from '../snyk-test/common';\n\nexport class FailOnError extends CustomError {\n private static ERROR_MESSAGE =\n 'Invalid fail on argument, please use one of: ' +\n Object.keys(FAIL_ON).join(' | ');\n\n constructor() {\n super(FailOnError.ERROR_MESSAGE);\n }\n}\n","import { CustomError } from './custom-error';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { Ecosystem } from '../ecosystems/types';\n\nexport class FeatureNotSupportedByEcosystemError extends CustomError {\n public readonly feature: string;\n\n constructor(\n feature: string,\n ecosystem: SupportedPackageManagers | Ecosystem,\n ) {\n super(`Unsupported ecosystem ${ecosystem} for ${feature}.`);\n this.code = 422;\n this.feature = feature;\n\n this.userMessage = `\\`${feature}\\` is not supported for ecosystem '${ecosystem}'`;\n }\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.extractMeta = exports.groupEntitiesPerScanType = exports.fix = void 0;\nconst debugLib = require(\"debug\");\nconst pMap = require(\"p-map\");\nconst ora = require(\"ora\");\nconst chalk = require(\"chalk\");\nconst outputFormatter = require(\"./lib/output-formatters/show-results-summary\");\nconst load_plugin_1 = require(\"./plugins/load-plugin\");\nconst partition_by_vulnerable_1 = require(\"./partition-by-vulnerable\");\nconst error_to_user_message_1 = require(\"./lib/errors/error-to-user-message\");\nconst total_issues_count_1 = require(\"./lib/issues/total-issues-count\");\nconst fixable_issues_1 = require(\"./lib/issues/fixable-issues\");\nconst debug = debugLib('snyk-fix:main');\nasync function fix(entities, options = {\n dryRun: false,\n quiet: false,\n stripAnsi: false,\n}) {\n debug('Running snyk fix with options:', options);\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n let resultsByPlugin = {};\n const { vulnerable, notVulnerable: nothingToFix, } = await partition_by_vulnerable_1.partitionByVulnerable(entities);\n const entitiesPerType = groupEntitiesPerScanType(vulnerable);\n const exceptions = {};\n await pMap(Object.keys(entitiesPerType), async (scanType) => {\n try {\n const fixPlugin = load_plugin_1.loadPlugin(scanType);\n const results = await fixPlugin(entitiesPerType[scanType], options);\n resultsByPlugin = { ...resultsByPlugin, ...results };\n }\n catch (e) {\n debug(`Failed to processes ${scanType}`, e);\n exceptions[scanType] = {\n originals: entitiesPerType[scanType],\n userMessage: error_to_user_message_1.convertErrorToUserMessage(e),\n };\n }\n }, {\n concurrency: 3,\n });\n const fixSummary = await outputFormatter.showResultsSummary(nothingToFix, resultsByPlugin, exceptions, options, entities.length);\n const meta = extractMeta(resultsByPlugin, exceptions);\n spinner.start();\n if (meta.fixed > 0) {\n spinner.stopAndPersist({\n text: 'Done',\n symbol: chalk.green('✔'),\n });\n }\n else {\n spinner.stop();\n }\n return {\n results: resultsByPlugin,\n exceptions,\n fixSummary,\n meta,\n };\n}\nexports.fix = fix;\nfunction groupEntitiesPerScanType(entities) {\n var _a, _b, _c;\n const entitiesPerType = {};\n for (const entity of entities) {\n // TODO: group all node\n const type = (_c = (_b = (_a = entity.scanResult) === null || _a === void 0 ? void 0 : _a.identity) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : 'missing-type';\n if (entitiesPerType[type]) {\n entitiesPerType[type].push(entity);\n continue;\n }\n entitiesPerType[type] = [entity];\n }\n return entitiesPerType;\n}\nexports.groupEntitiesPerScanType = groupEntitiesPerScanType;\nfunction extractMeta(resultsByPlugin, exceptions) {\n const testResults = outputFormatter.getTestResults(resultsByPlugin, exceptions);\n const issueData = testResults.map((i) => i.issuesData);\n const failed = outputFormatter.calculateFailed(resultsByPlugin, exceptions);\n const fixed = outputFormatter.calculateFixed(resultsByPlugin);\n const totalIssueCount = total_issues_count_1.getTotalIssueCount(issueData);\n const { count: fixableCount } = fixable_issues_1.hasFixableIssues(testResults);\n const fixedIssueCount = outputFormatter.calculateFixedIssues(resultsByPlugin);\n return {\n fixed,\n failed,\n totalIssues: totalIssueCount,\n fixableIssues: fixableCount,\n fixedIssues: fixedIssueCount,\n };\n}\nexports.extractMeta = extractMeta;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CommandFailedError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass CommandFailedError extends custom_error_1.CustomError {\n constructor(customMessage, command) {\n super(customMessage, custom_error_1.ERROR_CODES.CommandFailed);\n this.command = command;\n }\n}\nexports.CommandFailedError = CommandFailedError;\n//# sourceMappingURL=command-failed-to-run-error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.contactSupportMessage = exports.reTryMessage = void 0;\nexports.reTryMessage = 'Tip: Re-run in debug mode to see more information: DEBUG=*snyk* <COMMAND>';\nexports.contactSupportMessage = 'If the issue persists contact support@snyk.io';\n//# sourceMappingURL=common.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ERROR_CODES = exports.CustomError = void 0;\nclass CustomError extends Error {\n constructor(message, errorCode) {\n super(message);\n this.name = this.constructor.name;\n this.innerError = undefined;\n this.errorCode = errorCode;\n }\n}\nexports.CustomError = CustomError;\nvar ERROR_CODES;\n(function (ERROR_CODES) {\n ERROR_CODES[\"UnsupportedTypeError\"] = \"G10\";\n ERROR_CODES[\"MissingRemediationData\"] = \"G11\";\n ERROR_CODES[\"MissingFileName\"] = \"G12\";\n ERROR_CODES[\"FailedToParseManifest\"] = \"G13\";\n ERROR_CODES[\"CommandFailed\"] = \"G14\";\n ERROR_CODES[\"NoFixesCouldBeApplied\"] = \"G15\";\n})(ERROR_CODES = exports.ERROR_CODES || (exports.ERROR_CODES = {}));\n//# sourceMappingURL=custom-error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.convertErrorToUserMessage = void 0;\nconst unsupported_type_error_1 = require(\"./unsupported-type-error\");\nfunction convertErrorToUserMessage(error) {\n if (error instanceof unsupported_type_error_1.UnsupportedTypeError) {\n return `${error.scanType} is not supported.`;\n }\n return error.message;\n}\nexports.convertErrorToUserMessage = convertErrorToUserMessage;\n//# sourceMappingURL=error-to-user-message.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FailedToParseManifest = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass FailedToParseManifest extends custom_error_1.CustomError {\n constructor() {\n super('Failed to parse manifest', custom_error_1.ERROR_CODES.FailedToParseManifest);\n }\n}\nexports.FailedToParseManifest = FailedToParseManifest;\n//# sourceMappingURL=failed-to-parse-manifest.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MissingFileNameError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass MissingFileNameError extends custom_error_1.CustomError {\n constructor() {\n super('Filename is missing from test result', custom_error_1.ERROR_CODES.MissingFileName);\n }\n}\nexports.MissingFileNameError = MissingFileNameError;\n//# sourceMappingURL=missing-file-name.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MissingRemediationDataError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass MissingRemediationDataError extends custom_error_1.CustomError {\n constructor() {\n super('Remediation data is required to apply fixes', custom_error_1.ERROR_CODES.MissingRemediationData);\n }\n}\nexports.MissingRemediationDataError = MissingRemediationDataError;\n//# sourceMappingURL=missing-remediation-data.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NoFixesCouldBeAppliedError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass NoFixesCouldBeAppliedError extends custom_error_1.CustomError {\n constructor(message, tip) {\n super(message || 'No fixes could be applied', custom_error_1.ERROR_CODES.NoFixesCouldBeApplied);\n this.tip = tip;\n }\n}\nexports.NoFixesCouldBeAppliedError = NoFixesCouldBeAppliedError;\n//# sourceMappingURL=no-fixes-applied.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UnsupportedTypeError = void 0;\nconst custom_error_1 = require(\"./custom-error\");\nclass UnsupportedTypeError extends custom_error_1.CustomError {\n constructor(scanType) {\n super('Provided scan type is not supported', custom_error_1.ERROR_CODES.UnsupportedTypeError);\n this.scanType = scanType;\n }\n}\nexports.UnsupportedTypeError = UnsupportedTypeError;\n//# sourceMappingURL=unsupported-type-error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasFixableIssues = void 0;\nfunction hasFixableIssues(results) {\n let hasFixes = false;\n let count = 0;\n for (const result of Object.values(results)) {\n const { remediation } = result;\n if (remediation) {\n const { upgrade, pin, patch } = remediation;\n const upgrades = Object.keys(upgrade);\n const pins = Object.keys(pin);\n if (pins.length || upgrades.length) {\n hasFixes = true;\n // pins & upgrades are mutually exclusive\n count += getUpgradableIssues(pins.length ? pin : upgrade);\n }\n const patches = Object.keys(patch);\n if (patches.length) {\n hasFixes = true;\n count += patches.length;\n }\n }\n }\n return {\n hasFixes,\n count,\n };\n}\nexports.hasFixableIssues = hasFixableIssues;\nfunction getUpgradableIssues(updates) {\n const issues = [];\n for (const id of Object.keys(updates)) {\n issues.push(...updates[id].vulns);\n }\n return issues.length;\n}\n//# sourceMappingURL=fixable-issues.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getIssueCountBySeverity = void 0;\nfunction getIssueCountBySeverity(issueData) {\n const total = {\n low: [],\n medium: [],\n high: [],\n critical: [],\n };\n for (const entry of issueData) {\n for (const issue of Object.values(entry)) {\n const { severity, id } = issue;\n total[severity.toLowerCase()].push(id);\n }\n }\n return total;\n}\nexports.getIssueCountBySeverity = getIssueCountBySeverity;\n//# sourceMappingURL=issues-by-severity.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getTotalIssueCount = void 0;\nfunction getTotalIssueCount(issueData) {\n let total = 0;\n for (const entry of issueData) {\n total += Object.keys(entry).length;\n }\n return total;\n}\nexports.getTotalIssueCount = getTotalIssueCount;\n//# sourceMappingURL=total-issues-count.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatDisplayName = void 0;\nconst pathLib = require(\"path\");\nfunction formatDisplayName(path, identity) {\n if (!identity.targetFile) {\n return `${identity.type} project`;\n }\n // show paths relative to where `snyk fix` is running\n return pathLib.relative(process.cwd(), pathLib.join(path, identity.targetFile));\n}\nexports.formatDisplayName = formatDisplayName;\n//# sourceMappingURL=format-display-name.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatChangesSummary = void 0;\nconst chalk = require(\"chalk\");\nconst format_display_name_1 = require(\"./format-display-name\");\nconst show_results_summary_1 = require(\"./show-results-summary\");\n/*\n * Generate formatted output that describes what changes were applied, which failed.\n */\nfunction formatChangesSummary(entity, changes) {\n return `${show_results_summary_1.PADDING_SPACE}${format_display_name_1.formatDisplayName(entity.workspace.path, entity.scanResult.identity)}\\n${changes.map((c) => formatAppliedChange(c)).join('\\n')}`;\n}\nexports.formatChangesSummary = formatChangesSummary;\nfunction formatAppliedChange(change) {\n if (change.success === true) {\n return `${show_results_summary_1.PADDING_SPACE}${chalk.green('✔')} ${change.userMessage}`;\n }\n if (change.success === false) {\n return `${show_results_summary_1.PADDING_SPACE}${chalk.red('x')} ${chalk.red(change.userMessage)}\\n${show_results_summary_1.PADDING_SPACE}Reason:${show_results_summary_1.PADDING_SPACE}${change.reason}${change.tip ? `.\\n${show_results_summary_1.PADDING_SPACE}Tip: ${change.tip}` : undefined}`;\n }\n return '';\n}\n//# sourceMappingURL=format-successful-item.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatUnresolved = void 0;\nconst chalk = require(\"chalk\");\nconst format_display_name_1 = require(\"./format-display-name\");\nconst show_results_summary_1 = require(\"./show-results-summary\");\nfunction formatUnresolved(entity, userMessage, tip) {\n const name = format_display_name_1.formatDisplayName(entity.workspace.path, entity.scanResult.identity);\n const tipMessage = tip ? `\\n${show_results_summary_1.PADDING_SPACE}Tip: ${tip}` : '';\n const errorMessage = `${show_results_summary_1.PADDING_SPACE}${name}\\n${show_results_summary_1.PADDING_SPACE}${chalk.red('✖')} ${chalk.red(userMessage)}`;\n return errorMessage + tipMessage;\n}\nexports.formatUnresolved = formatUnresolved;\n//# sourceMappingURL=format-unresolved-item.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getTestResults = exports.generateIssueSummary = exports.getSeveritiesColour = exports.defaultSeverityColor = exports.severitiesColourMapping = exports.formatIssueCountBySeverity = exports.calculateFailed = exports.calculateFixedIssues = exports.calculateFixed = exports.generateOverallSummary = exports.generateUnresolvedSummary = exports.generateSuccessfulFixesSummary = exports.showResultsSummary = exports.PADDING_SPACE = void 0;\nconst chalk = require(\"chalk\");\nconst stripAnsi = require(\"strip-ansi\");\nconst common_1 = require(\"../errors/common\");\nconst error_to_user_message_1 = require(\"../errors/error-to-user-message\");\nconst fixable_issues_1 = require(\"../issues/fixable-issues\");\nconst issues_by_severity_1 = require(\"../issues/issues-by-severity\");\nconst total_issues_count_1 = require(\"../issues/total-issues-count\");\nconst format_successful_item_1 = require(\"./format-successful-item\");\nconst format_unresolved_item_1 = require(\"./format-unresolved-item\");\nexports.PADDING_SPACE = ' '; // 2 spaces\nasync function showResultsSummary(nothingToFix, resultsByPlugin, exceptions, options, total) {\n const successfulFixesSummary = generateSuccessfulFixesSummary(resultsByPlugin);\n const { summary: unresolvedSummary, count: unresolvedCount, } = generateUnresolvedSummary(resultsByPlugin, exceptions);\n const { summary: overallSummary, count: changedCount, } = generateOverallSummary(resultsByPlugin, exceptions, nothingToFix, options);\n const getHelpText = `${common_1.reTryMessage}. ${common_1.contactSupportMessage}`;\n // called without any `snyk test` results\n if (total === 0) {\n const summary = `\\n${chalk.red(' ✖ No successful fixes')}`;\n return options.stripAnsi ? stripAnsi(summary) : summary;\n }\n // 100% not vulnerable and had no errors/unsupported\n if (nothingToFix.length === total && unresolvedCount === 0) {\n const summary = `\\n${chalk.green('✔ No vulnerable items to fix')}\\n\\n${overallSummary}`;\n return options.stripAnsi ? stripAnsi(summary) : summary;\n }\n const summary = `\\n${successfulFixesSummary}${unresolvedSummary}${unresolvedCount || changedCount ? `\\n\\n${overallSummary}` : ''}${unresolvedSummary ? `\\n\\n${getHelpText}` : ''}`;\n return options.stripAnsi ? stripAnsi(summary) : summary;\n}\nexports.showResultsSummary = showResultsSummary;\nfunction generateSuccessfulFixesSummary(resultsByPlugin) {\n const sectionTitle = 'Successful fixes:';\n const formattedTitleHeader = `${chalk.bold(sectionTitle)}`;\n let summary = '';\n for (const plugin of Object.keys(resultsByPlugin)) {\n const fixedSuccessfully = resultsByPlugin[plugin].succeeded;\n if (fixedSuccessfully.length > 0) {\n summary +=\n '\\n\\n' +\n fixedSuccessfully\n .map((s) => format_successful_item_1.formatChangesSummary(s.original, s.changes))\n .join('\\n\\n');\n }\n }\n if (summary) {\n return formattedTitleHeader + summary;\n }\n return chalk.red(' ✖ No successful fixes\\n');\n}\nexports.generateSuccessfulFixesSummary = generateSuccessfulFixesSummary;\nfunction generateUnresolvedSummary(resultsByPlugin, exceptionsByScanType) {\n const title = 'Unresolved items:';\n const formattedTitle = `${chalk.bold(title)}`;\n let summary = '';\n let count = 0;\n for (const plugin of Object.keys(resultsByPlugin)) {\n const skipped = resultsByPlugin[plugin].skipped;\n if (skipped.length > 0) {\n count += skipped.length;\n summary +=\n '\\n\\n' +\n skipped\n .map((s) => format_unresolved_item_1.formatUnresolved(s.original, s.userMessage))\n .join('\\n\\n');\n }\n const failed = resultsByPlugin[plugin].failed;\n if (failed.length > 0) {\n count += failed.length;\n summary +=\n '\\n\\n' +\n failed\n .map((s) => format_unresolved_item_1.formatUnresolved(s.original, error_to_user_message_1.convertErrorToUserMessage(s.error), s.tip))\n .join('\\n\\n');\n }\n }\n if (Object.keys(exceptionsByScanType).length) {\n for (const ecosystem of Object.keys(exceptionsByScanType)) {\n const unresolved = exceptionsByScanType[ecosystem];\n count += unresolved.originals.length;\n summary +=\n '\\n\\n' +\n unresolved.originals\n .map((s) => format_unresolved_item_1.formatUnresolved(s, unresolved.userMessage))\n .join('\\n\\n');\n }\n }\n if (summary) {\n return { summary: `\\n\\n${formattedTitle}${summary}`, count };\n }\n return { summary: '', count: 0 };\n}\nexports.generateUnresolvedSummary = generateUnresolvedSummary;\nfunction generateOverallSummary(resultsByPlugin, exceptions, nothingToFix, options) {\n const sectionTitle = 'Summary:';\n const formattedTitleHeader = `${chalk.bold(sectionTitle)}`;\n const fixed = calculateFixed(resultsByPlugin);\n const failed = calculateFailed(resultsByPlugin, exceptions);\n const dryRunText = options.dryRun\n ? chalk.hex('#EDD55E')(`${exports.PADDING_SPACE}Command run in ${chalk.bold('dry run')} mode. Fixes are not applied.\\n`)\n : '';\n const notFixedMessage = failed > 0\n ? `${exports.PADDING_SPACE}${chalk.bold.red(failed)} items were not fixed\\n`\n : '';\n const fixedMessage = fixed > 0\n ? `${exports.PADDING_SPACE}${chalk.green.bold(fixed)} items were successfully fixed\\n`\n : '';\n const vulnsSummary = generateIssueSummary(resultsByPlugin, exceptions);\n const notVulnerableSummary = nothingToFix.length > 0\n ? `${exports.PADDING_SPACE}${nothingToFix.length} items were not vulnerable\\n`\n : '';\n return {\n summary: `${formattedTitleHeader}\\n\\n${dryRunText}${notFixedMessage}${fixedMessage}${notVulnerableSummary}${vulnsSummary}`,\n count: fixed + failed,\n };\n}\nexports.generateOverallSummary = generateOverallSummary;\nfunction calculateFixed(resultsByPlugin) {\n let fixed = 0;\n for (const plugin of Object.keys(resultsByPlugin)) {\n fixed += resultsByPlugin[plugin].succeeded.length;\n }\n return fixed;\n}\nexports.calculateFixed = calculateFixed;\nfunction calculateFixedIssues(resultsByPlugin) {\n const fixedIssues = [];\n for (const plugin of Object.keys(resultsByPlugin)) {\n for (const entity of resultsByPlugin[plugin].succeeded) {\n // count unique vulns fixed per scanned entity\n // some fixed may need to be made in multiple places\n // and would count multiple times otherwise.\n const fixedPerEntity = new Set();\n entity.changes\n .filter((c) => c.success)\n .forEach((c) => {\n c.issueIds.map((i) => fixedPerEntity.add(i));\n });\n fixedIssues.push(...Array.from(fixedPerEntity));\n }\n }\n return fixedIssues.length;\n}\nexports.calculateFixedIssues = calculateFixedIssues;\nfunction calculateFailed(resultsByPlugin, exceptions) {\n let failed = 0;\n for (const plugin of Object.keys(resultsByPlugin)) {\n const results = resultsByPlugin[plugin];\n failed += results.failed.length + results.skipped.length;\n }\n if (Object.keys(exceptions).length) {\n for (const ecosystem of Object.keys(exceptions)) {\n const unresolved = exceptions[ecosystem];\n failed += unresolved.originals.length;\n }\n }\n return failed;\n}\nexports.calculateFailed = calculateFailed;\nfunction formatIssueCountBySeverity({ critical, high, medium, low, }) {\n const summary = [];\n if (critical && critical > 0) {\n summary.push(exports.severitiesColourMapping.critical.colorFunc(`${critical} Critical`));\n }\n if (high && high > 0) {\n summary.push(exports.severitiesColourMapping.high.colorFunc(`${high} High`));\n }\n if (medium && medium > 0) {\n summary.push(exports.severitiesColourMapping.medium.colorFunc(`${medium} Medium`));\n }\n if (low && low > 0) {\n summary.push(exports.severitiesColourMapping.low.colorFunc(`${low} Low`));\n }\n return summary.join(' | ');\n}\nexports.formatIssueCountBySeverity = formatIssueCountBySeverity;\nexports.severitiesColourMapping = {\n low: {\n colorFunc(text) {\n return chalk.hex('#BCBBC8')(text);\n },\n },\n medium: {\n colorFunc(text) {\n return chalk.hex('#EDD55E')(text);\n },\n },\n high: {\n colorFunc(text) {\n return chalk.hex('#FF872F')(text);\n },\n },\n critical: {\n colorFunc(text) {\n return chalk.hex('#FF0B0B')(text);\n },\n },\n};\nexports.defaultSeverityColor = {\n colorFunc(text) {\n return chalk.grey(text);\n },\n};\nfunction getSeveritiesColour(severity) {\n var _a;\n return (_a = exports.severitiesColourMapping[severity]) !== null && _a !== void 0 ? _a : exports.defaultSeverityColor;\n}\nexports.getSeveritiesColour = getSeveritiesColour;\nfunction generateIssueSummary(resultsByPlugin, exceptions) {\n const testResults = getTestResults(resultsByPlugin, exceptions);\n const issueData = testResults.map((i) => i.issuesData);\n const bySeverity = issues_by_severity_1.getIssueCountBySeverity(issueData);\n const issuesBySeverityMessage = formatIssueCountBySeverity({\n critical: bySeverity.critical.length,\n high: bySeverity.high.length,\n medium: bySeverity.medium.length,\n low: bySeverity.low.length,\n });\n // can't use .flat() or .flatMap() because it's not supported in Node 10\n const issues = [];\n for (const result of testResults) {\n issues.push(...result.issues);\n }\n const totalIssueCount = total_issues_count_1.getTotalIssueCount(issueData);\n let totalIssues = '';\n if (totalIssueCount > 0) {\n totalIssues = `${chalk.bold(totalIssueCount)} issues\\n`;\n if (issuesBySeverityMessage) {\n totalIssues = `${chalk.bold(totalIssueCount)} issues: ${issuesBySeverityMessage}\\n`;\n }\n }\n const { count: fixableCount } = fixable_issues_1.hasFixableIssues(testResults);\n const fixableIssues = fixableCount > 0 ? `${chalk.bold(fixableCount)} issues are fixable\\n` : '';\n const fixedIssueCount = calculateFixedIssues(resultsByPlugin);\n const fixedIssuesSummary = fixedIssueCount > 0\n ? `${chalk.bold(fixedIssueCount)} issues were successfully fixed\\n`\n : '';\n return `\\n${exports.PADDING_SPACE}${totalIssues}${exports.PADDING_SPACE}${fixableIssues}${exports.PADDING_SPACE}${fixedIssuesSummary}`;\n}\nexports.generateIssueSummary = generateIssueSummary;\nfunction getTestResults(resultsByPlugin, exceptionsByScanType) {\n const testResults = [];\n for (const plugin of Object.keys(resultsByPlugin)) {\n const { skipped, failed, succeeded } = resultsByPlugin[plugin];\n testResults.push(...skipped.map((i) => i.original.testResult));\n testResults.push(...failed.map((i) => i.original.testResult));\n testResults.push(...succeeded.map((i) => i.original.testResult));\n }\n if (Object.keys(exceptionsByScanType).length) {\n for (const ecosystem of Object.keys(exceptionsByScanType)) {\n const unresolved = exceptionsByScanType[ecosystem];\n testResults.push(...unresolved.originals.map((i) => i.testResult));\n }\n }\n return testResults;\n}\nexports.getTestResults = getTestResults;\n//# sourceMappingURL=show-results-summary.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.partitionByVulnerable = void 0;\nfunction partitionByVulnerable(entities) {\n const vulnerable = [];\n const notVulnerable = [];\n for (const entity of entities) {\n const hasIssues = entity.testResult.issues.length > 0;\n if (hasIssues) {\n vulnerable.push(entity);\n }\n else {\n notVulnerable.push(entity);\n }\n }\n return { vulnerable, notVulnerable };\n}\nexports.partitionByVulnerable = partitionByVulnerable;\n//# sourceMappingURL=partition-by-vulnerable.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.loadPlugin = void 0;\nconst unsupported_type_error_1 = require(\"../lib/errors/unsupported-type-error\");\nconst python_1 = require(\"./python\");\nfunction loadPlugin(type) {\n switch (type) {\n case 'pip': {\n return python_1.pythonFix;\n }\n case 'poetry': {\n return python_1.pythonFix;\n }\n default: {\n throw new unsupported_type_error_1.UnsupportedTypeError(type);\n }\n }\n}\nexports.loadPlugin = loadPlugin;\n//# sourceMappingURL=load-plugin.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkPackageToolSupported = void 0;\nconst chalk = require(\"chalk\");\nconst pipenvPipfileFix = require(\"@snyk/fix-pipenv-pipfile\");\nconst poetryFix = require(\"@snyk/fix-poetry\");\nconst ora = require(\"ora\");\nconst supportFunc = {\n pipenv: {\n isInstalled: () => pipenvPipfileFix.isPipenvInstalled(),\n isSupportedVersion: (version) => pipenvPipfileFix.isPipenvSupportedVersion(version),\n },\n poetry: {\n isInstalled: () => poetryFix.isPoetryInstalled(),\n isSupportedVersion: (version) => poetryFix.isPoetrySupportedVersion(version),\n },\n};\nasync function checkPackageToolSupported(packageManager, options) {\n const { version } = await supportFunc[packageManager].isInstalled();\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n spinner.clear();\n spinner.text = `Checking ${packageManager} version`;\n spinner.indent = 2;\n spinner.start();\n if (!version) {\n spinner.stopAndPersist({\n text: chalk.hex('#EDD55E')(`Could not detect ${packageManager} version, proceeding anyway. Some operations may fail.`),\n symbol: chalk.hex('#EDD55E')('⚠️'),\n });\n return;\n }\n const { supported, versions } = supportFunc[packageManager].isSupportedVersion(version);\n if (!supported) {\n const spinnerMessage = ` ${version} ${packageManager} version detected. Currently the following ${packageManager} versions are supported: ${versions.join(',')}`;\n spinner.stopAndPersist({\n text: chalk.hex('#EDD55E')(spinnerMessage),\n symbol: chalk.hex('#EDD55E')('⚠️'),\n });\n }\n else {\n spinner.stop();\n }\n}\nexports.checkPackageToolSupported = checkPackageToolSupported;\n//# sourceMappingURL=package-tool-supported.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isRequirementsTxtManifest = exports.getHandlerType = void 0;\nconst pathLib = require(\"path\");\nconst supported_handler_types_1 = require(\"./supported-handler-types\");\nfunction getHandlerType(entity) {\n const targetFile = entity.scanResult.identity.targetFile;\n if (!targetFile) {\n return null;\n }\n const path = pathLib.parse(targetFile);\n if (isRequirementsTxtManifest(targetFile)) {\n return supported_handler_types_1.SUPPORTED_HANDLER_TYPES.REQUIREMENTS;\n }\n else if (['Pipfile'].includes(path.base)) {\n return supported_handler_types_1.SUPPORTED_HANDLER_TYPES.PIPFILE;\n }\n else if (['pyproject.toml', 'poetry.lock'].includes(path.base)) {\n return supported_handler_types_1.SUPPORTED_HANDLER_TYPES.POETRY;\n }\n return null;\n}\nexports.getHandlerType = getHandlerType;\nfunction isRequirementsTxtManifest(targetFile) {\n return targetFile.endsWith('.txt');\n}\nexports.isRequirementsTxtManifest = isRequirementsTxtManifest;\n//# sourceMappingURL=get-handler-type.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSuccessfulChange = exports.generateSuccessfulChanges = exports.generateFailedChanges = void 0;\nfunction generateFailedChanges(attemptedUpdates, pins, error, command) {\n const changes = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n if (!attemptedUpdates\n .map((update) => update.replace('==', '@'))\n .includes(pin.upgradeTo)) {\n continue;\n }\n const updatedMessage = pin.isTransitive ? 'pin' : 'upgrade';\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName, version] = pkgAtVersion.split('@');\n changes.push({\n success: false,\n reason: error.message,\n userMessage: `Failed to ${updatedMessage} ${pkgName} from ${version} to ${newVersion}`,\n tip: command ? `Try running \\`${command}\\`` : undefined,\n issueIds: pin.vulns,\n from: pkgAtVersion,\n to: `${pkgName}@${newVersion}`,\n });\n }\n return changes;\n}\nexports.generateFailedChanges = generateFailedChanges;\nfunction generateSuccessfulChanges(appliedUpgrades, pins) {\n const changes = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n if (!appliedUpgrades\n .map((upgrade) => upgrade.replace('==', '@'))\n .includes(pin.upgradeTo)) {\n continue;\n }\n const updatedMessage = pin.isTransitive ? 'Pinned' : 'Upgraded';\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName, version] = pkgAtVersion.split('@');\n changes.push({\n success: true,\n userMessage: `${updatedMessage} ${pkgName} from ${version} to ${newVersion}`,\n issueIds: pin.vulns,\n from: pkgAtVersion,\n to: `${pkgName}@${newVersion}`,\n });\n }\n return changes;\n}\nexports.generateSuccessfulChanges = generateSuccessfulChanges;\nfunction isSuccessfulChange(change) {\n return change.success === true;\n}\nexports.isSuccessfulChange = isSuccessfulChange;\n//# sourceMappingURL=attempted-changes-summary.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.failIfNoUpdatesApplied = void 0;\nconst debugLib = require(\"debug\");\nconst no_fixes_applied_1 = require(\"../../../lib/errors/no-fixes-applied\");\nconst attempted_changes_summary_1 = require(\"./attempted-changes-summary\");\nconst debug = debugLib('snyk-fix:python:ensure-changes-applied');\nfunction failIfNoUpdatesApplied(changes) {\n if (!changes.length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n }\n if (!changes.some((c) => attempted_changes_summary_1.isSuccessfulChange(c))) {\n debug('Manifest has not changed as no changes got applied!');\n // throw the first error tip since 100% failed, they all failed with the same\n // error\n const { reason, tip } = changes[0];\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError(reason, tip);\n }\n}\nexports.failIfNoUpdatesApplied = failIfNoUpdatesApplied;\n//# sourceMappingURL=fail-if-no-updates-applied.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.partitionByFixable = exports.isSupported = exports.projectTypeSupported = void 0;\nfunction projectTypeSupported(res) {\n return !('reason' in res);\n}\nexports.projectTypeSupported = projectTypeSupported;\nasync function isSupported(entity) {\n const remediationData = entity.testResult.remediation;\n if (!remediationData) {\n return { supported: false, reason: 'No remediation data available' };\n }\n if (!remediationData.pin || Object.keys(remediationData.pin).length === 0) {\n return {\n supported: false,\n reason: 'There is no actionable remediation to apply',\n };\n }\n return { supported: true };\n}\nexports.isSupported = isSupported;\nasync function partitionByFixable(entities) {\n const fixable = [];\n const skipped = [];\n for (const entity of entities) {\n const isSupportedResponse = await isSupported(entity);\n if (projectTypeSupported(isSupportedResponse)) {\n fixable.push(entity);\n continue;\n }\n skipped.push({\n original: entity,\n userMessage: isSupportedResponse.reason,\n });\n }\n return { fixable, skipped };\n}\nexports.partitionByFixable = partitionByFixable;\n//# sourceMappingURL=is-supported.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.containsRequireDirective = void 0;\n/* Requires like -r, -c are not supported at the moment, as multiple files\n * would have to be identified and fixed together\n * https://pip.pypa.io/en/stable/reference/pip_install/#options\n */\nasync function containsRequireDirective(requirementsTxt) {\n const allMatches = [];\n const REQUIRE_PATTERN = new RegExp(/^[^\\S\\n]*-(r|c)\\s+(.+)/, 'gm');\n const matches = getAllMatchedGroups(REQUIRE_PATTERN, requirementsTxt);\n for (const match of matches) {\n if (match && match.length > 1) {\n allMatches.push(match);\n }\n }\n return { containsRequire: allMatches.length > 0, matches: allMatches };\n}\nexports.containsRequireDirective = containsRequireDirective;\nfunction getAllMatchedGroups(re, str) {\n const groups = [];\n let match;\n while ((match = re.exec(str))) {\n groups.push(match);\n }\n return groups;\n}\n//# sourceMappingURL=contains-require-directive.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.extractProvenance = void 0;\nconst path = require(\"path\");\nconst debugLib = require(\"debug\");\nconst requirements_file_parser_1 = require(\"./update-dependencies/requirements-file-parser\");\nconst contains_require_directive_1 = require(\"./contains-require-directive\");\nconst debug = debugLib('snyk-fix:python:extract-version-provenance');\nasync function extractProvenance(workspace, rootDir, dir, fileName, provenance = {}) {\n const requirementsFileName = path.join(dir, fileName);\n const requirementsTxt = await workspace.readFile(requirementsFileName);\n // keep all provenance paths with `/` as a separator\n const relativeTargetFileName = path\n .normalize(path.relative(rootDir, requirementsFileName))\n .replace(path.sep, '/');\n provenance = {\n ...provenance,\n [relativeTargetFileName]: requirements_file_parser_1.parseRequirementsFile(requirementsTxt),\n };\n const { containsRequire, matches } = await contains_require_directive_1.containsRequireDirective(requirementsTxt);\n if (containsRequire) {\n for (const match of matches) {\n const requiredFilePath = match[2];\n if (provenance[requiredFilePath]) {\n debug('Detected recursive require directive, skipping');\n continue;\n }\n const { dir: requireDir, base } = path.parse(path.join(dir, requiredFilePath));\n provenance = {\n ...provenance,\n ...(await extractProvenance(workspace, rootDir, requireDir, base, provenance)),\n };\n }\n }\n return provenance;\n}\nexports.extractProvenance = extractProvenance;\n//# sourceMappingURL=extract-version-provenance.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.selectFileForPinning = exports.applyAllFixes = exports.fixIndividualRequirementsTxt = exports.pipRequirementsTxt = void 0;\nconst debugLib = require(\"debug\");\nconst pathLib = require(\"path\");\nconst sortBy = require('lodash.sortby');\nconst groupBy = require('lodash.groupby');\nconst update_dependencies_1 = require(\"./update-dependencies\");\nconst no_fixes_applied_1 = require(\"../../../../lib/errors/no-fixes-applied\");\nconst extract_version_provenance_1 = require(\"./extract-version-provenance\");\nconst requirements_file_parser_1 = require(\"./update-dependencies/requirements-file-parser\");\nconst standardize_package_name_1 = require(\"../../standardize-package-name\");\nconst contains_require_directive_1 = require(\"./contains-require-directive\");\nconst validate_required_data_1 = require(\"../validate-required-data\");\nconst format_display_name_1 = require(\"../../../../lib/output-formatters/format-display-name\");\nconst debug = debugLib('snyk-fix:python:requirements.txt');\nasync function pipRequirementsTxt(fixable, options) {\n debug(`Preparing to fix ${fixable.length} Python requirements.txt projects`);\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const ordered = sortByDirectory(fixable);\n let fixedFilesCache = {};\n for (const dir of Object.keys(ordered)) {\n debug(`Fixing entities in directory ${dir}`);\n const entitiesPerDirectory = ordered[dir].map((e) => e.entity);\n const { failed, succeeded, skipped, fixedCache } = await fixAll(entitiesPerDirectory, options, fixedFilesCache);\n fixedFilesCache = {\n ...fixedFilesCache,\n ...fixedCache,\n };\n handlerResult.succeeded.push(...succeeded);\n handlerResult.failed.push(...failed);\n handlerResult.skipped.push(...skipped);\n }\n return handlerResult;\n}\nexports.pipRequirementsTxt = pipRequirementsTxt;\nasync function fixAll(entities, options, fixedCache) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n for (const entity of entities) {\n const targetFile = entity.scanResult.identity.targetFile;\n try {\n const { dir, base } = pathLib.parse(targetFile);\n // parse & join again to support correct separator\n const filePath = pathLib.normalize(pathLib.join(dir, base));\n if (Object.keys(fixedCache).includes(pathLib.normalize(pathLib.join(dir, base)))) {\n handlerResult.succeeded.push({\n original: entity,\n changes: [\n {\n success: true,\n userMessage: `Fixed through ${format_display_name_1.formatDisplayName(entity.workspace.path, {\n type: entity.scanResult.identity.type,\n targetFile: fixedCache[filePath].fixedIn,\n })}`,\n issueIds: getFixedEntityIssues(fixedCache[filePath].issueIds, entity.testResult.issues),\n },\n ],\n });\n continue;\n }\n const { changes, fixedMeta } = await applyAllFixes(entity, options);\n if (!changes.length) {\n debug('Manifest has not changed!');\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n }\n // keep issues were successfully fixed unique across files that are part of the same project\n // the test result is for 1 entry entity.\n const uniqueIssueIds = new Set();\n for (const c of changes) {\n c.issueIds.map((i) => uniqueIssueIds.add(i));\n }\n Object.keys(fixedMeta).forEach((f) => {\n fixedCache[f] = {\n fixedIn: targetFile,\n issueIds: Array.from(uniqueIssueIds),\n };\n });\n handlerResult.succeeded.push({ original: entity, changes });\n }\n catch (e) {\n debug(`Failed to fix ${targetFile}.\\nERROR: ${e}`);\n handlerResult.failed.push({ original: entity, error: e });\n }\n }\n return { ...handlerResult, fixedCache };\n}\n// TODO: optionally verify the deps install\nasync function fixIndividualRequirementsTxt(workspace, dir, entryFileName, fileName, remediation, parsedRequirements, options, directUpgradesOnly) {\n const entryFilePath = pathLib.normalize(pathLib.join(dir, entryFileName));\n const fullFilePath = pathLib.normalize(pathLib.join(dir, fileName));\n const { updatedManifest, changes } = update_dependencies_1.updateDependencies(parsedRequirements, remediation.pin, directUpgradesOnly, entryFilePath !== fullFilePath\n ? format_display_name_1.formatDisplayName(workspace.path, {\n type: 'pip',\n targetFile: fullFilePath,\n })\n : undefined);\n if (!changes.length) {\n return { changes };\n }\n if (!options.dryRun) {\n debug('Writing changes to file');\n await workspace.writeFile(pathLib.join(dir, fileName), updatedManifest);\n }\n else {\n debug('Skipping writing changes to file in --dry-run mode');\n }\n return { changes };\n}\nexports.fixIndividualRequirementsTxt = fixIndividualRequirementsTxt;\nasync function applyAllFixes(entity, options) {\n const { remediation, targetFile: entryFileName, workspace, } = validate_required_data_1.validateRequiredData(entity);\n const fixedMeta = {};\n const { dir, base } = pathLib.parse(entryFileName);\n const provenance = await extract_version_provenance_1.extractProvenance(workspace, dir, dir, base);\n const upgradeChanges = [];\n /* Apply all upgrades first across all files that are included */\n for (const fileName of Object.keys(provenance)) {\n const skipApplyingPins = true;\n const { changes } = await fixIndividualRequirementsTxt(workspace, dir, base, fileName, remediation, provenance[fileName], options, skipApplyingPins);\n upgradeChanges.push(...changes);\n fixedMeta[pathLib.normalize(pathLib.join(dir, fileName))] = upgradeChanges;\n }\n /* Apply all left over remediation as pins in the entry targetFile */\n const toPin = filterOutAppliedUpgrades(remediation, upgradeChanges);\n const directUpgradesOnly = false;\n const fileForPinning = await selectFileForPinning(entity);\n const { changes: pinnedChanges } = await fixIndividualRequirementsTxt(workspace, dir, base, fileForPinning.fileName, toPin, requirements_file_parser_1.parseRequirementsFile(fileForPinning.fileContent), options, directUpgradesOnly);\n return { changes: [...upgradeChanges, ...pinnedChanges], fixedMeta };\n}\nexports.applyAllFixes = applyAllFixes;\nfunction filterOutAppliedUpgrades(remediation, upgradeChanges) {\n const pinRemediation = {\n ...remediation,\n pin: {},\n };\n const pins = remediation.pin;\n const normalizedAppliedRemediation = upgradeChanges\n .map((c) => {\n var _a;\n if (c.success && c.from) {\n const [pkgName, versionAndMore] = (_a = c.from) === null || _a === void 0 ? void 0 : _a.split('@');\n return `${standardize_package_name_1.standardizePackageName(pkgName)}@${versionAndMore}`;\n }\n return false;\n })\n .filter(Boolean);\n for (const pkgAtVersion of Object.keys(pins)) {\n const [pkgName, versionAndMore] = pkgAtVersion.split('@');\n if (!normalizedAppliedRemediation.includes(`${standardize_package_name_1.standardizePackageName(pkgName)}@${versionAndMore}`)) {\n pinRemediation.pin[pkgAtVersion] = pins[pkgAtVersion];\n }\n }\n return pinRemediation;\n}\nfunction sortByDirectory(entities) {\n const mapped = entities.map((e) => ({\n entity: e,\n ...pathLib.parse(e.scanResult.identity.targetFile),\n }));\n const sorted = sortBy(mapped, 'dir');\n return groupBy(sorted, 'dir');\n}\nasync function selectFileForPinning(entity) {\n const targetFile = entity.scanResult.identity.targetFile;\n const { dir, base } = pathLib.parse(targetFile);\n const { workspace } = entity;\n // default to adding pins in the scanned file\n let fileName = base;\n let requirementsTxt = await workspace.readFile(targetFile);\n const { containsRequire, matches } = await contains_require_directive_1.containsRequireDirective(requirementsTxt);\n const constraintsMatch = matches.filter((m) => m.includes('c'));\n if (containsRequire && constraintsMatch[0]) {\n // prefer to pin in constraints file if present\n fileName = constraintsMatch[0][2];\n requirementsTxt = await workspace.readFile(pathLib.join(dir, fileName));\n }\n return { fileContent: requirementsTxt, fileName };\n}\nexports.selectFileForPinning = selectFileForPinning;\nfunction getFixedEntityIssues(fixedIssueIds, issues) {\n const fixed = [];\n for (const { issueId } of issues) {\n if (fixedIssueIds.includes(issueId)) {\n fixed.push(issueId);\n }\n }\n return fixed;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.applyUpgrades = void 0;\nfunction applyUpgrades(originalRequirements, upgradedRequirements) {\n const updated = [];\n for (const requirement of originalRequirements) {\n const { originalText } = requirement;\n if (upgradedRequirements[originalText]) {\n updated.push(upgradedRequirements[originalText]);\n }\n else {\n updated.push(originalText);\n }\n }\n return updated;\n}\nexports.applyUpgrades = applyUpgrades;\n//# sourceMappingURL=apply-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.calculateRelevantFixes = void 0;\nconst is_defined_1 = require(\"./is-defined\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nfunction calculateRelevantFixes(requirements, updates, type) {\n const lowerCasedUpdates = {};\n const topLevelDeps = requirements.map(({ name }) => name).filter(is_defined_1.isDefined);\n Object.keys(updates).forEach((update) => {\n const { upgradeTo } = updates[update];\n const [pkgName] = update.split('@');\n const isTransitive = topLevelDeps.indexOf(standardize_package_name_1.standardizePackageName(pkgName)) < 0;\n if (type === 'transitive-pins' ? isTransitive : !isTransitive) {\n const [name, newVersion] = upgradeTo.split('@');\n lowerCasedUpdates[update] = {\n ...updates[update],\n upgradeTo: `${standardize_package_name_1.standardizePackageName(name)}@${newVersion}`,\n };\n }\n });\n return lowerCasedUpdates;\n}\nexports.calculateRelevantFixes = calculateRelevantFixes;\n//# sourceMappingURL=calculate-relevant-fixes.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generatePins = void 0;\nconst calculate_relevant_fixes_1 = require(\"./calculate-relevant-fixes\");\nconst is_defined_1 = require(\"./is-defined\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nfunction generatePins(requirements, updates, referenceFileInChanges) {\n // Lowercase the upgrades object. This might be overly defensive, given that\n // we control this input internally, but its a low cost guard rail. Outputs a\n // mapping of upgrade to -> from, instead of the nested upgradeTo object.\n const standardizedPins = calculate_relevant_fixes_1.calculateRelevantFixes(requirements, updates, 'transitive-pins');\n if (Object.keys(standardizedPins).length === 0) {\n return {\n pinnedRequirements: [],\n changes: [],\n };\n }\n const changes = [];\n const pinnedRequirements = Object.keys(standardizedPins)\n .map((pkgNameAtVersion) => {\n const [pkgName, version] = pkgNameAtVersion.split('@');\n const newVersion = standardizedPins[pkgNameAtVersion].upgradeTo.split('@')[1];\n const newRequirement = `${standardize_package_name_1.standardizePackageName(pkgName)}>=${newVersion}`;\n changes.push({\n from: `${pkgName}@${version}`,\n to: `${pkgName}@${newVersion}`,\n issueIds: standardizedPins[pkgNameAtVersion].vulns,\n success: true,\n userMessage: `Pinned ${standardize_package_name_1.standardizePackageName(pkgName)} from ${version} to ${newVersion}${referenceFileInChanges ? ` (pinned in ${referenceFileInChanges})` : ''}`,\n });\n return `${newRequirement} # not directly required, pinned by Snyk to avoid a vulnerability`;\n })\n .filter(is_defined_1.isDefined);\n return {\n pinnedRequirements,\n changes,\n };\n}\nexports.generatePins = generatePins;\n//# sourceMappingURL=generate-pins.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateUpgrades = void 0;\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst calculate_relevant_fixes_1 = require(\"./calculate-relevant-fixes\");\nfunction generateUpgrades(requirements, updates, referenceFileInChanges) {\n // Lowercase the upgrades object. This might be overly defensive, given that\n // we control this input internally, but its a low cost guard rail. Outputs a\n // mapping of upgrade to -> from, instead of the nested upgradeTo object.\n const normalizedUpgrades = calculate_relevant_fixes_1.calculateRelevantFixes(requirements, updates, 'direct-upgrades');\n if (Object.keys(normalizedUpgrades).length === 0) {\n return {\n updatedRequirements: {},\n changes: [],\n };\n }\n const changes = [];\n const updatedRequirements = {};\n requirements.map(({ name, originalName, versionComparator, version, originalText, extras, }) => {\n // Defensive patching; if any of these are undefined, return\n if (typeof name === 'undefined' ||\n typeof versionComparator === 'undefined' ||\n typeof version === 'undefined' ||\n originalText === '') {\n return;\n }\n // Check if we have an upgrade; if we do, replace the version string with\n // the upgrade, but keep the rest of the content\n const upgrade = Object.keys(normalizedUpgrades).filter((packageVersionUpgrade) => {\n const [pkgName, versionAndMore] = packageVersionUpgrade.split('@');\n return `${standardize_package_name_1.standardizePackageName(pkgName)}@${versionAndMore}`.startsWith(`${standardize_package_name_1.standardizePackageName(name)}@${version}`);\n })[0];\n if (!upgrade) {\n return;\n }\n const newVersion = normalizedUpgrades[upgrade].upgradeTo.split('@')[1];\n const updatedRequirement = `${originalName}${versionComparator}${newVersion}`;\n changes.push({\n issueIds: normalizedUpgrades[upgrade].vulns,\n from: `${originalName}@${version}`,\n to: `${originalName}@${newVersion}`,\n success: true,\n userMessage: `Upgraded ${originalName} from ${version} to ${newVersion}${referenceFileInChanges\n ? ` (upgraded in ${referenceFileInChanges})`\n : ''}`,\n });\n updatedRequirements[originalText] = `${updatedRequirement}${extras ? extras : ''}`;\n });\n return {\n updatedRequirements,\n changes,\n };\n}\nexports.generateUpgrades = generateUpgrades;\n//# sourceMappingURL=generate-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateDependencies = void 0;\nconst debugLib = require(\"debug\");\nconst generate_pins_1 = require(\"./generate-pins\");\nconst apply_upgrades_1 = require(\"./apply-upgrades\");\nconst generate_upgrades_1 = require(\"./generate-upgrades\");\nconst failed_to_parse_manifest_1 = require(\"../../../../../lib/errors/failed-to-parse-manifest\");\nconst debug = debugLib('snyk-fix:python:update-dependencies');\n/*\n * Given contents of manifest file(s) and a set of upgrades, apply the given\n * upgrades to a manifest and return the upgraded manifest.\n *\n * Currently only supported for `requirements.txt` - at least one file named\n * `requirements.txt` must be in the manifests.\n */\nfunction updateDependencies(parsedRequirementsData, updates, directUpgradesOnly = false, referenceFileInChanges) {\n const { requirements, endsWithNewLine: shouldEndWithNewLine, } = parsedRequirementsData;\n if (!requirements.length) {\n debug('Error: Expected to receive parsed manifest data. Is manifest empty?');\n throw new failed_to_parse_manifest_1.FailedToParseManifest();\n }\n debug('Finished parsing manifest');\n const { updatedRequirements, changes: upgradedChanges } = generate_upgrades_1.generateUpgrades(requirements, updates, referenceFileInChanges);\n debug('Finished generating upgrades to apply');\n let pinnedRequirements = [];\n let pinChanges = [];\n if (!directUpgradesOnly) {\n ({ pinnedRequirements, changes: pinChanges } = generate_pins_1.generatePins(requirements, updates, referenceFileInChanges));\n debug('Finished generating pins to apply');\n }\n let updatedManifest = [\n ...apply_upgrades_1.applyUpgrades(requirements, updatedRequirements),\n ...pinnedRequirements,\n ].join('\\n');\n // This is a bit of a hack, but an easy one to follow. If a file ends with a\n // new line, ensure we keep it this way. Don't hijack customers formatting.\n if (shouldEndWithNewLine) {\n updatedManifest += '\\n';\n }\n debug('Finished applying changes to manifest');\n return {\n updatedManifest,\n changes: [...pinChanges, ...upgradedChanges],\n };\n}\nexports.updateDependencies = updateDependencies;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isDefined = void 0;\n// TS is not capable of determining when Array.filter has removed undefined\n// values without a manual Type Guard, so thats what this does\nfunction isDefined(t) {\n return typeof t !== 'undefined';\n}\nexports.isDefined = isDefined;\n//# sourceMappingURL=is-defined.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseRequirementsFile = void 0;\nconst debugLib = require(\"debug\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst debug = debugLib('snyk-fix:python:requirements-file-parser');\nfunction parseRequirementsFile(requirementsFile) {\n const endsWithNewLine = requirementsFile.endsWith('\\n');\n const lines = requirementsFile.replace(/\\n$/, '').split('\\n');\n const requirements = [];\n lines.map((requirementText, line) => {\n const requirement = extractDependencyDataFromLine(requirementText, line);\n if (requirement) {\n requirements.push(requirement);\n }\n });\n return { requirements, endsWithNewLine };\n}\nexports.parseRequirementsFile = parseRequirementsFile;\nfunction extractDependencyDataFromLine(requirementText, line) {\n try {\n const requirement = { originalText: requirementText, line };\n const trimmedText = requirementText.trim();\n // Quick returns for cases we cannot remediate\n // - Empty line i.e. ''\n // - 'editable' packages i.e. '-e git://git.myproject.org/MyProject.git#egg=MyProject'\n // - Comments i.e. # This is a comment\n // - Local files i.e. file:../../lib/project#egg=MyProject\n if (requirementText === '' ||\n trimmedText.startsWith('-e') ||\n trimmedText.startsWith('#') ||\n trimmedText.startsWith('file:')) {\n return requirement;\n }\n // Regex to match against a Python package specifier. Any invalid lines (or\n // lines we can't handle) should have been returned this point.\n const regex = /([A-Z0-9-._]*)(!=|===|==|>=|<=|>|<|~=)(\\d*\\.?\\d*\\.?\\d*[A-Z0-9]*)(.*)/i;\n const result = regex.exec(requirementText);\n if (result !== null) {\n requirement.name = standardize_package_name_1.standardizePackageName(result[1]);\n requirement.originalName = result[1];\n requirement.versionComparator = result[2];\n requirement.version = result[3];\n requirement.extras = result[4];\n }\n if (!(requirement.version && requirement.name)) {\n throw new Error('Failed to extract dependency data');\n }\n return requirement;\n }\n catch (err) {\n debug({ error: err.message, requirementText, line }, 'failed to parse requirement');\n return { originalText: requirementText, line };\n }\n}\n//# sourceMappingURL=requirements-file-parser.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pipenvPipfile = void 0;\nconst debugLib = require(\"debug\");\nconst ora = require(\"ora\");\nconst package_tool_supported_1 = require(\"../../../package-tool-supported\");\nconst update_dependencies_1 = require(\"./update-dependencies\");\nconst debug = debugLib('snyk-fix:python:Pipfile');\nasync function pipenvPipfile(fixable, options) {\n debug(`Preparing to fix ${fixable.length} Python Pipfile projects`);\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n await package_tool_supported_1.checkPackageToolSupported('pipenv', options);\n for (const [index, entity] of fixable.entries()) {\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n const spinnerMessage = `Fixing Pipfile ${index + 1}/${fixable.length}`;\n spinner.text = spinnerMessage;\n spinner.start();\n const { failed, succeeded, skipped } = await update_dependencies_1.updateDependencies(entity, options);\n handlerResult.succeeded.push(...succeeded);\n handlerResult.failed.push(...failed);\n handlerResult.skipped.push(...skipped);\n spinner.stop();\n }\n return handlerResult;\n}\nexports.pipenvPipfile = pipenvPipfile;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateUpgrades = void 0;\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nfunction generateUpgrades(entity) {\n const { remediation } = validate_required_data_1.validateRequiredData(entity);\n const { pin: pins } = remediation;\n const upgrades = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName] = pkgAtVersion.split('@');\n upgrades.push(`${standardize_package_name_1.standardizePackageName(pkgName)}==${newVersion}`);\n }\n return { upgrades };\n}\nexports.generateUpgrades = generateUpgrades;\n//# sourceMappingURL=generate-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateDependencies = void 0;\nconst debugLib = require(\"debug\");\nconst fail_if_no_updates_applied_1 = require(\"../../fail-if-no-updates-applied\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nconst generate_upgrades_1 = require(\"./generate-upgrades\");\nconst pipenv_add_1 = require(\"./pipenv-add\");\nconst debug = debugLib('snyk-fix:python:Pipfile');\nfunction chooseFixStrategy(options) {\n return options.sequentialFix ? fixSequentially : fixAll;\n}\nasync function updateDependencies(entity, options) {\n const handlerResult = await chooseFixStrategy(options)(entity, options);\n return handlerResult;\n}\nexports.updateDependencies = updateDependencies;\nasync function fixAll(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const changes = [];\n try {\n const { upgrades } = await generate_upgrades_1.generateUpgrades(entity);\n if (!upgrades.length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n // Currently this is not possible as there is no Pipfile parser that would do this.\n // update prod dependencies first\n if (upgrades.length) {\n changes.push(...(await pipenv_add_1.pipenvAdd(entity, options, upgrades)));\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n error,\n tip: error.tip,\n });\n }\n return handlerResult;\n}\nasync function fixSequentially(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const { upgrades } = await generate_upgrades_1.generateUpgrades(entity);\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n // at the moment we do not parse Pipfile and therefore can't tell the difference\n // between prod & dev updates\n const changes = [];\n try {\n if (!upgrades.length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // update prod dependencies first\n if (upgrades.length) {\n for (const upgrade of upgrades) {\n changes.push(...(await pipenv_add_1.pipenvAdd(entity, options, [upgrade])));\n }\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n tip: error.tip,\n error,\n });\n }\n return handlerResult;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pipenvAdd = void 0;\nconst pathLib = require(\"path\");\nconst pipenvPipfileFix = require(\"@snyk/fix-pipenv-pipfile\");\nconst debugLib = require(\"debug\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nconst attempted_changes_summary_1 = require(\"../../attempted-changes-summary\");\nconst command_failed_to_run_error_1 = require(\"../../../../../lib/errors/command-failed-to-run-error\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nconst debug = debugLib('snyk-fix:python:pipenvAdd');\nasync function pipenvAdd(entity, options, upgrades) {\n const changes = [];\n let pipenvCommand;\n const { remediation, targetFile } = validate_required_data_1.validateRequiredData(entity);\n try {\n const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);\n const { dir } = pathLib.parse(targetFilePath);\n if (!options.dryRun && upgrades.length) {\n const { stderr, stdout, command, exitCode, } = await pipenvPipfileFix.pipenvInstall(dir, upgrades, {\n python: entity.options.command,\n });\n debug('`pipenv add` returned:', { stderr, stdout, command });\n if (exitCode !== 0) {\n pipenvCommand = command;\n throwPipenvError(stderr, stdout, command);\n }\n }\n changes.push(...attempted_changes_summary_1.generateSuccessfulChanges(upgrades, remediation.pin));\n }\n catch (error) {\n changes.push(...attempted_changes_summary_1.generateFailedChanges(upgrades, remediation.pin, error, pipenvCommand));\n }\n return changes;\n}\nexports.pipenvAdd = pipenvAdd;\nfunction throwPipenvError(stderr, stdout, command) {\n const incompatibleDeps = 'There are incompatible versions in the resolved dependencies';\n const lockingFailed = 'Locking failed';\n const versionNotFound = 'Could not find a version that matches';\n const errorsToBubbleUp = [incompatibleDeps, lockingFailed, versionNotFound];\n for (const error of errorsToBubbleUp) {\n if (stderr.toLowerCase().includes(error.toLowerCase()) ||\n stdout.toLowerCase().includes(error.toLowerCase())) {\n throw new command_failed_to_run_error_1.CommandFailedError(error, command);\n }\n }\n const SOLVER_PROBLEM = /SolverProblemError(.* version solving failed)/gms;\n const solverProblemError = SOLVER_PROBLEM.exec(stderr) || SOLVER_PROBLEM.exec(stdout);\n if (solverProblemError) {\n throw new command_failed_to_run_error_1.CommandFailedError(solverProblemError[0].trim(), command);\n }\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n}\n//# sourceMappingURL=pipenv-add.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.poetry = void 0;\nconst debugLib = require(\"debug\");\nconst ora = require(\"ora\");\nconst package_tool_supported_1 = require(\"../../../package-tool-supported\");\nconst update_dependencies_1 = require(\"./update-dependencies\");\nconst debug = debugLib('snyk-fix:python:Poetry');\nasync function poetry(fixable, options) {\n debug(`Preparing to fix ${fixable.length} Python Poetry projects`);\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n await package_tool_supported_1.checkPackageToolSupported('poetry', options);\n for (const [index, entity] of fixable.entries()) {\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n const spinnerMessage = `Fixing pyproject.toml ${index + 1}/${fixable.length}`;\n spinner.text = spinnerMessage;\n spinner.start();\n const { failed, succeeded, skipped } = await update_dependencies_1.updateDependencies(entity, options);\n handlerResult.succeeded.push(...succeeded);\n handlerResult.failed.push(...failed);\n handlerResult.skipped.push(...skipped);\n spinner.stop();\n }\n return handlerResult;\n}\nexports.poetry = poetry;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateUpgrades = void 0;\nconst pathLib = require(\"path\");\nconst toml = require(\"toml\");\nconst debugLib = require(\"debug\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nconst standardize_package_name_1 = require(\"../../../standardize-package-name\");\nconst debug = debugLib('snyk-fix:python:Poetry');\nasync function generateUpgrades(entity) {\n var _a, _b;\n const { remediation, targetFile } = validate_required_data_1.validateRequiredData(entity);\n const pins = remediation.pin;\n const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);\n const { dir } = pathLib.parse(targetFilePath);\n const pyProjectTomlRaw = await entity.workspace.readFile(pathLib.resolve(dir, 'pyproject.toml'));\n const pyProjectToml = toml.parse(pyProjectTomlRaw);\n const prodTopLevelDeps = Object.keys((_a = pyProjectToml.tool.poetry.dependencies) !== null && _a !== void 0 ? _a : {}).map((dep) => standardize_package_name_1.standardizePackageName(dep));\n const devTopLevelDeps = Object.keys((_b = pyProjectToml.tool.poetry['dev-dependencies']) !== null && _b !== void 0 ? _b : {}).map((dep) => standardize_package_name_1.standardizePackageName(dep));\n const upgrades = [];\n const devUpgrades = [];\n for (const pkgAtVersion of Object.keys(pins)) {\n const pin = pins[pkgAtVersion];\n const newVersion = pin.upgradeTo.split('@')[1];\n const [pkgName] = pkgAtVersion.split('@');\n const upgrade = `${standardize_package_name_1.standardizePackageName(pkgName)}==${newVersion}`;\n if (pin.isTransitive || prodTopLevelDeps.includes(pkgName)) {\n // transitive and it could have come from a dev or prod dep\n // since we can't tell right now let be pinned into production deps\n upgrades.push(upgrade);\n }\n else if (prodTopLevelDeps.includes(pkgName)) {\n upgrades.push(upgrade);\n }\n else if (entity.options.dev && devTopLevelDeps.includes(pkgName)) {\n devUpgrades.push(upgrade);\n }\n else {\n debug(`Could not determine what type of upgrade ${upgrade} is. When choosing between: transitive upgrade, production or dev direct upgrade. `);\n }\n }\n return { upgrades, devUpgrades };\n}\nexports.generateUpgrades = generateUpgrades;\n//# sourceMappingURL=generate-upgrades.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateDependencies = void 0;\nconst debugLib = require(\"debug\");\nconst generate_upgrades_1 = require(\"./generate-upgrades\");\nconst poetry_add_1 = require(\"./poetry-add\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nconst fail_if_no_updates_applied_1 = require(\"../../fail-if-no-updates-applied\");\nconst debug = debugLib('snyk-fix:python:Poetry');\nfunction chooseFixStrategy(options) {\n return options.sequentialFix ? fixSequentially : fixAll;\n}\nasync function updateDependencies(entity, options) {\n const handlerResult = await chooseFixStrategy(options)(entity, options);\n return handlerResult;\n}\nexports.updateDependencies = updateDependencies;\nasync function fixAll(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const { upgrades, devUpgrades } = await generate_upgrades_1.generateUpgrades(entity);\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n const changes = [];\n try {\n if (![...upgrades, ...devUpgrades].length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // update prod dependencies first\n if (upgrades.length) {\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, upgrades)));\n }\n // update dev dependencies second\n if (devUpgrades.length) {\n const installDev = true;\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, devUpgrades, installDev)));\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n tip: error.tip,\n error,\n });\n }\n return handlerResult;\n}\nasync function fixSequentially(entity, options) {\n const handlerResult = {\n succeeded: [],\n failed: [],\n skipped: [],\n };\n const { upgrades, devUpgrades } = await generate_upgrades_1.generateUpgrades(entity);\n // TODO: for better support we need to:\n // 1. parse the manifest and extract original requirements, version spec etc\n // 2. swap out only the version and retain original spec\n // 3. re-lock the lockfile\n const changes = [];\n try {\n if (![...upgrades, ...devUpgrades].length) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError('Failed to calculate package updates to apply');\n }\n // update prod dependencies first\n if (upgrades.length) {\n for (const upgrade of upgrades) {\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, [upgrade])));\n }\n }\n // update dev dependencies second\n if (devUpgrades.length) {\n for (const upgrade of devUpgrades) {\n const installDev = true;\n changes.push(...(await poetry_add_1.poetryAdd(entity, options, [upgrade], installDev)));\n }\n }\n fail_if_no_updates_applied_1.failIfNoUpdatesApplied(changes);\n handlerResult.succeeded.push({\n original: entity,\n changes,\n });\n }\n catch (error) {\n debug(`Failed to fix ${entity.scanResult.identity.targetFile}.\\nERROR: ${error}`);\n handlerResult.failed.push({\n original: entity,\n tip: error.tip,\n error,\n });\n }\n return handlerResult;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.poetryAdd = void 0;\nconst pathLib = require(\"path\");\nconst debugLib = require(\"debug\");\nconst poetryFix = require(\"@snyk/fix-poetry\");\nconst validate_required_data_1 = require(\"../../validate-required-data\");\nconst attempted_changes_summary_1 = require(\"../../attempted-changes-summary\");\nconst command_failed_to_run_error_1 = require(\"../../../../../lib/errors/command-failed-to-run-error\");\nconst no_fixes_applied_1 = require(\"../../../../../lib/errors/no-fixes-applied\");\nconst debug = debugLib('snyk-fix:python:poetryAdd');\nasync function poetryAdd(entity, options, upgrades, dev) {\n var _a;\n const changes = [];\n let poetryCommand;\n const { remediation, targetFile } = validate_required_data_1.validateRequiredData(entity);\n try {\n const targetFilePath = pathLib.resolve(entity.workspace.path, targetFile);\n const { dir } = pathLib.parse(targetFilePath);\n if (!options.dryRun && upgrades.length) {\n const { stderr, stdout, command, exitCode } = await poetryFix.poetryAdd(dir, upgrades, {\n dev,\n python: (_a = entity.options.command) !== null && _a !== void 0 ? _a : undefined,\n });\n debug('`poetry add` returned:', { stderr, stdout, command });\n if (exitCode !== 0) {\n poetryCommand = command;\n throwPoetryError(stderr, stdout, command);\n }\n }\n changes.push(...attempted_changes_summary_1.generateSuccessfulChanges(upgrades, remediation.pin));\n }\n catch (error) {\n changes.push(...attempted_changes_summary_1.generateFailedChanges(upgrades, remediation.pin, error, poetryCommand));\n }\n return changes;\n}\nexports.poetryAdd = poetryAdd;\nfunction throwPoetryError(stderr, stdout, command) {\n const ALREADY_UP_TO_DATE = 'No dependencies to install or update';\n const INCOMPATIBLE_PYTHON = new RegExp(/Python requirement (.*) is not compatible/g, 'gm');\n const SOLVER_PROBLEM = /SolverProblemError(.* version solving failed)/gms;\n const incompatiblePythonError = INCOMPATIBLE_PYTHON.exec(stderr) || SOLVER_PROBLEM.exec(stdout);\n if (incompatiblePythonError) {\n throw new command_failed_to_run_error_1.CommandFailedError(`The current project's Python requirement ${incompatiblePythonError[1]} is not compatible with some of the required packages`, command);\n }\n const solverProblemError = SOLVER_PROBLEM.exec(stderr) || SOLVER_PROBLEM.exec(stdout);\n if (solverProblemError) {\n throw new command_failed_to_run_error_1.CommandFailedError(solverProblemError[0].trim(), command);\n }\n if (stderr.includes(ALREADY_UP_TO_DATE) ||\n stdout.includes(ALREADY_UP_TO_DATE)) {\n throw new command_failed_to_run_error_1.CommandFailedError('No dependencies could be updated as they seem to be at the correct versions. Make sure installed dependencies in the environment match those in the lockfile by running `poetry update`', command);\n }\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n}\n//# sourceMappingURL=poetry-add.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateRequiredData = void 0;\nconst missing_remediation_data_1 = require(\"../../../lib/errors/missing-remediation-data\");\nconst missing_file_name_1 = require(\"../../../lib/errors/missing-file-name\");\nconst no_fixes_applied_1 = require(\"../../../lib/errors/no-fixes-applied\");\nfunction validateRequiredData(entity) {\n const { remediation } = entity.testResult;\n if (!remediation) {\n throw new missing_remediation_data_1.MissingRemediationDataError();\n }\n const { targetFile } = entity.scanResult.identity;\n if (!targetFile) {\n throw new missing_file_name_1.MissingFileNameError();\n }\n const { workspace } = entity;\n if (!workspace) {\n throw new no_fixes_applied_1.NoFixesCouldBeAppliedError();\n }\n return { targetFile, remediation, workspace };\n}\nexports.validateRequiredData = validateRequiredData;\n//# sourceMappingURL=validate-required-data.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pythonFix = void 0;\nconst debugLib = require(\"debug\");\nconst pMap = require(\"p-map\");\nconst ora = require(\"ora\");\nconst load_handler_1 = require(\"./load-handler\");\nconst map_entities_per_handler_type_1 = require(\"./map-entities-per-handler-type\");\nconst chalk = require(\"chalk\");\nconst is_supported_1 = require(\"./handlers/is-supported\");\nconst debug = debugLib('snyk-fix:python');\nasync function pythonFix(entities, options) {\n const spinner = ora({ isSilent: options.quiet, stream: process.stdout });\n const spinnerMessage = 'Looking for supported Python items';\n spinner.text = spinnerMessage;\n spinner.start();\n const handlerResult = {\n python: {\n succeeded: [],\n failed: [],\n skipped: [],\n },\n };\n const results = handlerResult.python;\n const { entitiesPerType, skipped: notSupported } = map_entities_per_handler_type_1.mapEntitiesPerHandlerType(entities);\n results.skipped.push(...notSupported);\n spinner.stopAndPersist({\n text: spinnerMessage,\n symbol: chalk.green('\\n✔'),\n });\n await pMap(Object.keys(entitiesPerType), async (projectType) => {\n const projectsToFix = entitiesPerType[projectType];\n if (!projectsToFix.length) {\n return;\n }\n const processingMessage = `Processing ${projectsToFix.length} ${projectType} items`;\n const processedMessage = `Processed ${projectsToFix.length} ${projectType} items`;\n spinner.text = processingMessage;\n spinner.render();\n try {\n const handler = load_handler_1.loadHandler(projectType);\n // drop unsupported Python entities early so only potentially fixable items get\n // attempted to be fixed\n const { fixable, skipped: notFixable } = await is_supported_1.partitionByFixable(projectsToFix);\n results.skipped.push(...notFixable);\n const { failed, skipped, succeeded } = await handler(fixable, options);\n results.failed.push(...failed);\n results.skipped.push(...skipped);\n results.succeeded.push(...succeeded);\n }\n catch (e) {\n debug(`Failed to fix ${projectsToFix.length} ${projectType} projects.\\nError: ${e.message}`);\n results.failed.push(...projectsToFix.map((p) => ({ original: p, error: e })));\n }\n spinner.stopAndPersist({\n text: processedMessage,\n symbol: chalk.green('✔'),\n });\n }, {\n concurrency: 5,\n });\n return handlerResult;\n}\nexports.pythonFix = pythonFix;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.loadHandler = void 0;\nconst pip_requirements_1 = require(\"./handlers/pip-requirements\");\nconst pipenv_pipfile_1 = require(\"./handlers/pipenv-pipfile\");\nconst poetry_1 = require(\"./handlers/poetry\");\nconst supported_handler_types_1 = require(\"./supported-handler-types\");\nfunction loadHandler(type) {\n switch (type) {\n case supported_handler_types_1.SUPPORTED_HANDLER_TYPES.REQUIREMENTS: {\n return pip_requirements_1.pipRequirementsTxt;\n }\n case supported_handler_types_1.SUPPORTED_HANDLER_TYPES.PIPFILE: {\n return pipenv_pipfile_1.pipenvPipfile;\n }\n case supported_handler_types_1.SUPPORTED_HANDLER_TYPES.POETRY: {\n return poetry_1.poetry;\n }\n default: {\n throw new Error('No handler available for requested project type');\n }\n }\n}\nexports.loadHandler = loadHandler;\n//# sourceMappingURL=load-handler.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.mapEntitiesPerHandlerType = void 0;\nconst debugLib = require(\"debug\");\nconst get_handler_type_1 = require(\"./get-handler-type\");\nconst supported_handler_types_1 = require(\"./supported-handler-types\");\nconst debug = debugLib('snyk-fix:python');\nfunction mapEntitiesPerHandlerType(entities) {\n const entitiesPerType = {\n [supported_handler_types_1.SUPPORTED_HANDLER_TYPES.REQUIREMENTS]: [],\n [supported_handler_types_1.SUPPORTED_HANDLER_TYPES.PIPFILE]: [],\n [supported_handler_types_1.SUPPORTED_HANDLER_TYPES.POETRY]: [],\n };\n const skipped = [];\n for (const entity of entities) {\n const type = get_handler_type_1.getHandlerType(entity);\n if (type) {\n entitiesPerType[type].push(entity);\n continue;\n }\n const userMessage = `${entity.scanResult.identity.targetFile} is not supported`;\n debug(userMessage);\n skipped.push({ original: entity, userMessage });\n }\n return { entitiesPerType, skipped };\n}\nexports.mapEntitiesPerHandlerType = mapEntitiesPerHandlerType;\n//# sourceMappingURL=map-entities-per-handler-type.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.standardizePackageName = void 0;\n/*\n * https://www.python.org/dev/peps/pep-0426/#name\n * All comparisons of distribution names MUST be case insensitive,\n * and MUST consider hyphens and underscores to be equivalent.\n *\n */\nfunction standardizePackageName(name) {\n return name.replace('_', '-').toLowerCase();\n}\nexports.standardizePackageName = standardizePackageName;\n//# sourceMappingURL=standardize-package-name.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SUPPORTED_HANDLER_TYPES = void 0;\nvar SUPPORTED_HANDLER_TYPES;\n(function (SUPPORTED_HANDLER_TYPES) {\n // shortname = display name\n SUPPORTED_HANDLER_TYPES[\"REQUIREMENTS\"] = \"requirements.txt\";\n SUPPORTED_HANDLER_TYPES[\"PIPFILE\"] = \"Pipfile\";\n SUPPORTED_HANDLER_TYPES[\"POETRY\"] = \"pyproject.toml\";\n})(SUPPORTED_HANDLER_TYPES = exports.SUPPORTED_HANDLER_TYPES || (exports.SUPPORTED_HANDLER_TYPES = {}));\n//# sourceMappingURL=supported-handler-types.js.map"],"names":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snyk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.720.0",
|
|
4
4
|
"description": "snyk library and cli utility",
|
|
5
5
|
"files": [
|
|
6
6
|
"help",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"registry": "https://registry.npmjs.org/",
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "50c67c8314aade6932e5a523ac6daf18b1780977"
|
|
92
92
|
}
|