@coana-tech/cli 14.12.160 → 14.12.162

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.160",
3
+ "version": "14.12.162",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -75394,7 +75394,7 @@ var {
75394
75394
  } = import_index.default;
75395
75395
 
75396
75396
  // dist/reachability-analyzers-cli.js
75397
- import { readFile as readFile14, writeFile as writeFile10 } from "fs/promises";
75397
+ import { readFile as readFile15, writeFile as writeFile10 } from "fs/promises";
75398
75398
 
75399
75399
  // ../web-compat-utils/src/logger-singleton.ts
75400
75400
  var import_winston = __toESM(require_winston(), 1);
@@ -80900,6 +80900,7 @@ import { execFile as execFile2 } from "child_process";
80900
80900
 
80901
80901
  // ../utils/src/telemetry/telemetry-collector.ts
80902
80902
  import { execFile } from "child_process";
80903
+ import { readFile as readFile3 } from "fs/promises";
80903
80904
  import { platform } from "process";
80904
80905
  import { promisify } from "util";
80905
80906
  var execFileAsync = promisify(execFile);
@@ -80907,14 +80908,44 @@ var TelemetryCollector = class _TelemetryCollector {
80907
80908
  constructor(pid) {
80908
80909
  this.pid = pid;
80909
80910
  }
80911
+ previousCpuState;
80912
+ clockTicksPerSecond;
80913
+ pageSize;
80914
+ isCollecting = false;
80910
80915
  static create(pid) {
80911
- if (!Number.isInteger(pid) || pid <= 0 || !["darwin", "linux"].includes(platform)) return void 0;
80916
+ if (!Number.isInteger(pid) || pid <= 0 || !["darwin", "linux", "win32"].includes(platform)) return void 0;
80912
80917
  return new _TelemetryCollector(pid);
80913
80918
  }
80914
80919
  /**
80915
- * Collect metrics for a Unix-like system (macOS, Linux) using ps command.
80920
+ * Collect metrics for the child process.
80921
+ * Uses OS-specific methods to query memory and CPU usage.
80916
80922
  */
80917
80923
  async collectChildProcessMetrics() {
80924
+ if (this.isCollecting) {
80925
+ return void 0;
80926
+ }
80927
+ this.isCollecting = true;
80928
+ try {
80929
+ if (platform === "darwin") {
80930
+ return await this.collectDarwinProcessMetrics();
80931
+ }
80932
+ if (platform === "linux") {
80933
+ return await this.collectLinuxProcessMetrics();
80934
+ }
80935
+ if (platform === "win32") {
80936
+ return await this.collectWindowsProcessMetrics();
80937
+ }
80938
+ return void 0;
80939
+ } catch {
80940
+ return void 0;
80941
+ } finally {
80942
+ this.isCollecting = false;
80943
+ }
80944
+ }
80945
+ /**
80946
+ * Collect metrics on macOS using ps command.
80947
+ */
80948
+ async collectDarwinProcessMetrics() {
80918
80949
  try {
80919
80950
  const { stdout } = await execFileAsync("ps", ["-o", "rss=,pcpu=", "-p", String(this.pid)], {
80920
80951
  timeout: 5e3
@@ -80934,6 +80965,142 @@ var TelemetryCollector = class _TelemetryCollector {
80934
80965
  return void 0;
80935
80966
  }
80936
80967
  }
80968
+ /**
80969
+ * Collect metrics on Linux using /proc filesystem.
80970
+ * This works on all Linux distributions including Alpine (BusyBox).
80971
+ */
80972
+ async collectLinuxProcessMetrics() {
80973
+ try {
80974
+ const statmContent = await readFile3(`/proc/${this.pid}/statm`, "utf-8");
80975
+ const statmParts = statmContent.trim().split(/\s+/);
80976
+ if (statmParts.length < 2) {
80977
+ return void 0;
80978
+ }
80979
+ const residentPages = parseInt(statmParts[1], 10);
80980
+ if (isNaN(residentPages)) {
80981
+ return void 0;
80982
+ }
80983
+ const pageSize = await this.getPageSize();
80984
+ const rssBytes = residentPages * pageSize;
80985
+ const statContent = await readFile3(`/proc/${this.pid}/stat`, "utf-8");
80986
+ const cpuPercent = await this.calculateCpuPercent(statContent);
80987
+ return {
80988
+ rss: rssBytes,
80989
+ cpuPercent
80990
+ };
80991
+ } catch {
80992
+ return void 0;
80993
+ }
80994
+ }
80995
+ /**
80996
+ * Collect metrics on Windows using PowerShell.
80997
+ * Uses Get-Process for memory and CPU time tracking for CPU%.
80998
+ */
80999
+ async collectWindowsProcessMetrics() {
81000
+ try {
81001
+ const psScript = "$p = Get-Process -Id $args[0] -ErrorAction Stop; @{WorkingSet64=$p.WorkingSet64; TotalMs=$p.TotalProcessorTime.TotalMilliseconds} | ConvertTo-Json";
81002
+ const { stdout } = await execFileAsync(
81003
+ "powershell",
81004
+ ["-NoProfile", "-Command", psScript, String(this.pid)],
81005
+ { timeout: 5e3 }
81006
+ );
81007
+ const trimmed = stdout.trim();
81008
+ if (!trimmed) {
81009
+ return void 0;
81010
+ }
81011
+ const data2 = JSON.parse(trimmed);
81012
+ const rssBytes = data2.WorkingSet64;
81013
+ const totalCpuMs = data2.TotalMs;
81014
+ if (typeof rssBytes !== "number" || typeof totalCpuMs !== "number") {
81015
+ return void 0;
81016
+ }
81017
+ const now = Date.now();
81018
+ const currentState = { totalCpuTime: totalCpuMs, timestamp: now };
81019
+ let cpuPercent = 0;
81020
+ if (this.previousCpuState) {
81021
+ const timeDeltaMs = now - this.previousCpuState.timestamp;
81022
+ const cpuTimeDelta = totalCpuMs - this.previousCpuState.totalCpuTime;
81023
+ if (timeDeltaMs > 0 && cpuTimeDelta >= 0) {
81024
+ cpuPercent = Math.max(0, cpuTimeDelta / timeDeltaMs * 100);
81025
+ }
81026
+ }
81027
+ this.previousCpuState = currentState;
81028
+ return {
81029
+ rss: rssBytes,
81030
+ cpuPercent
81031
+ };
81032
+ } catch {
81033
+ return void 0;
81034
+ }
81035
+ }
81036
+ /**
81037
+ * Calculate CPU percentage from /proc/<pid>/stat.
81038
+ * Requires tracking state between calls to compute the delta.
81039
+ */
81040
+ async calculateCpuPercent(statContent) {
81041
+ try {
81042
+ const lastParen = statContent.lastIndexOf(")");
81043
+ if (lastParen === -1) {
81044
+ return 0;
81045
+ }
81046
+ const fieldsAfterComm = statContent.slice(lastParen + 2).split(/\s+/);
81047
+ const utime = parseInt(fieldsAfterComm[11], 10);
81048
+ const stime = parseInt(fieldsAfterComm[12], 10);
81049
+ if (isNaN(utime) || isNaN(stime)) {
81050
+ return 0;
81051
+ }
81052
+ const totalCpuTime = utime + stime;
81053
+ const now = Date.now();
81054
+ const clockTicks = await this.getClockTicksPerSecond();
81055
+ const currentState = { totalCpuTime, timestamp: now };
81056
+ if (!this.previousCpuState) {
81057
+ this.previousCpuState = currentState;
81058
+ return 0;
81059
+ }
81060
+ const timeDeltaMs = now - this.previousCpuState.timestamp;
81061
+ const cpuTimeDelta = totalCpuTime - this.previousCpuState.totalCpuTime;
81062
+ this.previousCpuState = currentState;
81063
+ if (timeDeltaMs <= 0 || cpuTimeDelta < 0) {
81064
+ return 0;
81065
+ }
81066
+ const cpuPercent = cpuTimeDelta * 1e3 * 100 / (clockTicks * timeDeltaMs);
81067
+ return Math.max(0, cpuPercent);
81068
+ } catch {
81069
+ return 0;
81070
+ }
81071
+ }
81072
+ /**
81073
+ * Get the system page size in bytes (cached after first call).
81074
+ */
81075
+ async getPageSize() {
81076
+ if (this.pageSize !== void 0) {
81077
+ return this.pageSize;
81078
+ }
81079
+ try {
81080
+ const { stdout } = await execFileAsync("getconf", ["PAGE_SIZE"], { timeout: 1e3 });
81081
+ const parsed = parseInt(stdout.trim(), 10);
81082
+ this.pageSize = isNaN(parsed) ? 4096 : parsed;
81083
+ } catch {
81084
+ this.pageSize = 4096;
81085
+ }
81086
+ return this.pageSize;
81087
+ }
81088
+ /**
81089
+ * Get the number of clock ticks per second (used for CPU time conversion).
81090
+ */
81091
+ async getClockTicksPerSecond() {
81092
+ if (this.clockTicksPerSecond !== void 0) {
81093
+ return this.clockTicksPerSecond;
81094
+ }
81095
+ try {
81096
+ const { stdout } = await execFileAsync("getconf", ["CLK_TCK"], { timeout: 1e3 });
81097
+ const ticks = parseInt(stdout.trim(), 10);
81098
+ this.clockTicksPerSecond = isNaN(ticks) ? 100 : ticks;
81099
+ } catch {
81100
+ this.clockTicksPerSecond = 100;
81101
+ }
81102
+ return this.clockTicksPerSecond;
81103
+ }
80937
81104
  };
80938
81105
 
80939
81106
  // ../utils/src/telemetry/analyzer-telemetry-server.ts
@@ -87921,7 +88088,7 @@ import { resolve as resolve19 } from "path";
87921
88088
 
87922
88089
  // ../utils/src/pip-utils.ts
87923
88090
  import { existsSync as existsSync3 } from "node:fs";
87924
- import { readFile as readFile4 } from "node:fs/promises";
88091
+ import { readFile as readFile5 } from "node:fs/promises";
87925
88092
  import { dirname, resolve as resolve3 } from "node:path";
87926
88093
  import util4 from "node:util";
87927
88094
 
@@ -87930,7 +88097,7 @@ var import_lodash4 = __toESM(require_lodash(), 1);
87930
88097
  var import_semver = __toESM(require_semver4(), 1);
87931
88098
  import { execFileSync } from "child_process";
87932
88099
  import { constants as constants2 } from "fs";
87933
- import { access as access2, readFile as readFile3 } from "fs/promises";
88100
+ import { access as access2, readFile as readFile4 } from "fs/promises";
87934
88101
  import { join as join5, resolve as resolve2 } from "path";
87935
88102
  import util3 from "util";
87936
88103
  var { once } = import_lodash4.default;
@@ -87978,7 +88145,7 @@ var PythonVersionsManager = class _PythonVersionsManager {
87978
88145
  const absPath = resolve2(this.projectDir, workspacePath);
87979
88146
  for (const parent2 of parents(absPath))
87980
88147
  try {
87981
- return [(await readFile3(join5(parent2, ".python-version"), "utf-8")).split("\n")[0].trim()];
88148
+ return [(await readFile4(join5(parent2, ".python-version"), "utf-8")).split("\n")[0].trim()];
87982
88149
  } catch (e) {
87983
88150
  if (e.code !== "ENOENT") logger.warn("Failed to read python version file with error", e);
87984
88151
  }
@@ -88338,7 +88505,7 @@ function addPathToTrie(root3, vulnPath) {
88338
88505
  var import_lodash14 = __toESM(require_lodash(), 1);
88339
88506
  import assert6 from "assert";
88340
88507
  import { existsSync as existsSync13 } from "fs";
88341
- import { cp as cp7, readdir as readdir4, readFile as readFile11, rm as rm5 } from "fs/promises";
88508
+ import { cp as cp7, readdir as readdir4, readFile as readFile12, rm as rm5 } from "fs/promises";
88342
88509
  var import_semver3 = __toESM(require_semver2(), 1);
88343
88510
  import { basename as basename11, dirname as dirname15, join as join17, resolve as resolve17, sep as sep5 } from "path";
88344
88511
  import util5 from "util";
@@ -94010,7 +94177,7 @@ var CocoaHeuristics = {
94010
94177
 
94011
94178
  // dist/whole-program-code-aware-vulnerability-scanner/dotnet/dotnet-code-aware-vulnerability-scanner.js
94012
94179
  var import_adm_zip = __toESM(require_adm_zip(), 1);
94013
- import { mkdir as mkdir5, readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
94180
+ import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile5 } from "fs/promises";
94014
94181
  import { randomUUID } from "node:crypto";
94015
94182
 
94016
94183
  // dist/whole-program-code-aware-vulnerability-scanner/dotnet/constants.js
@@ -94028,7 +94195,7 @@ function getClassGraphAnalysisCliPath() {
94028
94195
 
94029
94196
  // ../utils/src/nuget-project-utils.ts
94030
94197
  var import_parse_xml2 = __toESM(require_dist(), 1);
94031
- import { readFile as readFile5 } from "node:fs/promises";
94198
+ import { readFile as readFile6 } from "node:fs/promises";
94032
94199
  import { dirname as dirname9, join as join12, relative as relative5, resolve as resolve8, basename as basename6, extname as extname2 } from "node:path";
94033
94200
 
94034
94201
  // ../utils/src/xml-utils.ts
@@ -95688,7 +95855,7 @@ async function loadNuGetProjectOrTarget(rootDir, projectFile, mainProject, visit
95688
95855
  if (!validatedProjectPath || !existsSync6(validatedProjectPath)) return void 0;
95689
95856
  if (visited.has(validatedProjectPath)) return void 0;
95690
95857
  visited.set(validatedProjectPath);
95691
- const sourceText = await readFile5(validatedProjectPath, "utf-8");
95858
+ const sourceText = await readFile6(validatedProjectPath, "utf-8");
95692
95859
  const xml2 = (0, import_parse_xml2.parseXml)(sourceText, { includeOffsets: true });
95693
95860
  const indentation = inferIndentationFromParsedXml(xml2, sourceText);
95694
95861
  const currentProject = {
@@ -96194,7 +96361,7 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
96194
96361
  const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.dotnet });
96195
96362
  if (result.error)
96196
96363
  return void 0;
96197
- const packageIds = JSON.parse(await readFile6(outputFile, "utf-8")).result;
96364
+ const packageIds = JSON.parse(await readFile7(outputFile, "utf-8")).result;
96198
96365
  return packageIds?.map((packageId) => this.depIdToPurl.get(packageId)).filter((purl) => purl !== void 0).map((purl) => purl.name ?? "");
96199
96366
  });
96200
96367
  }
@@ -96233,7 +96400,7 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
96233
96400
  const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetReachabilityAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.dotnet, telemetryHandler, analyzerTelemetryHandler });
96234
96401
  if (result.error)
96235
96402
  return { type: "error", message: result.error.message ?? "unknown error" };
96236
- const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile6(outputFile, "utf-8")).result;
96403
+ const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile7(outputFile, "utf-8")).result;
96237
96404
  if (!success)
