@coana-tech/cli 14.12.0 → 14.12.1
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/cli.mjs +258 -138
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +101 -30
- package/repos/coana-tech/alucard/alucard.jar +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
package/cli.mjs
CHANGED
|
@@ -6151,7 +6151,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
6151
6151
|
return circularValue;
|
|
6152
6152
|
}
|
|
6153
6153
|
let res = "";
|
|
6154
|
-
let
|
|
6154
|
+
let join27 = ",";
|
|
6155
6155
|
const originalIndentation = indentation;
|
|
6156
6156
|
if (Array.isArray(value)) {
|
|
6157
6157
|
if (value.length === 0) {
|
|
@@ -6165,7 +6165,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
6165
6165
|
indentation += spacer;
|
|
6166
6166
|
res += `
|
|
6167
6167
|
${indentation}`;
|
|
6168
|
-
|
|
6168
|
+
join27 = `,
|
|
6169
6169
|
${indentation}`;
|
|
6170
6170
|
}
|
|
6171
6171
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -6173,13 +6173,13 @@ ${indentation}`;
|
|
|
6173
6173
|
for (; i6 < maximumValuesToStringify - 1; i6++) {
|
|
6174
6174
|
const tmp2 = stringifyFnReplacer(String(i6), value, stack2, replacer, spacer, indentation);
|
|
6175
6175
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
6176
|
-
res +=
|
|
6176
|
+
res += join27;
|
|
6177
6177
|
}
|
|
6178
6178
|
const tmp = stringifyFnReplacer(String(i6), value, stack2, replacer, spacer, indentation);
|
|
6179
6179
|
res += tmp !== void 0 ? tmp : "null";
|
|
6180
6180
|
if (value.length - 1 > maximumBreadth) {
|
|
6181
6181
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
6182
|
-
res += `${
|
|
6182
|
+
res += `${join27}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
6183
6183
|
}
|
|
6184
6184
|
if (spacer !== "") {
|
|
6185
6185
|
res += `
|
|
@@ -6200,7 +6200,7 @@ ${originalIndentation}`;
|
|
|
6200
6200
|
let separator = "";
|
|
6201
6201
|
if (spacer !== "") {
|
|
6202
6202
|
indentation += spacer;
|
|
6203
|
-
|
|
6203
|
+
join27 = `,
|
|
6204
6204
|
${indentation}`;
|
|
6205
6205
|
whitespace2 = " ";
|
|
6206
6206
|
}
|
|
@@ -6214,13 +6214,13 @@ ${indentation}`;
|
|
|
6214
6214
|
const tmp = stringifyFnReplacer(key2, value, stack2, replacer, spacer, indentation);
|
|
6215
6215
|
if (tmp !== void 0) {
|
|
6216
6216
|
res += `${separator}${strEscape(key2)}:${whitespace2}${tmp}`;
|
|
6217
|
-
separator =
|
|
6217
|
+
separator = join27;
|
|
6218
6218
|
}
|
|
6219
6219
|
}
|
|
6220
6220
|
if (keyLength > maximumBreadth) {
|
|
6221
6221
|
const removedKeys = keyLength - maximumBreadth;
|
|
6222
6222
|
res += `${separator}"...":${whitespace2}"${getItemCount(removedKeys)} not stringified"`;
|
|
6223
|
-
separator =
|
|
6223
|
+
separator = join27;
|
|
6224
6224
|
}
|
|
6225
6225
|
if (spacer !== "" && separator.length > 1) {
|
|
6226
6226
|
res = `
|
|
@@ -6261,7 +6261,7 @@ ${originalIndentation}`;
|
|
|
6261
6261
|
}
|
|
6262
6262
|
const originalIndentation = indentation;
|
|
6263
6263
|
let res = "";
|
|
6264
|
-
let
|
|
6264
|
+
let join27 = ",";
|
|
6265
6265
|
if (Array.isArray(value)) {
|
|
6266
6266
|
if (value.length === 0) {
|
|
6267
6267
|
return "[]";
|
|
@@ -6274,7 +6274,7 @@ ${originalIndentation}`;
|
|
|
6274
6274
|
indentation += spacer;
|
|
6275
6275
|
res += `
|
|
6276
6276
|
${indentation}`;
|
|
6277
|
-
|
|
6277
|
+
join27 = `,
|
|
6278
6278
|
${indentation}`;
|
|
6279
6279
|
}
|
|
6280
6280
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -6282,13 +6282,13 @@ ${indentation}`;
|
|
|
6282
6282
|
for (; i6 < maximumValuesToStringify - 1; i6++) {
|
|
6283
6283
|
const tmp2 = stringifyArrayReplacer(String(i6), value[i6], stack2, replacer, spacer, indentation);
|
|
6284
6284
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
6285
|
-
res +=
|
|
6285
|
+
res += join27;
|
|
6286
6286
|
}
|
|
6287
6287
|
const tmp = stringifyArrayReplacer(String(i6), value[i6], stack2, replacer, spacer, indentation);
|
|
6288
6288
|
res += tmp !== void 0 ? tmp : "null";
|
|
6289
6289
|
if (value.length - 1 > maximumBreadth) {
|
|
6290
6290
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
6291
|
-
res += `${
|
|
6291
|
+
res += `${join27}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
6292
6292
|
}
|
|
6293
6293
|
if (spacer !== "") {
|
|
6294
6294
|
res += `
|
|
@@ -6301,7 +6301,7 @@ ${originalIndentation}`;
|
|
|
6301
6301
|
let whitespace2 = "";
|
|
6302
6302
|
if (spacer !== "") {
|
|
6303
6303
|
indentation += spacer;
|
|
6304
|
-
|
|
6304
|
+
join27 = `,
|
|
6305
6305
|
${indentation}`;
|
|
6306
6306
|
whitespace2 = " ";
|
|
6307
6307
|
}
|
|
@@ -6310,7 +6310,7 @@ ${indentation}`;
|
|
|
6310
6310
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack2, replacer, spacer, indentation);
|
|
6311
6311
|
if (tmp !== void 0) {
|
|
6312
6312
|
res += `${separator}${strEscape(key2)}:${whitespace2}${tmp}`;
|
|
6313
|
-
separator =
|
|
6313
|
+
separator = join27;
|
|
6314
6314
|
}
|
|
6315
6315
|
}
|
|
6316
6316
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -6368,20 +6368,20 @@ ${originalIndentation}`;
|
|
|
6368
6368
|
indentation += spacer;
|
|
6369
6369
|
let res2 = `
|
|
6370
6370
|
${indentation}`;
|
|
6371
|
-
const
|
|
6371
|
+
const join28 = `,
|
|
6372
6372
|
${indentation}`;
|
|
6373
6373
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
6374
6374
|
let i6 = 0;
|
|
6375
6375
|
for (; i6 < maximumValuesToStringify - 1; i6++) {
|
|
6376
6376
|
const tmp2 = stringifyIndent(String(i6), value[i6], stack2, spacer, indentation);
|
|
6377
6377
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
6378
|
-
res2 +=
|
|
6378
|
+
res2 += join28;
|
|
6379
6379
|
}
|
|
6380
6380
|
const tmp = stringifyIndent(String(i6), value[i6], stack2, spacer, indentation);
|
|
6381
6381
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
6382
6382
|
if (value.length - 1 > maximumBreadth) {
|
|
6383
6383
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
6384
|
-
res2 += `${
|
|
6384
|
+
res2 += `${join28}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
6385
6385
|
}
|
|
6386
6386
|
res2 += `
|
|
6387
6387
|
${originalIndentation}`;
|
|
@@ -6397,16 +6397,16 @@ ${originalIndentation}`;
|
|
|
6397
6397
|
return '"[Object]"';
|
|
6398
6398
|
}
|
|
6399
6399
|
indentation += spacer;
|
|
6400
|
-
const
|
|
6400
|
+
const join27 = `,
|
|
6401
6401
|
${indentation}`;
|
|
6402
6402
|
let res = "";
|
|
6403
6403
|
let separator = "";
|
|
6404
6404
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
6405
6405
|
if (isTypedArrayWithEntries(value)) {
|
|
6406
|
-
res += stringifyTypedArray(value,
|
|
6406
|
+
res += stringifyTypedArray(value, join27, maximumBreadth);
|
|
6407
6407
|
keys = keys.slice(value.length);
|
|
6408
6408
|
maximumPropertiesToStringify -= value.length;
|
|
6409
|
-
separator =
|
|
6409
|
+
separator = join27;
|
|
6410
6410
|
}
|
|
6411
6411
|
if (deterministic) {
|
|
6412
6412
|
keys = insertSort(keys);
|
|
@@ -6417,13 +6417,13 @@ ${indentation}`;
|
|
|
6417
6417
|
const tmp = stringifyIndent(key2, value[key2], stack2, spacer, indentation);
|
|
6418
6418
|
if (tmp !== void 0) {
|
|
6419
6419
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
6420
|
-
separator =
|
|
6420
|
+
separator = join27;
|
|
6421
6421
|
}
|
|
6422
6422
|
}
|
|
6423
6423
|
if (keyLength > maximumBreadth) {
|
|
6424
6424
|
const removedKeys = keyLength - maximumBreadth;
|
|
6425
6425
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
6426
|
-
separator =
|
|
6426
|
+
separator = join27;
|
|
6427
6427
|
}
|
|
6428
6428
|
if (separator !== "") {
|
|
6429
6429
|
res = `
|
|
@@ -7990,7 +7990,7 @@ var require_buffer_list = __commonJS({
|
|
|
7990
7990
|
}
|
|
7991
7991
|
}, {
|
|
7992
7992
|
key: "join",
|
|
7993
|
-
value: function
|
|
7993
|
+
value: function join27(s4) {
|
|
7994
7994
|
if (this.length === 0) return "";
|
|
7995
7995
|
var p3 = this.head;
|
|
7996
7996
|
var ret = "" + p3.data;
|
|
@@ -19073,7 +19073,7 @@ var require_lodash = __commonJS({
|
|
|
19073
19073
|
}
|
|
19074
19074
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
19075
19075
|
});
|
|
19076
|
-
function
|
|
19076
|
+
function join27(array, separator) {
|
|
19077
19077
|
return array == null ? "" : nativeJoin.call(array, separator);
|
|
19078
19078
|
}
|
|
19079
19079
|
function last2(array) {
|
|
@@ -20992,7 +20992,7 @@ var require_lodash = __commonJS({
|
|
|
20992
20992
|
lodash16.isUndefined = isUndefined2;
|
|
20993
20993
|
lodash16.isWeakMap = isWeakMap;
|
|
20994
20994
|
lodash16.isWeakSet = isWeakSet;
|
|
20995
|
-
lodash16.join =
|
|
20995
|
+
lodash16.join = join27;
|
|
20996
20996
|
lodash16.kebabCase = kebabCase;
|
|
20997
20997
|
lodash16.last = last2;
|
|
20998
20998
|
lodash16.lastIndexOf = lastIndexOf;
|
|
@@ -29988,7 +29988,7 @@ var require_builder = __commonJS({
|
|
|
29988
29988
|
}
|
|
29989
29989
|
};
|
|
29990
29990
|
exports2.SeqBuilder = SeqBuilder;
|
|
29991
|
-
function
|
|
29991
|
+
function join27(first2, second, ...others) {
|
|
29992
29992
|
const seq = new SeqBuilder(first2, second);
|
|
29993
29993
|
if (!others.length) {
|
|
29994
29994
|
return seq;
|
|
@@ -29997,7 +29997,7 @@ var require_builder = __commonJS({
|
|
|
29997
29997
|
return res.join(query);
|
|
29998
29998
|
}, seq);
|
|
29999
29999
|
}
|
|
30000
|
-
exports2.join =
|
|
30000
|
+
exports2.join = join27;
|
|
30001
30001
|
var SymBuilder = class extends AbstractBuilder {
|
|
30002
30002
|
constructor(opts) {
|
|
30003
30003
|
super();
|
|
@@ -83615,7 +83615,7 @@ var require_lockfile = __commonJS({
|
|
|
83615
83615
|
}
|
|
83616
83616
|
const file = _ref22;
|
|
83617
83617
|
if (yield exists2(file)) {
|
|
83618
|
-
return
|
|
83618
|
+
return readFile26(file);
|
|
83619
83619
|
}
|
|
83620
83620
|
}
|
|
83621
83621
|
return null;
|
|
@@ -83634,7 +83634,7 @@ var require_lockfile = __commonJS({
|
|
|
83634
83634
|
})();
|
|
83635
83635
|
let readJsonAndFile = exports3.readJsonAndFile = (() => {
|
|
83636
83636
|
var _ref24 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) {
|
|
83637
|
-
const file = yield
|
|
83637
|
+
const file = yield readFile26(loc);
|
|
83638
83638
|
try {
|
|
83639
83639
|
return {
|
|
83640
83640
|
object: (0, (_map || _load_map()).default)(JSON.parse(stripBOM2(file))),
|
|
@@ -83874,7 +83874,7 @@ var require_lockfile = __commonJS({
|
|
|
83874
83874
|
};
|
|
83875
83875
|
})();
|
|
83876
83876
|
exports3.copy = copy;
|
|
83877
|
-
exports3.readFile =
|
|
83877
|
+
exports3.readFile = readFile26;
|
|
83878
83878
|
exports3.readFileRaw = readFileRaw;
|
|
83879
83879
|
exports3.normalizeOS = normalizeOS;
|
|
83880
83880
|
var _fs;
|
|
@@ -83972,7 +83972,7 @@ var require_lockfile = __commonJS({
|
|
|
83972
83972
|
});
|
|
83973
83973
|
});
|
|
83974
83974
|
}
|
|
83975
|
-
function
|
|
83975
|
+
function readFile26(loc) {
|
|
83976
83976
|
return _readFile(loc, "utf8").then(normalizeOS);
|
|
83977
83977
|
}
|
|
83978
83978
|
function readFileRaw(loc) {
|
|
@@ -190082,7 +190082,7 @@ var {
|
|
|
190082
190082
|
} = import_index.default;
|
|
190083
190083
|
|
|
190084
190084
|
// dist/index.js
|
|
190085
|
-
import { readFile as
|
|
190085
|
+
import { readFile as readFile25 } from "fs/promises";
|
|
190086
190086
|
|
|
190087
190087
|
// ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ANXBDSUI.js
|
|
190088
190088
|
var s = { done: false, hasNext: false };
|
|
@@ -190515,6 +190515,7 @@ function utilFormatter() {
|
|
|
190515
190515
|
}
|
|
190516
190516
|
|
|
190517
190517
|
// ../web-compat-utils/src/logger-singleton.ts
|
|
190518
|
+
import { readFile } from "fs/promises";
|
|
190518
190519
|
var CLILogger = class {
|
|
190519
190520
|
logger = console;
|
|
190520
190521
|
writeStream;
|
|
@@ -190594,6 +190595,16 @@ var CLILogger = class {
|
|
|
190594
190595
|
});
|
|
190595
190596
|
});
|
|
190596
190597
|
}
|
|
190598
|
+
async getLogContent(logFilePath) {
|
|
190599
|
+
await this.finish();
|
|
190600
|
+
let logContent;
|
|
190601
|
+
try {
|
|
190602
|
+
logContent = await readFile(logFilePath, "utf-8");
|
|
190603
|
+
} catch (e) {
|
|
190604
|
+
console.error("Error reading log file", e);
|
|
190605
|
+
}
|
|
190606
|
+
return logContent;
|
|
190607
|
+
}
|
|
190597
190608
|
set silent(silent) {
|
|
190598
190609
|
if (!(this.logger instanceof import_winston.Logger)) throw new Error("Cannot set silent mode on console logger");
|
|
190599
190610
|
this.logger.silent = silent;
|
|
@@ -191130,12 +191141,12 @@ var GoFixingManager = class {
|
|
|
191130
191141
|
|
|
191131
191142
|
// ../fixing-management/src/fixing-management/maven/gradle-fixing-manager.ts
|
|
191132
191143
|
import { existsSync as existsSync3 } from "node:fs";
|
|
191133
|
-
import { readFile as
|
|
191144
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
191134
191145
|
import { join as join2, resolve as resolve3 } from "node:path";
|
|
191135
191146
|
|
|
191136
191147
|
// ../fixing-management/src/fixing-management/maven/patch-application.ts
|
|
191137
191148
|
import { existsSync } from "node:fs";
|
|
191138
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
191149
|
+
import { readFile as readFile2, writeFile } from "node:fs/promises";
|
|
191139
191150
|
|
|
191140
191151
|
// ../utils/src/version-comparison/version-satisfies.ts
|
|
191141
191152
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
@@ -192376,7 +192387,7 @@ async function applyPatchResults(patchResults, ecosystem) {
|
|
|
192376
192387
|
if (!existsSync(filePath)) {
|
|
192377
192388
|
await writeFile(filePath, "", "utf-8");
|
|
192378
192389
|
}
|
|
192379
|
-
let fileContent = await
|
|
192390
|
+
let fileContent = await readFile2(filePath, "utf-8");
|
|
192380
192391
|
for (const patch of sortedPatches) {
|
|
192381
192392
|
const [start, end2] = patch.range;
|
|
192382
192393
|
fileContent = fileContent.substring(0, start) + patch.replacementText + fileContent.substring(end2);
|
|
@@ -192387,7 +192398,7 @@ async function applyPatchResults(patchResults, ecosystem) {
|
|
|
192387
192398
|
|
|
192388
192399
|
// ../fixing-management/src/fixing-management/maven/gradle-build-file-helper.ts
|
|
192389
192400
|
var import_good_enough_parser = __toESM(require_cjs(), 1);
|
|
192390
|
-
import { readFile as
|
|
192401
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
192391
192402
|
|
|
192392
192403
|
// ../fixing-management/src/fixing-management/maven/utils.ts
|
|
192393
192404
|
import { existsSync as existsSync2 } from "fs";
|
|
@@ -192633,7 +192644,7 @@ async function findDependencyDeclsAndCatalogFiles(filePath) {
|
|
|
192633
192644
|
};
|
|
192634
192645
|
}
|
|
192635
192646
|
if (!buildFileCache[filePath]) {
|
|
192636
|
-
const fileContent = await
|
|
192647
|
+
const fileContent = await readFile3(filePath, "utf-8");
|
|
192637
192648
|
buildFileCache[filePath] = helper(fileContent);
|
|
192638
192649
|
}
|
|
192639
192650
|
return buildFileCache[filePath];
|
|
@@ -192660,7 +192671,7 @@ ${getConstraintsBlockString(groupId, artifactId, classifier, version3, indentati
|
|
|
192660
192671
|
|
|
192661
192672
|
// ../fixing-management/src/fixing-management/maven/gradle-version-catalog-helper.ts
|
|
192662
192673
|
var import_toml_eslint_parser = __toESM(require_lib10(), 1);
|
|
192663
|
-
import { readFile as
|
|
192674
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
192664
192675
|
var versionCatalogCache = {};
|
|
192665
192676
|
function clearVersionCatalogCache() {
|
|
192666
192677
|
Object.keys(versionCatalogCache).forEach((key) => {
|
|
@@ -192783,7 +192794,7 @@ async function findVersionCatalogDeclarations(filePath) {
|
|
|
192783
192794
|
};
|
|
192784
192795
|
}
|
|
192785
192796
|
if (!versionCatalogCache[filePath]) {
|
|
192786
|
-
const fileContent = await
|
|
192797
|
+
const fileContent = await readFile4(filePath, "utf-8");
|
|
192787
192798
|
versionCatalogCache[filePath] = helper(fileContent);
|
|
192788
192799
|
}
|
|
192789
192800
|
return versionCatalogCache[filePath];
|
|
@@ -192995,7 +193006,7 @@ var GradleFixingManager = class {
|
|
|
192995
193006
|
replacementText: constraintStr + "\n"
|
|
192996
193007
|
};
|
|
192997
193008
|
} else {
|
|
192998
|
-
const fileContent = await
|
|
193009
|
+
const fileContent = await readFile5(targetBuildFile, "utf-8");
|
|
192999
193010
|
const indentationSize = getIndentationSize(fileContent);
|
|
193000
193011
|
const prependNewline = fileContent.split("\n").some((line) => !line.trim());
|
|
193001
193012
|
const finalConstraintStr = getDependencyConstraintString(
|
|
@@ -193183,7 +193194,7 @@ var GradleFixingManager = class {
|
|
|
193183
193194
|
async createConstraintsForFile(buildFile, fixes) {
|
|
193184
193195
|
const { dependenciesBlocks, constraintsBlocks } = await findDependencyDeclsAndCatalogFiles(buildFile);
|
|
193185
193196
|
const fileType = buildFile.endsWith(".kts") ? "kotlin" : "groovy";
|
|
193186
|
-
const fileContent = existsSync3(buildFile) ? await
|
|
193197
|
+
const fileContent = existsSync3(buildFile) ? await readFile5(buildFile, "utf-8") : "";
|
|
193187
193198
|
const indentationSize = getIndentationSize(fileContent);
|
|
193188
193199
|
const constraintDeclarations = fixes.map(({ dependencyDetails, fixedVersion }) => {
|
|
193189
193200
|
const [groupId, artifactId] = dependencyDetails.packageName.split(":");
|
|
@@ -193290,7 +193301,7 @@ import { resolve as resolve5 } from "path";
|
|
|
193290
193301
|
|
|
193291
193302
|
// ../fixing-management/src/fixing-management/maven/pom-utils.ts
|
|
193292
193303
|
var import_parse_xml = __toESM(require_dist(), 1);
|
|
193293
|
-
import { readFile as
|
|
193304
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
193294
193305
|
import { existsSync as existsSync4, statSync } from "node:fs";
|
|
193295
193306
|
import { resolve as resolve4, dirname } from "node:path";
|
|
193296
193307
|
var evaluatedCache = {};
|
|
@@ -193326,7 +193337,7 @@ async function loadAndEvaluatePomWithCache(pomPath) {
|
|
|
193326
193337
|
return evaluatedCache[pomPath];
|
|
193327
193338
|
}
|
|
193328
193339
|
async function buildEffectivePom(pomPath) {
|
|
193329
|
-
const pomData = await
|
|
193340
|
+
const pomData = await readFile6(pomPath, "utf-8");
|
|
193330
193341
|
const pomXml = (0, import_parse_xml.parseXml)(pomData, { includeOffsets: true });
|
|
193331
193342
|
const indentation = inferIndentationFromParsedXml(pomXml, pomData);
|
|
193332
193343
|
const parentPomPath = getParentPomPath(pomPath, pomXml);
|
|
@@ -193936,7 +193947,7 @@ import { basename, join as join4, resolve as resolve6 } from "path";
|
|
|
193936
193947
|
|
|
193937
193948
|
// ../fixing-management/src/fixing-management/maven/socket-patch-application.ts
|
|
193938
193949
|
import { existsSync as existsSync5 } from "node:fs";
|
|
193939
|
-
import { readFile as
|
|
193950
|
+
import { readFile as readFile7, writeFile as writeFile2 } from "node:fs/promises";
|
|
193940
193951
|
function detectSocketPatchConflicts(patchResults) {
|
|
193941
193952
|
const patchesByFile = /* @__PURE__ */ new Map();
|
|
193942
193953
|
for (const patchResult of patchResults) {
|
|
@@ -194034,7 +194045,7 @@ async function applySocketPatchResults(ecosystem, patchResults) {
|
|
|
194034
194045
|
if (!existsSync5(filePath)) {
|
|
194035
194046
|
await writeFile2(filePath, "", "utf-8");
|
|
194036
194047
|
}
|
|
194037
|
-
let fileContent = await
|
|
194048
|
+
let fileContent = await readFile7(filePath, "utf-8");
|
|
194038
194049
|
for (const patch of sortedPatches) {
|
|
194039
194050
|
const [start, end2] = patch.range;
|
|
194040
194051
|
fileContent = fileContent.substring(0, start) + patch.replacementText + fileContent.substring(end2);
|
|
@@ -194170,7 +194181,7 @@ import assert2 from "assert";
|
|
|
194170
194181
|
import { existsSync as existsSync6 } from "fs";
|
|
194171
194182
|
|
|
194172
194183
|
// ../fixing-management/src/fixing-management/maven/gradle-lockfile-utils.ts
|
|
194173
|
-
import { readFile as
|
|
194184
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
194174
194185
|
var lockfileCache = {};
|
|
194175
194186
|
function clearLockfileCache() {
|
|
194176
194187
|
Object.keys(lockfileCache).forEach((key) => {
|
|
@@ -194179,7 +194190,7 @@ function clearLockfileCache() {
|
|
|
194179
194190
|
}
|
|
194180
194191
|
async function loadLockfileWithCache(lockfilePath) {
|
|
194181
194192
|
if (!lockfileCache[lockfilePath]) {
|
|
194182
|
-
lockfileCache[lockfilePath] = await
|
|
194193
|
+
lockfileCache[lockfilePath] = await readFile8(lockfilePath, "utf-8");
|
|
194183
194194
|
}
|
|
194184
194195
|
return lockfileCache[lockfilePath];
|
|
194185
194196
|
}
|
|
@@ -197484,7 +197495,7 @@ var {
|
|
|
197484
197495
|
|
|
197485
197496
|
// ../utils/src/dashboard-api/socket-api.ts
|
|
197486
197497
|
var import_form_data2 = __toESM(require_form_data2(), 1);
|
|
197487
|
-
import { readFile as
|
|
197498
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
197488
197499
|
import { join as join3 } from "path";
|
|
197489
197500
|
|
|
197490
197501
|
// ../web-compat-utils/src/ghsa.ts
|
|
@@ -197905,10 +197916,11 @@ async function getLatestBucketsSocket(subprojectPath, workspacePath) {
|
|
|
197905
197916
|
return void 0;
|
|
197906
197917
|
}
|
|
197907
197918
|
}
|
|
197908
|
-
async function useSocketComputeFixEndpoint(artifacts, vulnerableArtifactIdsForGhsas) {
|
|
197919
|
+
async function useSocketComputeFixEndpoint(autofixRunId, artifacts, vulnerableArtifactIdsForGhsas) {
|
|
197909
197920
|
try {
|
|
197910
197921
|
const url2 = getSocketApiUrl("fixes/compute-fixes");
|
|
197911
197922
|
const data2 = {
|
|
197923
|
+
autofixRunId,
|
|
197912
197924
|
artifacts,
|
|
197913
197925
|
vulnerableArtifactIndexes: vulnerableArtifactIdsForGhsas
|
|
197914
197926
|
};
|
|
@@ -197947,7 +197959,7 @@ async function fetchArtifactsFromManifestsTarHash(manifestsTarHash) {
|
|
|
197947
197959
|
async function computeSocketFactArtifacts(rootDir, relativeManifestFilePaths) {
|
|
197948
197960
|
const formData = new import_form_data2.default();
|
|
197949
197961
|
for (const relativeManifestFilePath of relativeManifestFilePaths) {
|
|
197950
|
-
const manifestContent = await
|
|
197962
|
+
const manifestContent = await readFile9(join3(rootDir, relativeManifestFilePath), "utf-8");
|
|
197951
197963
|
const manifestContentAsJson = JSON.stringify(manifestContent);
|
|
197952
197964
|
formData.append(relativeManifestFilePath, manifestContentAsJson, {
|
|
197953
197965
|
filename: relativeManifestFilePath,
|
|
@@ -197974,6 +197986,62 @@ async function computeSocketFactArtifacts(rootDir, relativeManifestFilePaths) {
|
|
|
197974
197986
|
return void 0;
|
|
197975
197987
|
}
|
|
197976
197988
|
}
|
|
197989
|
+
async function registerAutofixOrUpgradePurlRun(manifestsTarHash, repositoryName, options, cliCommand) {
|
|
197990
|
+
try {
|
|
197991
|
+
const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/fixes/register-autofix-or-upgrade-cli-run`);
|
|
197992
|
+
const data2 = {
|
|
197993
|
+
manifestsTarHash,
|
|
197994
|
+
repositoryName,
|
|
197995
|
+
options,
|
|
197996
|
+
cliCommand
|
|
197997
|
+
};
|
|
197998
|
+
const response = await axios2.post(url2, data2, { headers: getAuthHeaders() });
|
|
197999
|
+
return response.data.id;
|
|
198000
|
+
} catch (error) {
|
|
198001
|
+
handleError(error, "Error registering autofix or upgrade purl run", false);
|
|
198002
|
+
}
|
|
198003
|
+
}
|
|
198004
|
+
async function finalizeAutofixRun(autofixRunId, status, stackTrace, logFileContent) {
|
|
198005
|
+
try {
|
|
198006
|
+
const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/fixes/finalize-autofix-run`);
|
|
198007
|
+
const data2 = {
|
|
198008
|
+
autofixRunId,
|
|
198009
|
+
status,
|
|
198010
|
+
stackTrace,
|
|
198011
|
+
logFileContent
|
|
198012
|
+
};
|
|
198013
|
+
await axios2.post(url2, data2, { headers: getAuthHeaders() });
|
|
198014
|
+
} catch (error) {
|
|
198015
|
+
handleError(error, "Error finalizing autofix run", false);
|
|
198016
|
+
}
|
|
198017
|
+
}
|
|
198018
|
+
async function registerUpgradePurlRun(autofixRunId, upgradeSpecs) {
|
|
198019
|
+
try {
|
|
198020
|
+
const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/fixes/register-upgrade-purl-run`);
|
|
198021
|
+
const data2 = {
|
|
198022
|
+
cliRunId: autofixRunId,
|
|
198023
|
+
upgradeSpecs
|
|
198024
|
+
};
|
|
198025
|
+
const response = await axios2.post(url2, data2, { headers: getAuthHeaders() });
|
|
198026
|
+
return response.data.id;
|
|
198027
|
+
} catch (error) {
|
|
198028
|
+
handleError(error, "Error registering upgrade purl run", false);
|
|
198029
|
+
}
|
|
198030
|
+
}
|
|
198031
|
+
async function finalizeUpgradePurlRun(upgradePurlRunId, status, stackTrace, logFileContent) {
|
|
198032
|
+
try {
|
|
198033
|
+
const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/fixes/finalize-upgrade-purl-run`);
|
|
198034
|
+
const data2 = {
|
|
198035
|
+
upgradePurlRunId,
|
|
198036
|
+
status,
|
|
198037
|
+
stackTrace,
|
|
198038
|
+
logFileContent
|
|
198039
|
+
};
|
|
198040
|
+
await axios2.post(url2, data2, { headers: getAuthHeaders() });
|
|
198041
|
+
} catch (error) {
|
|
198042
|
+
handleError(error, "Error finalizing upgrade purl run", false);
|
|
198043
|
+
}
|
|
198044
|
+
}
|
|
197977
198045
|
function getSocketAPI() {
|
|
197978
198046
|
return {
|
|
197979
198047
|
createSocketTier1Scan,
|
|
@@ -197981,7 +198049,11 @@ function getSocketAPI() {
|
|
|
197981
198049
|
registerSubprojectsSocket,
|
|
197982
198050
|
registerCLIProgressSocket,
|
|
197983
198051
|
registerAnalysisMetadataSocket,
|
|
197984
|
-
getLatestBucketsSocket
|
|
198052
|
+
getLatestBucketsSocket,
|
|
198053
|
+
registerAutofixOrUpgradePurlRun,
|
|
198054
|
+
finalizeAutofixRun,
|
|
198055
|
+
registerUpgradePurlRun,
|
|
198056
|
+
finalizeUpgradePurlRun
|
|
197985
198057
|
};
|
|
197986
198058
|
}
|
|
197987
198059
|
|
|
@@ -198269,12 +198341,12 @@ var MavenSocketUpgradeManager = class {
|
|
|
198269
198341
|
|
|
198270
198342
|
// ../fixing-management/src/fixing-management/maven/sbt-fixing-manager.ts
|
|
198271
198343
|
import { existsSync as existsSync7 } from "node:fs";
|
|
198272
|
-
import { readFile as
|
|
198344
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
198273
198345
|
import { join as join5 } from "node:path";
|
|
198274
198346
|
|
|
198275
198347
|
// ../fixing-management/src/fixing-management/maven/sbt-fixing-helper.ts
|
|
198276
198348
|
var import_good_enough_parser2 = __toESM(require_cjs(), 1);
|
|
198277
|
-
import { readFile as
|
|
198349
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
198278
198350
|
var sbtFileCache = {};
|
|
198279
198351
|
function clearSbtFileCache() {
|
|
198280
198352
|
Object.keys(sbtFileCache).forEach((key) => {
|
|
@@ -198395,7 +198467,7 @@ async function findModuleIds(filePath) {
|
|
|
198395
198467
|
return ctx?.moduleIds ?? [];
|
|
198396
198468
|
}
|
|
198397
198469
|
if (!sbtFileCache[filePath]) {
|
|
198398
|
-
const fileContent = await
|
|
198470
|
+
const fileContent = await readFile10(filePath, "utf-8");
|
|
198399
198471
|
sbtFileCache[filePath] = helper(fileContent);
|
|
198400
198472
|
}
|
|
198401
198473
|
return sbtFileCache[filePath];
|
|
@@ -198612,7 +198684,7 @@ var SbtFixingManager = class {
|
|
|
198612
198684
|
`
|
|
198613
198685
|
};
|
|
198614
198686
|
} else {
|
|
198615
|
-
const fileContent = await
|
|
198687
|
+
const fileContent = await readFile11(workspaceBuildSbtPath, "utf-8");
|
|
198616
198688
|
const prependNewline = fileContent.split("\n").some((line) => !line.trim());
|
|
198617
198689
|
return {
|
|
198618
198690
|
manifestFilePath: workspaceBuildSbtPath,
|
|
@@ -198691,7 +198763,7 @@ ${indent(1, indentationSize)}`)}
|
|
|
198691
198763
|
replacementText: overrideText
|
|
198692
198764
|
};
|
|
198693
198765
|
} else {
|
|
198694
|
-
const fileContent = await
|
|
198766
|
+
const fileContent = await readFile11(workspaceBuildSbtPath, "utf-8");
|
|
198695
198767
|
const indentationSize = getIndentationSize(fileContent);
|
|
198696
198768
|
const prependNewline = fileContent.length > 0 && !fileContent.endsWith("\n\n");
|
|
198697
198769
|
const overrideText = `dependencyOverrides ++= Seq(
|
|
@@ -198709,7 +198781,7 @@ ${indent(1, indentationSize)}`)}
|
|
|
198709
198781
|
};
|
|
198710
198782
|
|
|
198711
198783
|
// ../fixing-management/src/fixing-management/npm/npm-fixing-manager.ts
|
|
198712
|
-
import { readFile as
|
|
198784
|
+
import { readFile as readFile12, writeFile as writeFile3 } from "fs/promises";
|
|
198713
198785
|
import { resolve as resolve9 } from "path";
|
|
198714
198786
|
|
|
198715
198787
|
// ../utils/src/npm-utils.ts
|
|
@@ -205459,7 +205531,7 @@ var NpmFixingManager = class extends NpmEcosystemFixingManager {
|
|
|
205459
205531
|
}
|
|
205460
205532
|
async applySecurityFixesSpecificPackageManager(fixes) {
|
|
205461
205533
|
const pkgLockLocation = resolve9(this.rootDir, this.subprojectPath, "package-lock.json");
|
|
205462
|
-
const packageLockContent = await
|
|
205534
|
+
const packageLockContent = await readFile12(pkgLockLocation, "utf-8");
|
|
205463
205535
|
const getPackageName = (pkgPath) => {
|
|
205464
205536
|
const strings = pkgPath.split("node_modules/");
|
|
205465
205537
|
return strings[strings.length - 1];
|
|
@@ -205488,7 +205560,7 @@ var NpmFixingManager = class extends NpmEcosystemFixingManager {
|
|
|
205488
205560
|
};
|
|
205489
205561
|
|
|
205490
205562
|
// ../fixing-management/src/fixing-management/npm/pnpm-fixing-manager.ts
|
|
205491
|
-
import { readFile as
|
|
205563
|
+
import { readFile as readFile13, writeFile as writeFile4 } from "fs/promises";
|
|
205492
205564
|
import { resolve as resolve10 } from "path";
|
|
205493
205565
|
var import_yaml = __toESM(require_dist10(), 1);
|
|
205494
205566
|
var import_lockfile_file2 = __toESM(require_lib25(), 1);
|
|
@@ -205630,7 +205702,7 @@ function getVersionNumber(version3) {
|
|
|
205630
205702
|
return match2 ? `${match2[1]}` : version3;
|
|
205631
205703
|
}
|
|
205632
205704
|
async function readYamlFile(workspaceYamlFile) {
|
|
205633
|
-
const workspaceYamlString = await
|
|
205705
|
+
const workspaceYamlString = await readFile13(workspaceYamlFile, "utf8");
|
|
205634
205706
|
const parser = new import_yaml.Parser();
|
|
205635
205707
|
const [ast] = parser.parse(workspaceYamlString);
|
|
205636
205708
|
return ast;
|
|
@@ -205668,7 +205740,7 @@ function updateCatalog(update2, map2) {
|
|
|
205668
205740
|
|
|
205669
205741
|
// ../fixing-management/src/fixing-management/npm/yarn-fixing-manager.ts
|
|
205670
205742
|
import { readFileSync as readFileSync3 } from "fs";
|
|
205671
|
-
import { readFile as
|
|
205743
|
+
import { readFile as readFile14, writeFile as writeFile5 } from "fs/promises";
|
|
205672
205744
|
import { resolve as resolve12 } from "path";
|
|
205673
205745
|
|
|
205674
205746
|
// ../utils/src/package-utils.ts
|
|
@@ -205829,7 +205901,7 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
|
|
|
205829
205901
|
logger.info("Installation completed.");
|
|
205830
205902
|
}
|
|
205831
205903
|
async getYarnLockObj(filePath) {
|
|
205832
|
-
const fileString = await
|
|
205904
|
+
const fileString = await readFile14(filePath, "utf8");
|
|
205833
205905
|
return this.yarnType === "classic" ? (0, import_yarnlock_parse_raw.parseYarnLockRawV1)(fileString) : (0, import_yarnlock_parse_raw.parseYarnLockRawV2)(fileString);
|
|
205834
205906
|
}
|
|
205835
205907
|
async writeYarnObj(yarnObj, filepath) {
|
|
@@ -206038,7 +206110,7 @@ var RushFixingManager = class {
|
|
|
206038
206110
|
};
|
|
206039
206111
|
|
|
206040
206112
|
// ../fixing-management/src/fixing-management/nuget/nuget-fixing-manager.ts
|
|
206041
|
-
import { readFile as
|
|
206113
|
+
import { readFile as readFile15, writeFile as writeFile6 } from "fs/promises";
|
|
206042
206114
|
import { join as join9 } from "path";
|
|
206043
206115
|
|
|
206044
206116
|
// ../utils/src/nuget-utils.ts
|
|
@@ -206141,14 +206213,14 @@ var NugetFixingManager = class {
|
|
|
206141
206213
|
if (projectFiles.length !== 1)
|
|
206142
206214
|
throw new Error("Applying fixes to workspaces with more than 1 project file currently not supported");
|
|
206143
206215
|
const projectFilePath = join9(this.getAbsWsPath(wsPath), projectFiles[0]);
|
|
206144
|
-
const initialProjectFile = await
|
|
206216
|
+
const initialProjectFile = await readFile15(projectFilePath, "utf-8");
|
|
206145
206217
|
const initialLockFile = await this.restoreWorkspaceAndParseLockFile(wsPath);
|
|
206146
206218
|
await applySeries(fixesWithId, async ({ fixId, vulnerabilityFixes }) => {
|
|
206147
206219
|
await this.applySecurityFixesForWorkspace(wsPath, projectFilePath, vulnerabilityFixes, dependencyTree);
|
|
206148
206220
|
signalFixApplied2?.(fixId, this.subprojectPath, wsPath, vulnerabilityFixes);
|
|
206149
206221
|
});
|
|
206150
|
-
const finalProjectFile = await
|
|
206151
|
-
const finalLockFile = JSON.parse(await
|
|
206222
|
+
const finalProjectFile = await readFile15(projectFilePath, "utf-8");
|
|
206223
|
+
const finalLockFile = JSON.parse(await readFile15(this.getLockFilePath(wsPath), "utf-8"));
|
|
206152
206224
|
await writeFile6(projectFilePath, initialProjectFile);
|
|
206153
206225
|
await writeFile6(this.getLockFilePath(wsPath), JSON.stringify(initialLockFile, null, 2));
|
|
206154
206226
|
return { projectFile: finalProjectFile, lockFile: finalLockFile };
|
|
@@ -206180,7 +206252,7 @@ var NugetFixingManager = class {
|
|
|
206180
206252
|
}
|
|
206181
206253
|
}
|
|
206182
206254
|
async applySecurityFixesForWorkspace(wsPath, projectFilePath, vulnFixes, dependencyTree) {
|
|
206183
|
-
const initialProjectFile = await
|
|
206255
|
+
const initialProjectFile = await readFile15(projectFilePath, "utf-8");
|
|
206184
206256
|
const initialLockFile = await this.restoreWorkspaceAndParseLockFile(wsPath);
|
|
206185
206257
|
const typeCache = new Cache();
|
|
206186
206258
|
const requestedCache = new Cache();
|
|
@@ -206270,7 +206342,7 @@ var NugetFixingManager = class {
|
|
|
206270
206342
|
async restoreWorkspaceAndParseLockFile(wsPath) {
|
|
206271
206343
|
const succeeded = await execAndLogOnFailure("dotnet restore --use-lock-file", this.getAbsWsPath(wsPath));
|
|
206272
206344
|
if (!succeeded) throw new Error(`Error applying fix - could not restore project ${this.subprojectPath}/${wsPath}`);
|
|
206273
|
-
return JSON.parse(await
|
|
206345
|
+
return JSON.parse(await readFile15(this.getLockFilePath(wsPath), "utf-8"));
|
|
206274
206346
|
}
|
|
206275
206347
|
getLockFilePath(wsPath, lockFileName = "packages.lock.json") {
|
|
206276
206348
|
return join9(this.getAbsWsPath(wsPath), lockFileName);
|
|
@@ -207027,6 +207099,7 @@ function utilFormatter2() {
|
|
|
207027
207099
|
}
|
|
207028
207100
|
|
|
207029
207101
|
// ../web-compat-utils/dist/logger-singleton.js
|
|
207102
|
+
import { readFile as readFile16 } from "fs/promises";
|
|
207030
207103
|
var CLILogger2 = class {
|
|
207031
207104
|
logger = console;
|
|
207032
207105
|
writeStream;
|
|
@@ -207102,6 +207175,16 @@ var CLILogger2 = class {
|
|
|
207102
207175
|
});
|
|
207103
207176
|
});
|
|
207104
207177
|
}
|
|
207178
|
+
async getLogContent(logFilePath) {
|
|
207179
|
+
await this.finish();
|
|
207180
|
+
let logContent;
|
|
207181
|
+
try {
|
|
207182
|
+
logContent = await readFile16(logFilePath, "utf-8");
|
|
207183
|
+
} catch (e) {
|
|
207184
|
+
console.error("Error reading log file", e);
|
|
207185
|
+
}
|
|
207186
|
+
return logContent;
|
|
207187
|
+
}
|
|
207105
207188
|
set silent(silent) {
|
|
207106
207189
|
if (!(this.logger instanceof import_winston2.Logger))
|
|
207107
207190
|
throw new Error("Cannot set silent mode on console logger");
|
|
@@ -207141,13 +207224,13 @@ async function detectVariantMaven(projectDir) {
|
|
|
207141
207224
|
// ../docker-management/src/maven/gradle-version-detector.ts
|
|
207142
207225
|
import { existsSync as existsSync13 } from "fs";
|
|
207143
207226
|
import { join as join14 } from "path";
|
|
207144
|
-
import { readFile as
|
|
207227
|
+
import { readFile as readFile17 } from "fs/promises";
|
|
207145
207228
|
async function detectVariantGradle(projectDir) {
|
|
207146
207229
|
return sanitizeJvmVariant("GRADLE", projectDir, await detect(projectDir));
|
|
207147
207230
|
}
|
|
207148
207231
|
async function detect(projectDir) {
|
|
207149
207232
|
const gradleWrapperPropertiesPath = join14(projectDir, "gradle", "wrapper", "gradle-wrapper.properties");
|
|
207150
|
-
const gradleWrapperProperties = existsSync13(gradleWrapperPropertiesPath) ? (await
|
|
207233
|
+
const gradleWrapperProperties = existsSync13(gradleWrapperPropertiesPath) ? (await readFile17(gradleWrapperPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
|
|
207151
207234
|
if (!gradleWrapperProperties) return void 0;
|
|
207152
207235
|
const distributionUrlRegex = /.*gradle-(\d+(\.\d+(\.\d+)?)?)/;
|
|
207153
207236
|
for (const prop2 of gradleWrapperProperties) {
|
|
@@ -207163,13 +207246,13 @@ async function detect(projectDir) {
|
|
|
207163
207246
|
// ../docker-management/src/maven/sbt-version-detector.ts
|
|
207164
207247
|
import { existsSync as existsSync14 } from "fs";
|
|
207165
207248
|
import { join as join15 } from "path";
|
|
207166
|
-
import { readFile as
|
|
207249
|
+
import { readFile as readFile18 } from "fs/promises";
|
|
207167
207250
|
async function detectVariantSbt(projectDir) {
|
|
207168
207251
|
return sanitizeJvmVariant("SBT", projectDir, await detect2(projectDir));
|
|
207169
207252
|
}
|
|
207170
207253
|
async function detect2(projectDir) {
|
|
207171
207254
|
const sbtBuildPropertiesPath = join15(projectDir, "project", "build.properties");
|
|
207172
|
-
const sbtBuildProperties = existsSync14(sbtBuildPropertiesPath) ? (await
|
|
207255
|
+
const sbtBuildProperties = existsSync14(sbtBuildPropertiesPath) ? (await readFile18(sbtBuildPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
|
|
207173
207256
|
if (!sbtBuildProperties) return void 0;
|
|
207174
207257
|
for (const prop2 of sbtBuildProperties) {
|
|
207175
207258
|
const [key, value] = prop2.split("=");
|
|
@@ -207283,7 +207366,7 @@ async function findReachabilityAnalyzersDockerImage(ecosystem) {
|
|
|
207283
207366
|
// ../other-modules-communicator/src/other-modules-communicator.ts
|
|
207284
207367
|
var import_lodash11 = __toESM(require_lodash(), 1);
|
|
207285
207368
|
import { rmSync } from "fs";
|
|
207286
|
-
import { mkdir, readFile as
|
|
207369
|
+
import { mkdir, readFile as readFile19, writeFile as writeFile7 } from "fs/promises";
|
|
207287
207370
|
import { platform } from "os";
|
|
207288
207371
|
import { join as join19, posix as posix2, relative as relative8, sep as sep3 } from "path";
|
|
207289
207372
|
|
|
@@ -207342,6 +207425,18 @@ async function createTmpDirectory(prefix) {
|
|
|
207342
207425
|
throw err;
|
|
207343
207426
|
}
|
|
207344
207427
|
}
|
|
207428
|
+
async function withTmpDirectory(prefix, fn2, deleteTmpDir = true) {
|
|
207429
|
+
const tmpDir = await createTmpDirectory(prefix);
|
|
207430
|
+
try {
|
|
207431
|
+
return await fn2(tmpDir);
|
|
207432
|
+
} finally {
|
|
207433
|
+
if (deleteTmpDir) {
|
|
207434
|
+
await rm(tmpDir, { recursive: true, force: true });
|
|
207435
|
+
} else {
|
|
207436
|
+
console.log("Not deleting tmp dir", tmpDir);
|
|
207437
|
+
}
|
|
207438
|
+
}
|
|
207439
|
+
}
|
|
207345
207440
|
|
|
207346
207441
|
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/rng.js
|
|
207347
207442
|
import crypto2 from "crypto";
|
|
@@ -207721,7 +207816,7 @@ var OtherModulesCommunicator = class {
|
|
|
207721
207816
|
COANA_API_KEY: this.apiKey.type === "present" ? this.apiKey.value : ""
|
|
207722
207817
|
}
|
|
207723
207818
|
);
|
|
207724
|
-
return JSON.parse(await
|
|
207819
|
+
return JSON.parse(await readFile19(outputFilePathThisProcess, "utf-8")).result;
|
|
207725
207820
|
}
|
|
207726
207821
|
async runReachabilityAnalyzerCommand(commandName, ecosystem, subprojectPath, workspacePath, args2, env) {
|
|
207727
207822
|
const tmpDir = await this.getTmpDirForSubproject(subprojectPath);
|
|
@@ -207782,7 +207877,7 @@ var OtherModulesCommunicator = class {
|
|
|
207782
207877
|
[...args2, "-o", outputFilePathOtherProcess],
|
|
207783
207878
|
env
|
|
207784
207879
|
);
|
|
207785
|
-
return JSON.parse(await
|
|
207880
|
+
return JSON.parse(await readFile19(outputFilePathThisProcess, "utf-8")).result;
|
|
207786
207881
|
}
|
|
207787
207882
|
async runInDocker(ecosystem, image, entryPoint, commandName, args2, subprojectPath, tmpDir, env = process.env) {
|
|
207788
207883
|
if (!await pullDockerImage(image)) return false;
|
|
@@ -209240,12 +209335,12 @@ import { join as join22, relative as relative9, resolve as resolve20 } from "pat
|
|
|
209240
209335
|
|
|
209241
209336
|
// ../project-management/src/project-management/ecosystem-management/ecosystem-specs.ts
|
|
209242
209337
|
import { existsSync as existsSync18 } from "fs";
|
|
209243
|
-
import { readdir as readdir5, readFile as
|
|
209338
|
+
import { readdir as readdir5, readFile as readFile22 } from "fs/promises";
|
|
209244
209339
|
import { join as join21, sep as sep4 } from "path";
|
|
209245
209340
|
|
|
209246
209341
|
// ../utils/src/pip-utils.ts
|
|
209247
209342
|
import { existsSync as existsSync17 } from "fs";
|
|
209248
|
-
import { readFile as
|
|
209343
|
+
import { readFile as readFile21 } from "fs/promises";
|
|
209249
209344
|
import { resolve as resolve19 } from "path";
|
|
209250
209345
|
import util4 from "util";
|
|
209251
209346
|
|
|
@@ -209254,7 +209349,7 @@ var import_lodash13 = __toESM(require_lodash(), 1);
|
|
|
209254
209349
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
209255
209350
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
209256
209351
|
import { constants as constants2 } from "fs";
|
|
209257
|
-
import { access as access4, readFile as
|
|
209352
|
+
import { access as access4, readFile as readFile20 } from "fs/promises";
|
|
209258
209353
|
import { join as join20, resolve as resolve18 } from "path";
|
|
209259
209354
|
import util3 from "util";
|
|
209260
209355
|
var { once: once7 } = import_lodash13.default;
|
|
@@ -209262,7 +209357,7 @@ var systemPython = once7(() => execFileSync2("which", ["python"], { encoding: "u
|
|
|
209262
209357
|
|
|
209263
209358
|
// ../utils/src/pip-utils.ts
|
|
209264
209359
|
async function isSetupPySetuptools(file) {
|
|
209265
|
-
const content = await
|
|
209360
|
+
const content = await readFile21(file, "utf-8");
|
|
209266
209361
|
return content.includes("setup(") && (/^\s*from\s+(?:setuptools|distutils\.core)\s+import\s+.*setup/m.test(content) || /^\s*import\s+(?:setuptools|distutils\.core)/m.test(content));
|
|
209267
209362
|
}
|
|
209268
209363
|
|
|
@@ -209344,7 +209439,7 @@ function packageManagerIfPackageJSONExistsAndValid(packageManager) {
|
|
|
209344
209439
|
if (!existsSync18(join21(projectDir, "package.json"))) return void 0;
|
|
209345
209440
|
const packageJSONPath = join21(projectDir, "package.json");
|
|
209346
209441
|
try {
|
|
209347
|
-
JSON.parse(await
|
|
209442
|
+
JSON.parse(await readFile22(packageJSONPath, "utf-8"));
|
|
209348
209443
|
return packageManager;
|
|
209349
209444
|
} catch (e) {
|
|
209350
209445
|
throw new InvalidProjectFileError(projectDir, "package.json");
|
|
@@ -209605,7 +209700,7 @@ ${detailsString}` : ""}`;
|
|
|
209605
209700
|
|
|
209606
209701
|
// dist/cli-core.js
|
|
209607
209702
|
import { writeFileSync as writeFileSync3 } from "fs";
|
|
209608
|
-
import { mkdir as mkdir2,
|
|
209703
|
+
import { mkdir as mkdir2, writeFile as writeFile9 } from "fs/promises";
|
|
209609
209704
|
|
|
209610
209705
|
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/index.mjs
|
|
209611
209706
|
var FORCE_COLOR;
|
|
@@ -210030,7 +210125,7 @@ var DEFAULT_REPORT_FILENAME_BASE = "coana-report";
|
|
|
210030
210125
|
|
|
210031
210126
|
// dist/internal/exclude-dirs-from-configuration-files.js
|
|
210032
210127
|
import { existsSync as existsSync19 } from "fs";
|
|
210033
|
-
import { readFile as
|
|
210128
|
+
import { readFile as readFile23 } from "fs/promises";
|
|
210034
210129
|
import { basename as basename6, resolve as resolve22 } from "path";
|
|
210035
210130
|
var import_yaml2 = __toESM(require_dist11(), 1);
|
|
210036
210131
|
async function inferExcludeDirsFromConfigurationFiles(rootWorkingDir) {
|
|
@@ -210044,7 +210139,7 @@ async function inferExcludeDirsFromConfigurationFiles(rootWorkingDir) {
|
|
|
210044
210139
|
}
|
|
210045
210140
|
async function inferExcludeDirsFromSocketConfig(socketConfigFile) {
|
|
210046
210141
|
try {
|
|
210047
|
-
const config3 = (0, import_yaml2.parse)(await
|
|
210142
|
+
const config3 = (0, import_yaml2.parse)(await readFile23(socketConfigFile, "utf8"));
|
|
210048
210143
|
const version3 = config3.version;
|
|
210049
210144
|
const ignorePaths = config3[version3 === 1 ? "ignore" : "projectIgnorePaths"];
|
|
210050
210145
|
if (!ignorePaths)
|
|
@@ -210601,7 +210696,7 @@ function toSocketFactsSocketDependencyTree(artifacts, vulnerabilities, tier1Reac
|
|
|
210601
210696
|
}
|
|
210602
210697
|
|
|
210603
210698
|
// dist/internal/vulnerability-scanning.js
|
|
210604
|
-
import { readFile as
|
|
210699
|
+
import { readFile as readFile24 } from "fs/promises";
|
|
210605
210700
|
|
|
210606
210701
|
// ../security-auditor/security-auditor-builder/src/mongo-connection.ts
|
|
210607
210702
|
var import_mongodb = __toESM(require_lib30(), 1);
|
|
@@ -225470,7 +225565,7 @@ async function scanForVulnerabilities(dependencyTree, offlineVulnerabilityScanne
|
|
|
225470
225565
|
}
|
|
225471
225566
|
async function offlineScan(dependencyTree, offlineVulnerabilityScannerDBPath) {
|
|
225472
225567
|
logger.info("using offline vulnerability scanner db");
|
|
225473
|
-
const offlineVulnerabilityScannerDB = JSON.parse(await
|
|
225568
|
+
const offlineVulnerabilityScannerDB = JSON.parse(await readFile24(offlineVulnerabilityScannerDBPath, "utf-8"));
|
|
225474
225569
|
const { ecosystemToUrlToVulnerabilityDetails, vulnerabilityDatabase } = offlineVulnerabilityScannerDB;
|
|
225475
225570
|
const coanaSupportedVulnerabilitiesLoader = CoanaSupportedVulnerabilitiesLoader.create(ecosystemToUrlToVulnerabilityDetails);
|
|
225476
225571
|
const vulnerabilityAccessPathLoader = CoanaSupportedVulnerabilitiesLoader.create(ecosystemToUrlToVulnerabilityDetails);
|
|
@@ -225488,7 +225583,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
225488
225583
|
}
|
|
225489
225584
|
|
|
225490
225585
|
// dist/version.js
|
|
225491
|
-
var version2 = "14.12.
|
|
225586
|
+
var version2 = "14.12.1";
|
|
225492
225587
|
|
|
225493
225588
|
// dist/cli-core.js
|
|
225494
225589
|
var { mapValues, omit, partition, pick } = import_lodash15.default;
|
|
@@ -225677,24 +225772,12 @@ var CliCore = class {
|
|
|
225677
225772
|
await writeFile9(outputFile, JSON.stringify(socketReport, null, 2));
|
|
225678
225773
|
logger.info(kleur_default.green(`Socket report written to: ${outputFile}`));
|
|
225679
225774
|
}
|
|
225680
|
-
async getLogContent() {
|
|
225681
|
-
await logger.finish();
|
|
225682
|
-
let logContent;
|
|
225683
|
-
try {
|
|
225684
|
-
logContent = await readFile23(this.coanaLogPath, "utf-8");
|
|
225685
|
-
} catch (e) {
|
|
225686
|
-
this.spinner.suspend(() => {
|
|
225687
|
-
console.error("Error reading log file", e);
|
|
225688
|
-
});
|
|
225689
|
-
}
|
|
225690
|
-
return logContent;
|
|
225691
|
-
}
|
|
225692
225775
|
async shareErrorLogWithBackend(e, shouldLogSharing) {
|
|
225693
|
-
await this.dashboardAPI.sendErrorReport(this.apiKey, e.stack ?? e.message ?? "Unknown stack trace", shouldLogSharing, this.reportId, this.options.repoUrl, this.options.projectName, await
|
|
225776
|
+
await this.dashboardAPI.sendErrorReport(this.apiKey, e.stack ?? e.message ?? "Unknown stack trace", shouldLogSharing, this.reportId, this.options.repoUrl, this.options.projectName, await logger.getLogContent(this.coanaLogPath));
|
|
225694
225777
|
}
|
|
225695
225778
|
async shareLogWithDashboard() {
|
|
225696
225779
|
if (this.reportId)
|
|
225697
|
-
await sendLogToDashboard(await
|
|
225780
|
+
await sendLogToDashboard(await logger.getLogContent(this.coanaLogPath), this.reportId, this.apiKey);
|
|
225698
225781
|
}
|
|
225699
225782
|
async outputAndShareReport(report, subPjToWsPathToDirectDependencies) {
|
|
225700
225783
|
const outputDir = this.options.outputDir;
|
|
@@ -226185,41 +226268,62 @@ async function getGitDataToMetadataIfAvailable(rootWorkingDirectory) {
|
|
|
226185
226268
|
// dist/cli-upgrade-purl.js
|
|
226186
226269
|
import { join as join25, relative as relative12 } from "node:path";
|
|
226187
226270
|
var import_packageurl_js2 = __toESM(require_packageurl_js(), 1);
|
|
226188
|
-
async function upgradePurl(path2, upgrades, options) {
|
|
226271
|
+
async function upgradePurl(path2, upgrades, options, logFile, cliFixRunId) {
|
|
226189
226272
|
logger.initWinstonLogger(options.debug);
|
|
226190
226273
|
logger.silent = options.silent;
|
|
226274
|
+
let cliRunId = cliFixRunId;
|
|
226275
|
+
if (!cliRunId && options.manifestsTarHash) {
|
|
226276
|
+
cliRunId = await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, path2, options, "upgrade-purls");
|
|
226277
|
+
}
|
|
226278
|
+
const upgradePurlRunId = cliRunId && await getSocketAPI().registerUpgradePurlRun(cliRunId, upgrades);
|
|
226191
226279
|
Spinner.instance({ text: "Running Coana Upgrade Purl CLI", isSilent: options.silent }).start();
|
|
226192
226280
|
try {
|
|
226193
226281
|
logger.info(`Upgrading purls for ${path2}:
|
|
226194
226282
|
${upgrades.map((upgrade) => ` ${upgrade.purl} -> ${upgrade.upgradeVersion}`).join("\n")}`);
|
|
226195
226283
|
if (options.manifestsTarHash) {
|
|
226196
|
-
|
|
226197
|
-
|
|
226198
|
-
|
|
226199
|
-
|
|
226200
|
-
|
|
226201
|
-
|
|
226202
|
-
|
|
226203
|
-
|
|
226204
|
-
|
|
226205
|
-
|
|
226206
|
-
|
|
226207
|
-
|
|
226208
|
-
|
|
226209
|
-
|
|
226210
|
-
|
|
226211
|
-
|
|
226212
|
-
|
|
226284
|
+
try {
|
|
226285
|
+
const purlToUpgradeVersion = new Map(upgrades.map((upgrade) => [upgrade.purl, upgrade.upgradeVersion]));
|
|
226286
|
+
const { artifacts } = await fetchArtifactsFromSocket(path2, options.manifestsTarHash);
|
|
226287
|
+
const ecosystemToSocketArtifactUpgrades = {};
|
|
226288
|
+
artifacts.forEach((artifact, idx) => {
|
|
226289
|
+
if (!artifact.name)
|
|
226290
|
+
return;
|
|
226291
|
+
const purl = new import_packageurl_js2.PackageURL(artifact.type, artifact.namespace, artifact.name, artifact.version, artifact.qualifiers).toString();
|
|
226292
|
+
const upgradeVersion = purlToUpgradeVersion.get(purl);
|
|
226293
|
+
if (!upgradeVersion)
|
|
226294
|
+
return;
|
|
226295
|
+
const ecosystem = getAdvisoryEcosystemFromPurlType(artifact.type);
|
|
226296
|
+
if (!ecosystem)
|
|
226297
|
+
return;
|
|
226298
|
+
ecosystemToSocketArtifactUpgrades[ecosystem] ??= [];
|
|
226299
|
+
ecosystemToSocketArtifactUpgrades[ecosystem].push({
|
|
226300
|
+
idx,
|
|
226301
|
+
upgradeVersion
|
|
226302
|
+
});
|
|
226213
226303
|
});
|
|
226214
|
-
|
|
226215
|
-
|
|
226216
|
-
|
|
226217
|
-
|
|
226218
|
-
|
|
226219
|
-
|
|
226304
|
+
for (const [ecosystem, upgrades2] of Object.entries(ecosystemToSocketArtifactUpgrades)) {
|
|
226305
|
+
if (["NPM", "MAVEN"].includes(ecosystem)) {
|
|
226306
|
+
await applySocketUpgrades(ecosystem, path2, upgrades2, artifacts);
|
|
226307
|
+
} else {
|
|
226308
|
+
logger.warn(`Unsupported ecosystem ${ecosystem} for socket upgrades`);
|
|
226309
|
+
}
|
|
226310
|
+
}
|
|
226311
|
+
if (upgradePurlRunId) {
|
|
226312
|
+
await getSocketAPI().finalizeUpgradePurlRun(upgradePurlRunId, "success");
|
|
226220
226313
|
}
|
|
226314
|
+
return;
|
|
226315
|
+
} catch (error) {
|
|
226316
|
+
if (upgradePurlRunId) {
|
|
226317
|
+
await getSocketAPI().finalizeUpgradePurlRun(
|
|
226318
|
+
upgradePurlRunId,
|
|
226319
|
+
"error",
|
|
226320
|
+
!cliFixRunId ? error.stack : void 0,
|
|
226321
|
+
// do not send stack trace and logContent for computeFixes runs, as that will be handled by that command.
|
|
226322
|
+
!cliFixRunId && logFile ? await logger.getLogContent(logFile) : void 0
|
|
226323
|
+
);
|
|
226324
|
+
}
|
|
226325
|
+
throw error;
|
|
226221
226326
|
}
|
|
226222
|
-
return;
|
|
226223
226327
|
}
|
|
226224
226328
|
const otherModulesCommunicator = new OtherModulesCommunicator(path2, options, {
|
|
226225
226329
|
type: "missing"
|
|
@@ -226290,7 +226394,8 @@ ${vulnerabilityFixes.map((fix) => ` ${fix.dependencyName} from ${fix.currentVers
|
|
|
226290
226394
|
};
|
|
226291
226395
|
|
|
226292
226396
|
// dist/cli-compute-fixes-and-upgrade-purls.js
|
|
226293
|
-
async function computeFixesAndUpgradePurls(path2, options) {
|
|
226397
|
+
async function computeFixesAndUpgradePurls(path2, options, logFile) {
|
|
226398
|
+
const autofixRunId = options.manifestsTarHash && await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, path2, options, "autofix");
|
|
226294
226399
|
const { artifacts, ghsaToVulnerableArtifactIds } = await computeInputForComputingFixes(path2, options);
|
|
226295
226400
|
if (Object.keys(ghsaToVulnerableArtifactIds).length === 0) {
|
|
226296
226401
|
logger.info("No vulnerabilities to compute fixes for");
|
|
@@ -226302,7 +226407,7 @@ async function computeFixesAndUpgradePurls(path2, options) {
|
|
|
226302
226407
|
return;
|
|
226303
226408
|
}
|
|
226304
226409
|
const ghsaToVulnerableArtifactIdsToApply = options.applyFixesTo.includes("all") ? ghsaToVulnerableArtifactIds : Object.fromEntries(Object.entries(ghsaToVulnerableArtifactIds).filter(([ghsa]) => options.applyFixesTo.includes(ghsa)));
|
|
226305
|
-
const computedFix = await useSocketComputeFixEndpoint(artifacts, ghsaToVulnerableArtifactIdsToApply);
|
|
226410
|
+
const computedFix = await useSocketComputeFixEndpoint(autofixRunId, artifacts, ghsaToVulnerableArtifactIdsToApply);
|
|
226306
226411
|
if (computedFix.type !== "success") {
|
|
226307
226412
|
throw new Error(`No fix found for the given vulnerabilities`);
|
|
226308
226413
|
}
|
|
@@ -226335,8 +226440,14 @@ async function computeFixesAndUpgradePurls(path2, options) {
|
|
|
226335
226440
|
manifestsTarHash: options.manifestsTarHash,
|
|
226336
226441
|
concurrency: "1",
|
|
226337
226442
|
globPattern: options.globPattern
|
|
226338
|
-
});
|
|
226443
|
+
}, autofixRunId);
|
|
226444
|
+
if (autofixRunId) {
|
|
226445
|
+
await getSocketAPI().finalizeAutofixRun(autofixRunId, ghsasFailedToFix.length === 0 ? "fixed-all" : ghsasFailedToFix.length === Object.keys(ghsaToVulnerableArtifactIdsToApply).length ? "fixed-none" : "fixed-some");
|
|
226446
|
+
}
|
|
226339
226447
|
} catch (error) {
|
|
226448
|
+
if (autofixRunId) {
|
|
226449
|
+
await getSocketAPI().finalizeAutofixRun(autofixRunId, "error", error.stack, await logger.getLogContent(logFile));
|
|
226450
|
+
}
|
|
226340
226451
|
logger.error("Error applying fixes:", error);
|
|
226341
226452
|
throw error;
|
|
226342
226453
|
}
|
|
@@ -226434,6 +226545,7 @@ function computeSBOMTaskArtifacts(dependencyTrees) {
|
|
|
226434
226545
|
}
|
|
226435
226546
|
|
|
226436
226547
|
// dist/index.js
|
|
226548
|
+
import { join as join26 } from "path";
|
|
226437
226549
|
var program2 = new Command();
|
|
226438
226550
|
var run2 = new Command();
|
|
226439
226551
|
run2.name("run").argument("<path>", "File system path to folder containing the project").option("-o, --output-dir <path>", "Write json report to <path>/coana-report.json").option("-d, --debug", "Enable debug logging", false).option("-s, --silent", "Silence all debug/warning output", false).option("-p, --print-report", "Print the report to the console", false).option("--offline-database <path>", "Path to a coana-offline-db.json file for running the CLI without internet connectivity", void 0).option("-t, --timeout <timeout>", "Set API <timeout> in milliseconds to Coana backend.", "300000").option("-a, --analysis-timeout <timeout>", "Set <timeout> in seconds for each reachability analysis run").option("--memory-limit <memoryInMB>", "Set memory limit for analysis to <memoryInMB> megabytes of memory.", "8192").option("-c, --concurrency <concurrency>", "Set the maximum number of concurrent reachability analysis runs. It's recommended to choose a concurrency level that ensures that each analysis run has at least the --memory-limit amount of memory available.", "1").option("--api-key <key>", "Set the Coana dashboard API key. By setting you also enable the dashboard integration.").addOption(new Option("--write-report-to-file", "Write the report dashboard-compatible report to dashboard-report.json. This report may help the Coana team debug issues with the report insertion mechanism.").default(false).hideHelp()).option("--project-name <repoName>", "Set the name of the repository. Used for dashboard integration.").option("--repo-url <repoUrl>", "Set the URL of the repository. Used for dashboard integration.").option("--include-dirs <relativeDirs...>", "globs for directories to include from the detection of subprojects (space-separated)(use relative paths from the project root). Notice, projects that are not included may still be scanned if they are referenced from included projects.").option("--exclude-dirs <relativeDirs...>", "globs for directories to exclude from the detection of subprojects (space-separated)(use relative paths from the project root). Notice, excluded projects may still be scanned if they are referenced from non-excluded projects.").option("--disable-analysis-splitting", "Limits Coana to at most 1 reachability analysis run per workspace").option("--print-analysis-log-file", "Store log output from the JavaScript/TypeScript reachability analysis in the file js-analysis.log file in the root of each workspace", false).option("--entry-points <entryPoints...>", "List of files to analyze for root workspace. The reachability analysis automatically analyzes all files used by the entry points. If not provided, all JavaScript and TypeScript files are considered entry points. For non-root workspaces, all JavaScript and TypeScript files are analyzed as well.").option("--include-projects-with-no-reachability-support", "Also runs Coana on projects where we support traditional SCA, but does not yet support reachability analysis.", false).option("--ecosystems <ecosystems...>", "List of ecosystems to analyze (space-separated). Currently NPM, PIP, MAVEN, NUGET and GO are supported. Default is all supported ecosystems.").addOption(new Option("--purl-types <purlTypes...>", "List of PURL types to analyze (space-separated). Currently npm, pypi, maven, nuget, golang and cargo are supported. Default is all supported purl types.").hideHelp()).option("--changed-files <files...>", "List of files that have changed. If provided, Coana only analyzes workspaces and modules that contain changed files.").option("--disable-report-submission", "Disable the submission of the report to the Coana dashboard. Used by the pipeline blocking feature.", false).option("--disable-analytics-sharing", "Disable analytics sharing.", false).option("--provider-project <path>", "File system path to folder containing the provider project (Only supported for Maven, Gradle, and SBT)").option("--provider-workspaces <dirs...>", "List of workspaces that build the provided runtime environment (Only supported for Maven, Gradle, and SBT)", (paths) => paths.split(" ")).option("--lightweight-reachability", "Runs Coana in lightweight mode. This increases analysis speed but also raises the risk of Coana misclassifying the reachability of certain complex vulnerabilities. Recommended only for use with Coana Guardrail mode.", false).addOption(new Option("--run-without-docker", "Run package managers and reachability analyzers without using docker").default(process.env.RUN_WITHOUT_DOCKER === "true").hideHelp()).addOption(new Option("--run-env <env>", "Specifies the environment in which the CLI is run. So far only MANAGED_SCAN and UNKNOWN are supported.").default("UNKNOWN").choices(["UNKNOWN", "MANAGED_SCAN"]).hideHelp()).addOption(new Option("--guardrail-mode", "Run Coana in guardrail mode. This mode is used to prevent new reachable vulnerabilities from being introduced into the codebase. Usually run as a CI check when pushing new commits to a pull request.")).option("--ignore-failing-workspaces", "Continue processing when a workspace fails instead of exiting. Failed workspaces will be logged at termination.", false).addOption(new Option("--socket-mode <output-file>", "Run Coana in socket mode and write report to <output-file>").hideHelp()).addOption(new Option("--manifests-tar-hash <hash>", "Hash of the tarball containing all manifest files already uploaded to Socket. If provided, Socket will be used for computing dependency trees.").hideHelp()).version(version2).configureHelp({ sortOptions: true }).action(async (path2, options) => {
|
|
@@ -226450,26 +226562,34 @@ applyFixes.name("apply-fixes").argument("<path>", "File system path to the folde
|
|
|
226450
226562
|
var upgradePurls = new Command();
|
|
226451
226563
|
upgradePurls.name("upgrade-purls").argument("<path>", "File system path to the folder containing the project").argument("<specs...>", "Package upgrade specifications in the format 'purl -> newVersion' (e.g., 'pkg:maven/io.micrometer/micrometer-core@1.10.9 -> 1.15.0')").option("-g, --glob <pattern>", "Glob pattern to filter workspaces by absolute file path").option("-c, --concurrency <concurrency>", "Set the maximum number of concurrent reachability analysis runs. It's recommended to choose a concurrency level that ensures that each analysis run has at least the --memory-limit amount of memory available.", "1").option("-d, --debug", "Enable debug logging", false).option("-s, --silent", "Silence all debug/warning output", false).addOption(new Option("--run-without-docker", "Run package managers without using docker").default(process.env.RUN_WITHOUT_DOCKER === "true").hideHelp()).addOption(new Option("--socket-mode", "Use Socket for computing dependency trees").default(process.env.SOCKET_MODE === "true").hideHelp()).version(version2).action(async (path2, specs2, options) => {
|
|
226452
226564
|
process.env.DOCKER_IMAGE_TAG ??= version2;
|
|
226453
|
-
|
|
226454
|
-
const
|
|
226455
|
-
|
|
226456
|
-
|
|
226457
|
-
|
|
226458
|
-
|
|
226459
|
-
|
|
226460
|
-
|
|
226565
|
+
await withTmpDirectory("upgrade-purls", async (tmpDir) => {
|
|
226566
|
+
const logFile = join26(tmpDir, "upgrade-purls.log");
|
|
226567
|
+
logger.initWinstonLogger(options.debug, logFile);
|
|
226568
|
+
const upgradeSpecs = specs2.map((spec) => {
|
|
226569
|
+
const [purl, upgradeVersion] = spec.split("->").map((s4) => s4.trim());
|
|
226570
|
+
if (!upgradeVersion)
|
|
226571
|
+
throw Error("Upgrade version not specified");
|
|
226572
|
+
return {
|
|
226573
|
+
purl,
|
|
226574
|
+
upgradeVersion
|
|
226575
|
+
};
|
|
226576
|
+
});
|
|
226577
|
+
await upgradePurl(path2, upgradeSpecs, options, logFile);
|
|
226461
226578
|
});
|
|
226462
|
-
await upgradePurl(path2, upgradeSpecs, options);
|
|
226463
226579
|
}).configureHelp({ sortOptions: true });
|
|
226464
226580
|
var computeFixesAndUpgradePurlsCmd = new Command();
|
|
226465
226581
|
computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument("<path>", "File system path to the folder containing the project").option("-a, --apply-fixes-to <ghsas...>", 'GHSA IDs to compute fixes for. Use "all" to compute fixes for all vulnerabilities.', []).option("--dry-run", "Show what changes would be made without actually making them", false).option("-g, --glob <pattern>", "Glob pattern to filter workspaces by absolute file path").option("-d, --debug", "Enable debug logging", false).option("-s, --silent", "Silence all debug/warning output", false).addOption(new Option("--run-without-docker", "Run package managers without using docker").default(process.env.RUN_WITHOUT_DOCKER === "true").hideHelp()).addOption(new Option("--manifests-tar-hash <hash>", "Hash of the tarball containing all manifest files already uploaded to Socket. If provided, Socket will be used for computing dependency trees.").hideHelp()).version(version2).action(async (path2, options) => {
|
|
226466
226582
|
process.env.DOCKER_IMAGE_TAG ??= version2;
|
|
226467
|
-
await
|
|
226583
|
+
await withTmpDirectory("compute-fixes-and-upgrade-purls", async (tmpDir) => {
|
|
226584
|
+
const logFile = join26(tmpDir, "compute-fixes-and-upgrade-purls.log");
|
|
226585
|
+
logger.initWinstonLogger(options.debug, logFile);
|
|
226586
|
+
await computeFixesAndUpgradePurls(path2, options, logFile);
|
|
226587
|
+
});
|
|
226468
226588
|
}).configureHelp({ sortOptions: true });
|
|
226469
226589
|
var compareReportsCommand = new Command();
|
|
226470
226590
|
compareReportsCommand.name("compare-reports").argument("<baselineReportPath>", "Path to the baseline report").argument("<newReportPath>", "Path to the new report").option("--api-key <key>", "Set the Coana dashboard API key.").option("-d, --debug", "Enable debug logging", false).option("--no-pr-comment", "Disable pull request comments (only relevant when run from a PR)", true).option("--no-block", "Do not fail with a non-zero exit code when new reachable vulnerabilities are detected", true).option("--ignore-undeterminable-reachability", "Ignore vulnerabilities with undeterminable reachability", false).action(async (baselineReportPath, newReportPath, options) => {
|
|
226471
226591
|
async function readReport(reportPath) {
|
|
226472
|
-
return JSON.parse(await
|
|
226592
|
+
return JSON.parse(await readFile25(reportPath, "utf-8"));
|
|
226473
226593
|
}
|
|
226474
226594
|
const baselineReport = await readReport(baselineReportPath);
|
|
226475
226595
|
const newReport = await readReport(newReportPath);
|