@coana-tech/cli 14.12.90 → 14.12.92

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 CHANGED
@@ -244541,7 +244541,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
244541
244541
  }
244542
244542
 
244543
244543
  // dist/version.js
244544
- var version2 = "14.12.90";
244544
+ var version2 = "14.12.92";
244545
244545
 
244546
244546
  // dist/cli-core.js
244547
244547
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -244734,7 +244734,7 @@ var CliCore = class {
244734
244734
  this.sendProgress("RUN_ON_SUBPROJECT", true, this.rootWorkingDirectory);
244735
244735
  const isEcosystemToAnalyze = !this.options.purlTypes || this.options.purlTypes.some((purlType) => getAdvisoryEcosystemFromPurlType(purlType) === ecosystem);
244736
244736
  if (!isEcosystemToAnalyze) {
244737
- logger.info(`Skipping reachability analysis for ecosystem ${getPurlType(ecosystem)} due to it not being included in the list of ecosystems to analyze.`);
244737
+ logger.info(`Skipping reachability analysis for ecosystem ${getPurlType(ecosystem)} since it is not included in the list of ecosystems to analyze.`);
244738
244738
  }
244739
244739
  vulnsWithResults.push(...Object.values(await this.runReachabilityAnalysisForWorkspaces(
244740
244740
  workspaceToAnalysisData,
@@ -245154,7 +245154,7 @@ Subproject: ${subproject}`);
245154
245154
  includeDirs: this.options.includeDirs ?? []
245155
245155
  }, resolve42(subprojectPath, workspacePath));
245156
245156
  if (shouldExcludeWorkspaceForAnalysis) {
245157
- logger.info(`${workspacePrefix}Skipping reachability analysis for workspace ${workspacePath} due to it being excluded.`);
245157
+ logger.info(`${workspacePrefix}Skipping reachability analysis for workspace ${workspacePath} since it is excluded.`);
245158
245158
  }
245159
245159
  return shouldExcludeWorkspaceForAnalysis;
245160
245160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.90",
3
+ "version": "14.12.92",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -80677,11 +80677,15 @@ async function exists(path10, mode) {
80677
80677
  // ../utils/src/go-utils.ts
80678
80678
  var modWhyRegex = /^\(main module does not need to vendor (?:module|package) (\S+)\)$/gm;
80679
80679
  async function runGoModWhy(moduleMode, projectFolder, toCheck) {
80680
+ logger.debug(`Running 'go mod why' in ${projectFolder} with ${moduleMode ? "module" : "package"} mode`);
80680
80681
  const modWhyOutput = await runCommandResolveStdOut(
80681
80682
  // -vendor flag tells why to disregard imports in dependencies' tests
80682
80683
  ["go", ...`mod why${moduleMode ? " -m" : ""} -vendor`.split(" "), ...toCheck],
80683
- projectFolder
80684
+ projectFolder,
80685
+ { timeout: 30 * 60 * 1e3 }
80686
+ // 30 minutes
80684
80687
  );
80688
+ logger.debug(`'go mod why' finished`);
80685
80689
  return Array.from(modWhyOutput.matchAll(modWhyRegex), ([, m]) => m);
80686
80690
  }
80687
80691
  var getIrrelevantModules = runGoModWhy.bind(null, true);
@@ -80692,11 +80696,15 @@ async function getModuleInfo(goModPath) {
80692
80696
  return JSON.parse(stdout);
80693
80697
  }
80694
80698
  async function runGoModTidy(moduleDir, { continueOnError = false } = {}) {
80699
+ logger.debug(`Running 'go mod tidy' in ${moduleDir}`);
80695
80700
  const { error } = await execNeverFail(["go", "mod", "tidy"], moduleDir);
80701
+ logger.debug(`'go mod tidy' finished`);
80696
80702
  if (error) {
80697
80703
  const { Module, Go } = await getModuleInfo(moduleDir);
80698
- logger.warn(`'go mod tidy' failed for '${Module.Path}'${Go ? `@go${Go}` : ""} in '${moduleDir}' with error:
80699
- ${error.message}`);
80704
+ logger.warn(
80705
+ `'go mod tidy' failed for '${Module.Path}'${Go ? `@go${Go}` : ""} in '${moduleDir}' with error:
80706
+ ${error.message}`
80707
+ );
80700
80708
  if (!continueOnError) throw error;
80701
80709
  }
80702
80710
  }
@@ -111949,7 +111957,20 @@ var GoAnalyzer = class {
111949
111957
  }
111950
111958
  async runReachabilityAnalysis(vulns, analysisMetadataCollector, statusUpdater) {
111951
111959
  const vulnerablePackages = uniq9(vulns.flatMap((v) => v.vulnerabilityAccessPaths.map((vap) => vap.split(":")[0])));
111952
- const irrelevantPackages = new Set(await getIrrelevantPackages(this.projectDir, vulnerablePackages));
111960
+ let irrelevantPackages;
111961
+ try {
111962
+ irrelevantPackages = new Set(await getIrrelevantPackages(this.projectDir, vulnerablePackages));
111963
+ } catch (e) {
111964
+ const message = `Error running 'go mod why' to get irrelevant packages: ${e instanceof Error ? e.message : String(e)}`;
111965
+ logger.warn(message);
111966
+ return vulns.map((v) => ({
111967
+ ...v,
111968
+ results: {
111969
+ type: "analysisError",
111970
+ message
111971
+ }
111972
+ }));
111973
+ }
111953
111974
  const [unreachableVulns, otherVulns] = partition2(vulns, (v) => v.vulnerabilityAccessPaths.every((vap) => irrelevantPackages.has(vap.split(":")[0])));
111954
111975
  const res = otherVulns.length ? await analyzeWithHeuristics(this.state, otherVulns, [GoanaHeuristics.DEFAULT], false, new GoCodeAwareVulnerabilityScanner(this.projectDir, this.state.reachabilityAnalysisOptions), analysisMetadataCollector, statusUpdater) : [];
111955
111976
  if (unreachableVulns.length) {