96238
96405
  return { type: "error", message: error ?? "unknown error" };
96239
96406
  const affectedPurls = reachablePackageIds.map((packageId) => this.depIdToPurl.get(packageId)).filter((purl) => purl !== void 0);
@@ -96383,7 +96550,7 @@ async function convertSocketArtifacts(artifacts, tmpDir) {
96383
96550
  var import_lodash8 = __toESM(require_lodash(), 1);
96384
96551
  var import_adm_zip2 = __toESM(require_adm_zip(), 1);
96385
96552
  import { existsSync as existsSync9 } from "node:fs";
96386
- import { mkdir as mkdir6, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
96553
+ import { mkdir as mkdir6, readFile as readFile8, writeFile as writeFile6 } from "node:fs/promises";
96387
96554
  import { basename as basename8, dirname as dirname11, resolve as resolve10 } from "node:path";
96388
96555
 
96389
96556
  // ../../node_modules/.pnpm/cheerio@1.0.0-rc.12/node_modules/cheerio/lib/esm/options.js
@@ -110170,7 +110337,7 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
110170
110337
  const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runJvmDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${getJavapServicePath()} --tree-sitter-java ${getTreeSitterJavaPath()} --tree-sitter-kotlin ${getTreeSitterKotlinPath()} --tree-sitter-scala ${getTreeSitterScalaPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.java });
110171
110338
  if (result.error)
110172
110339
  return void 0;
110173
- const packageIds = JSON.parse(await readFile7(outputFile, "utf-8")).result;
110340
+ const packageIds = JSON.parse(await readFile8(outputFile, "utf-8")).result;
110174
110341
  return packageIds?.map((packageId) => this.depIdToPurl.get(packageId)).filter((purl) => purl !== void 0).map((purl) => `${purl.namespace}:${purl.name}}`);
110175
110342
  });
110176
110343
  }
@@ -110209,7 +110376,7 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
110209
110376
  const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runJvmReachabilityAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${getJavapServicePath()} --tree-sitter-java ${getTreeSitterJavaPath()} --tree-sitter-kotlin ${getTreeSitterKotlinPath()} --tree-sitter-scala ${getTreeSitterScalaPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.java, telemetryHandler, analyzerTelemetryHandler });
110210
110377
  if (result.error)
110211
110378
  return { type: "error", message: result.error.message ?? "unknown error" };
110212
- const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile7(outputFile, "utf-8")).result;
110379
+ const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile8(outputFile, "utf-8")).result;
110213
110380
  if (!success)
110214
110381
  return { type: "error", message: error ?? "unknown error" };
110215
110382
  const affectedPurls = reachablePackageIds.map((packageId) => this.depIdToPurl.get(packageId)).filter((purl) => purl !== void 0);
@@ -110790,7 +110957,7 @@ function computePackagesOnVulnPath(vulnerabilities, { includeLeafPackages = fals
110790
110957
  // dist/whole-program-code-aware-vulnerability-scanner/js/jelly-runner.js
110791
110958
  var import_lodash10 = __toESM(require_lodash(), 1);
110792
110959
  import assert4 from "assert";
110793
- import { readFile as readFile8, realpath as realpath2, rm as rm2, writeFile as writeFile7 } from "fs/promises";
110960
+ import { readFile as readFile9, realpath as realpath2, rm as rm2, writeFile as writeFile7 } from "fs/promises";
110794
110961
  import { relative as relative6, resolve as resolve13 } from "path";
110795
110962
  var { map: map2, uniq: uniq4 } = import_lodash10.default;
110796
110963
  var PRINT_JELLY_COMMAND = false;
@@ -110848,8 +111015,8 @@ async function runJellyAnalysis(mainProjectRoot, projectRoot, jellyOptions, reac
110848
111015
  );
110849
111016
  if (reachabilityAnalysisOptions.printLogFile)
110850
111017
  logger.info("JS analysis log file:", logFile);
110851
- const analysisDiagnostics = JSON.parse(await readFile8(diagnosticsFile, "utf-8"));
110852
- const callStacks = JSON.parse(await readFile8(callStackFile, "utf-8"));
111018
+ const analysisDiagnostics = JSON.parse(await readFile9(diagnosticsFile, "utf-8"));
111019
+ const callStacks = JSON.parse(await readFile9(callStackFile, "utf-8"));
110853
111020
  const matches = {};
110854
111021
  const realProjectRoot = await realpath2(projectRoot);
110855
111022
  for (const { vulnerability: { npm: { url: url2 } }, paths } of callStacks) {
@@ -110859,7 +111026,7 @@ async function runJellyAnalysis(mainProjectRoot, projectRoot, jellyOptions, reac
110859
111026
  else
110860
111027
  matches[url2] = transformedStacks;
110861
111028
  }
110862
- const affectedPackages = JSON.parse(await readFile8(affectedPackagesFile, "utf-8")).packages;
111029
+ const affectedPackages = JSON.parse(await readFile9(affectedPackagesFile, "utf-8")).packages;
110863
111030
  const affectedPurls = affectedJSPackagesToPurl(affectedPackages);
110864
111031
  return {
110865
111032
  matches,
@@ -110892,7 +111059,7 @@ async function runJellyPhantomDependencyAnalysis(projectRoot, options, telemetry
110892
111059
  telemetryHandler,
110893
111060
  analyzerTelemetryHandler
110894
111061
  });
110895
- return JSON.parse(await readFile8(reachablePackagesFile, "utf-8")).packages;
111062
+ return JSON.parse(await readFile9(reachablePackagesFile, "utf-8")).packages;
110896
111063
  } finally {
110897
111064
  await rm2(tmpFolder, { recursive: true });
110898
111065
  }
@@ -110915,7 +111082,7 @@ async function runJellyImportReachabilityAnalysis(mainProjectRoot, projectRoot,
110915
111082
  telemetryHandler,
110916
111083
  analyzerTelemetryHandler
110917
111084
  });
110918
- return JSON.parse(await readFile8(reachableModulesFile, "utf-8"));
111085
+ return JSON.parse(await readFile9(reachableModulesFile, "utf-8"));
110919
111086
  } finally {
110920
111087
  await rm2(tmpFolder, { recursive: true });
110921
111088
  }
@@ -111119,7 +111286,7 @@ function transformSourceLocations(fileMappings, detectedOccurrences) {
111119
111286
  var import_lodash11 = __toESM(require_lodash(), 1);
111120
111287
  import assert5 from "assert";
111121
111288
  import { existsSync as existsSync11, createReadStream as createReadStream2, createWriteStream as createWriteStream3 } from "fs";
111122
- import { readFile as readFile9, rm as rm4, cp as cp6 } from "fs/promises";
111289
+ import { readFile as readFile10, rm as rm4, cp as cp6 } from "fs/promises";
111123
111290
  import zlib2 from "zlib";
111124
111291
  import { join as join16, resolve as resolve14, sep as sep3 } from "path";
111125
111292
 
@@ -111196,11 +111363,11 @@ var GoCodeAwareVulnerabilityScanner = class {
111196
111363
  if (stderr)
111197
111364
  logger.debug(`Go code-aware analysis stderr
111198
111365
  ${stderr}`);
111199
- const diagnostics = JSON.parse(await readFile9(diagnosticsOutputFile, "utf8"));
111366
+ const diagnostics = JSON.parse(await readFile10(diagnosticsOutputFile, "utf8"));
111200
111367
  logger.debug("Diagnostics", diagnostics);
111201
- const result = JSON.parse(await readFile9(vulnsOutputFile, "utf8"));
111368
+ const result = JSON.parse(await readFile10(vulnsOutputFile, "utf8"));
111202
111369
  logger.debug("Analysis results", result);
111203
- const reachedModules = JSON.parse(await readFile9(reachedModulesOutputFile, "utf8"));
111370
+ const reachedModules = JSON.parse(await readFile10(reachedModulesOutputFile, "utf8"));
111204
111371
  logger.debug("Reached modules", reachedModules);
111205
111372
  return {
111206
111373
  type: "success",
@@ -111300,7 +111467,7 @@ ${stderr}`);
111300
111467
  // dist/whole-program-code-aware-vulnerability-scanner/rust/rust-code-aware-vulnerability-scanner.js
111301
111468
  var import_lodash12 = __toESM(require_lodash(), 1);
111302
111469
  import { existsSync as existsSync12 } from "node:fs";
111303
- import { readFile as readFile10, writeFile as writeFile9 } from "node:fs/promises";
111470
+ import { readFile as readFile11, writeFile as writeFile9 } from "node:fs/promises";
111304
111471
  import { basename as basename10, dirname as dirname14, resolve as resolve15 } from "node:path";
111305
111472
 
111306
111473
  // dist/whole-program-code-aware-vulnerability-scanner/rust/heuristics.js
@@ -111584,7 +111751,7 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
111584
111751
  const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runRustDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --tree-sitter-rust ${getTreeSitterRustPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.rust });
111585
111752
  if (result.error)
111586
111753
  return void 0;
111587
- const packageIds = JSON.parse(await readFile10(outputFile, "utf-8")).result;
111754
+ const packageIds = JSON.parse(await readFile11(outputFile, "utf-8")).result;
111588
111755
  return packageIds?.map((packageId) => this.depIdToPurl.get(packageId)?.name).filter((name2) => name2 !== void 0).map((name2) => name2);
111589
111756
  });
111590
111757
  }
@@ -111620,7 +111787,7 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
111620
111787
  const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runRustReachabilityAnalysis -i ${inputFile} -o ${outputFile} --tree-sitter-rust ${getTreeSitterRustPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.rust, telemetryHandler, analyzerTelemetryHandler });
111621
111788
  if (result.error)
111622
111789
  return { type: "error", message: result.error.message ?? "unknown error" };
111623
- const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile10(outputFile, "utf-8")).result;
111790
+ const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile11(outputFile, "utf-8")).result;
111624
111791
  if (!success)
111625
111792
  return { type: "error", message: error ?? "unknown error" };
111626
111793
  const affectedPurls = reachablePackageIds.map((packageId) => this.depIdToPurl.get(packageId)).filter((purl) => purl !== void 0);
@@ -111817,7 +111984,7 @@ async function convertSocketArtifacts3(artifacts, tmpDir, artifactNameToId) {
111817
111984
  return { deps, depIdToPurl };
111818
111985
  }
111819
111986
  async function extractDependenciesFromCargoToml(cargoTomlPath) {
111820
- const content = await readFile10(cargoTomlPath, "utf-8");
111987
+ const content = await readFile11(cargoTomlPath, "utf-8");
111821
111988
  const toml = parseTOML2(content);
111822
111989
  if (!toml)
111823
111990
  return /* @__PURE__ */ new Map();
@@ -111866,7 +112033,7 @@ async function getCrateInfo(cargoTomlPath) {
111866
112033
  let examples;
111867
112034
  let tests;
111868
112035
  const cargoTomlDir = dirname14(cargoTomlPath);
111869
- const content = await readFile10(cargoTomlPath, "utf-8");
112036
+ const content = await readFile11(cargoTomlPath, "utf-8");
111870
112037
  const parsed = parseTOML2(content);
111871
112038
  if (!parsed) {
111872
112039
  lib = resolve15(dirname14(cargoTomlPath), "src");
@@ -112144,13 +112311,13 @@ var PythonCodeAwareVulnerabilityScanner = class {
112144
112311
  if (errors.length > 0)
112145
112312
  logger.debug(`Error messages from mambalade:
112146
112313
  ${errors.join("\n")}`);
112147
- const result = JSON.parse(await readFile11(vulnsOutputFile, "utf-8"));
112314
+ const result = JSON.parse(await readFile12(vulnsOutputFile, "utf-8"));
112148
112315
  logger.debug("Analysis result: %O", {
112149
112316
  ...i3(result.matches, (match2) => match2.stacks.length),
112150
112317
  ...result.misses
112151
112318
  });
112152
- const { modules, ...mambaladeDiagnosticsOutput } = JSON.parse(await readFile11(diagnosticsOutputFile, "utf-8"));
112153
- const reachedPackages = JSON.parse(await readFile11(reachedPackagesOutputFile, "utf-8"));
112319
+ const { modules, ...mambaladeDiagnosticsOutput } = JSON.parse(await readFile12(diagnosticsOutputFile, "utf-8"));
112320
+ const reachedPackages = JSON.parse(await readFile12(reachedPackagesOutputFile, "utf-8"));
112154
112321
  const getTimes = (...keys) => (
112155
112322
  // Mambalade outputs times in seconds, we convert them to milliseconds
112156
112323
  keys.reduce((sum, key) => sum + (mambaladeDiagnosticsOutput.diagnostics.timings[key] ?? 0), 0) * 1e3
@@ -113522,7 +113689,7 @@ import { resolve as resolve21 } from "path";
113522
113689
  // dist/whole-program-code-aware-vulnerability-scanner/ruby/ruby-code-aware-vulnerability-scanner.js
113523
113690
  var import_lodash20 = __toESM(require_lodash(), 1);
113524
113691
  import { createWriteStream as createWriteStream4, existsSync as existsSync15 } from "fs";
113525
- import { mkdir as mkdir9, readdir as readdir5, readFile as readFile12, rm as rm7 } from "fs/promises";
113692
+ import { mkdir as mkdir9, readdir as readdir5, readFile as readFile13, rm as rm7 } from "fs/promises";
113526
113693
  import { join as join18, relative as relative9 } from "path";
113527
113694
  import { pipeline as pipeline3 } from "stream/promises";
113528
113695
  var PRINT_ANALYSIS_COMMAND = false;
@@ -113616,10 +113783,10 @@ var RubyCodeAwareVulnerabilityScanner = class {
113616
113783
  heartbeat: HEARTBEATS.ruby,
113617
113784
  telemetryHandler
113618
113785
  });
113619
- const result = JSON.parse(await readFile12(vulnsOutputFile, "utf-8"));
113786
+ const result = JSON.parse(await readFile13(vulnsOutputFile, "utf-8"));
113620
113787
  const relativeLoadPathsToPackageNames = new Map([...loadPathsToPackageNames.entries()].map(([k, v]) => [join18("vendor", relative9(this.vendorDir, k)), v]));
113621
- const { timedOut, ...diagnostics } = JSON.parse(await readFile12(diagnosticsOutputFile, "utf-8"));
113622
- const reachedPackages = JSON.parse(await readFile12(reachedPackagesOutputFile, "utf-8"));
113788
+ const { timedOut, ...diagnostics } = JSON.parse(await readFile13(diagnosticsOutputFile, "utf-8"));
113789
+ const reachedPackages = JSON.parse(await readFile13(reachedPackagesOutputFile, "utf-8"));
113623
113790
  logger.debug("Reached packages: %O", reachedPackages);
113624
113791
  return {
113625
113792
  type: "success",
@@ -113915,13 +114082,13 @@ async function runReachabilityAnalysis(state) {
113915
114082
  }
113916
114083
 
113917
114084
  // dist/reachability-analysis-state.js
113918
- import { readFile as readFile13 } from "fs/promises";
114085
+ import { readFile as readFile14 } from "fs/promises";
113919
114086
  async function getReachabilityAnalyzersStateFromInput(rootWorkingDir, subprojectDir, workspacePath, inputFile) {
113920
114087
  return {
113921
114088
  rootWorkingDir,
113922
114089
  subprojectDir,
113923
114090
  workspacePath,
113924
- ...JSON.parse(await readFile13(inputFile, "utf-8"))
114091
+ ...JSON.parse(await readFile14(inputFile, "utf-8"))
113925
114092
  };
113926
114093
  }
113927
114094
 
@@ -113937,7 +114104,7 @@ var runReachabilityAnalysisCmd = new Command().name("runReachabilityAnalysis").a
113937
114104
  }
113938
114105
  }, "reachability-analyzer"));
113939
114106
  var runOnDependencyChainCmd = new Command().name("runOnDependencyChain").option("-d, --debug", "Enable debug logging", false).option("-s, --silent", "Silence all debug/warning output", false).option("--coana-socket-path <socketPath>", "Coana socket path").option("--silent-spinner", "Silence spinner", "CI" in process.env || !process.stdin.isTTY).requiredOption("-i, --input-file <inputFile>", "Input file for data and vulnerabilities").requiredOption("-o, --output-file <outputFile>", "Output file for the results").configureHelp({ sortSubcommands: true, sortOptions: true }).action(async (options) => withLoggerAndSpinner("Coana Reachability Analyzers", options, async () => {
113940
- const { ecosystem, dependencyChain, vulnerability } = JSON.parse(await readFile14(options.inputFile, "utf-8"));
114107
+ const { ecosystem, dependencyChain, vulnerability } = JSON.parse(await readFile15(options.inputFile, "utf-8"));
113941
114108
  const defaultOptions2 = {
113942
114109
  timeoutSeconds: { allVulnRuns: 60, bucketedRuns: 60 },
113943
114110
  memoryLimitInMB: 16384