@coana-tech/cli 14.11.13 → 14.11.15

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
@@ -205338,7 +205338,7 @@ var getNpmBin = once(async () => {
205338
205338
  return npmBin;
205339
205339
  });
205340
205340
  async function actuallyRunInstall(specificPackagesArgs = [], dir) {
205341
- const installationCommand = cmdt2`${await getNpmBin()} install -f --ignore-scripts --no-fund --no-audit ${specificPackagesArgs}`;
205341
+ const installationCommand = cmdt2`${await getNpmBin()} install -f --ignore-scripts --no-fund --no-audit --no-progress ${specificPackagesArgs}`;
205342
205342
  logger.info(`running installation command: ${installationCommand}`);
205343
205343
  return execAndLogOnFailure2(installationCommand, dir);
205344
205344
  }
@@ -205446,6 +205446,8 @@ var NpmFixingManager = class extends NpmEcosystemFixingManager {
205446
205446
  }
205447
205447
  }
205448
205448
  async finalizeFixes() {
205449
+ logger.info(`Adjusting lock file changes by running a npm install command`);
205450
+ await actuallyRunInstall(void 0, resolve9(this.rootDir, this.subprojectPath));
205449
205451
  }
205450
205452
  };
205451
205453
 
@@ -205454,7 +205456,16 @@ import { readFile as readFile12, writeFile as writeFile4 } from "fs/promises";
205454
205456
  import { resolve as resolve10 } from "path";
205455
205457
  var import_yaml = __toESM(require_dist10(), 1);
205456
205458
  var import_lockfile_file2 = __toESM(require_lib25(), 1);
205459
+ import { existsSync as existsSync9 } from "fs";
205457
205460
  var PnpmFixingManager = class extends NpmEcosystemFixingManager {
205461
+ pnpmMajorVersion;
205462
+ async getPnpmMajorVersion() {
205463
+ if (!this.pnpmMajorVersion) {
205464
+ const pnpmVersion = await runCommandResolveStdOut(cmdt`pnpm -v`);
205465
+ this.pnpmMajorVersion = parseInt(pnpmVersion.trim().split(".")[0]);
205466
+ }
205467
+ return this.pnpmMajorVersion;
205468
+ }
205458
205469
  async installSpecificPackages(workspacePath, isDev, packagesToInstall) {
205459
205470
  try {
205460
205471
  const isInstallingInRootOfWorkspace = workspacePath === "." && (await getWorkspacePathsFromPnpmLockFile(this.rootDir, false)).length > 1;
@@ -205473,7 +205484,7 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
205473
205484
  }
205474
205485
  }
205475
205486
  async actuallyRunInstall(specificPackagesCmd = [], workspacePath = ".") {
205476
- const installationCommand = cmdt`pnpm install --ignore-scripts ${specificPackagesCmd}`;
205487
+ const installationCommand = cmdt`pnpm install --ignore-scripts${await this.getPnpmMajorVersion() >= 9 && specificPackagesCmd.length === 0 ? "--no-frozen-lockfile" : ""} --config.confirmModulesPurge=false ${specificPackagesCmd}`;
205477
205488
  logger.info(`running installation command: ${installationCommand}`);
205478
205489
  await exec(installationCommand, resolve10(this.rootDir, this.subprojectPath, workspacePath));
205479
205490
  }
@@ -205556,6 +205567,11 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
205556
205567
  ])
205557
205568
  );
205558
205569
  const pnpmWorkspaceYamlFile = resolve10(this.rootDir, this.subprojectPath, "pnpm-workspace.yaml");
205570
+ if (!existsSync9(pnpmWorkspaceYamlFile)) {
205571
+ throw new Error(
205572
+ `pnpm-workspace.yaml could not be found in ${pnpmWorkspaceYamlFile}. The lockfile indicates that pnpm catalogs are used and they must be updated, which is not possible without a pnpm-workspace.yaml file`
205573
+ );
205574
+ }
205559
205575
  const yamlAST = await readYamlFile(pnpmWorkspaceYamlFile);
205560
205576
  fixCatalogVersions(yamlAST, catalogFixes);
205561
205577
  await writeYamlFile(yamlAST, pnpmWorkspaceYamlFile);
@@ -205567,7 +205583,7 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
205567
205583
  }
205568
205584
  }
205569
205585
  async finalizeFixes() {
205570
- const cmd = cmdt`pnpm install --ignore-scripts --fix-lockfile`;
205586
+ const cmd = cmdt`pnpm install --ignore-scripts --fix-lockfile --config.confirmModulesPurge=false `;
205571
205587
  logger.info(`Adjusting lock file changes by running '${cmd}'`);
205572
205588
  await exec(cmd, resolve10(this.rootDir, this.subprojectPath));
205573
205589
  }
@@ -205621,7 +205637,7 @@ import { resolve as resolve12 } from "path";
205621
205637
 
205622
205638
  // ../utils/src/package-utils.ts
205623
205639
  import { parse as parse2, join as join7, resolve as resolve11, normalize as normalize3, dirname as dirname4, basename as basename3, relative as relative4 } from "path";
205624
- import { existsSync as existsSync9, readFileSync as readFileSync2, readdirSync as readdirSync3, statSync as statSync3, writeFileSync as writeFileSync2 } from "fs";
205640
+ import { existsSync as existsSync10, readFileSync as readFileSync2, readdirSync as readdirSync3, statSync as statSync3, writeFileSync as writeFileSync2 } from "fs";
205625
205641
  function setFieldInPackageJson(workspaceRoot, field, value) {
205626
205642
  const packageJSONContentObj = getPackageJsonObject2(workspaceRoot);
205627
205643
  if (!packageJSONContentObj) return void 0;
@@ -205638,7 +205654,7 @@ function writePackageJsonContent(workspaceRoot, packageJsonContent) {
205638
205654
  }
205639
205655
  function getPackageJsonContent2(workspaceRoot) {
205640
205656
  const packageJsonPath = getPackageJSONPath2(workspaceRoot);
205641
- if (existsSync9(packageJsonPath)) return readFileSync2(packageJsonPath, "utf8");
205657
+ if (existsSync10(packageJsonPath)) return readFileSync2(packageJsonPath, "utf8");
205642
205658
  return void 0;
205643
205659
  }
205644
205660
  function getPackageJSONPath2(workspaceRoot) {
@@ -205771,9 +205787,10 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
205771
205787
  logger.info(`Failed to install packages: ${installResult.error.message}`);
205772
205788
  logger.info(`stdout`, installResult.stdout);
205773
205789
  logger.info(`stderr`, installResult.stderr);
205774
- logger.info("yarn version", await runCommandResolveStdOut("yarn -v", installDir));
205790
+ logger.info("yarn version", await this.runYarnCommand(cmdt`yarn -v`, installDir));
205775
205791
  throw new Error(`Failed to install packages: ${installResult.error.message}`);
205776
205792
  }
205793
+ logger.info("Installation completed.");
205777
205794
  }
205778
205795
  async getYarnLockObj(filePath) {
205779
205796
  const fileString = await readFile13(filePath, "utf8");
@@ -205875,7 +205892,7 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
205875
205892
 
205876
205893
  // ../fixing-management/src/fixing-management/npm/npm-ecosystem-socket-fixing-manager.ts
205877
205894
  import { dirname as dirname5, join as join8, relative as relative5 } from "path";
205878
- import { existsSync as existsSync10 } from "fs";
205895
+ import { existsSync as existsSync11 } from "fs";
205879
205896
  var NpmSocketUpgradeManager = class {
205880
205897
  constructor(rootDir) {
205881
205898
  this.rootDir = rootDir;
@@ -205909,7 +205926,13 @@ var NpmSocketUpgradeManager = class {
205909
205926
  workspaceToSubproject.set(join8(subprojectDir, workspace), subprojectDir);
205910
205927
  }
205911
205928
  }
205912
- const packageJsonFiles = artifact.manifestFiles?.filter((a4) => a4.file.endsWith("package.json"));
205929
+ const packageJsonFiles = artifact.manifestFiles?.filter((a4) => a4.file.endsWith("package.json")) ?? [];
205930
+ for (const lockFile of lockFiles ?? []) {
205931
+ const correspondingPackageJsonFile = join8(dirname5(lockFile.file), "package.json");
205932
+ if (!packageJsonFiles.some((p3) => p3.file === correspondingPackageJsonFile) && existsSync11(correspondingPackageJsonFile)) {
205933
+ packageJsonFiles.push({ file: correspondingPackageJsonFile });
205934
+ }
205935
+ }
205913
205936
  for (const packageJsonFile of packageJsonFiles ?? []) {
205914
205937
  const packageJsonDir = dirname5(packageJsonFile.file);
205915
205938
  const subprojectDir = workspaceToSubproject.get(packageJsonDir) ?? packageJsonDir;
@@ -205961,13 +205984,14 @@ function getFixingManagerFromPackageManager(packageManager, rootDir, subprojectP
205961
205984
  }
205962
205985
  }
205963
205986
  function getPackageMangerForDirectory(directory) {
205964
- if (existsSync10(join8(directory, "pnpm-lock.yaml")) || existsSync10(join8(directory, "pnpm-lock.yml"))) {
205987
+ if (existsSync11(join8(directory, "pnpm-lock.yaml")) || existsSync11(join8(directory, "pnpm-lock.yml"))) {
205965
205988
  return "PNPM";
205966
- } else if (existsSync10(join8(directory, "yarn.lock"))) {
205989
+ } else if (existsSync11(join8(directory, "yarn.lock"))) {
205967
205990
  return "YARN";
205968
- } else {
205991
+ } else if (existsSync11(join8(directory, "package-lock.json"))) {
205969
205992
  return "NPM";
205970
205993
  }
205994
+ throw new Error("Upgrading packages is currently only supported for NPM projects using a lock file.");
205971
205995
  }
205972
205996
 
205973
205997
  // ../fixing-management/src/fixing-management/npm/rush-fixing-manager.ts
@@ -206329,7 +206353,7 @@ async function applySocketUpgrades(ecosystem, rootDir, upgrades, artifacts) {
206329
206353
 
206330
206354
  // dist/cli-apply-fix.js
206331
206355
  var import_lodash12 = __toESM(require_lodash(), 1);
206332
- import { existsSync as existsSync15 } from "fs";
206356
+ import { existsSync as existsSync16 } from "fs";
206333
206357
 
206334
206358
  // ../other-modules-communicator/src/other-modules-communicator.ts
206335
206359
  import { execFileSync } from "child_process";
@@ -206346,7 +206370,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
206346
206370
  // ../utils/dist/file-utils.js
206347
206371
  var import_lodash5 = __toESM(require_lodash(), 1);
206348
206372
  var import_micromatch = __toESM(require_micromatch(), 1);
206349
- import { existsSync as existsSync11 } from "fs";
206373
+ import { existsSync as existsSync12 } from "fs";
206350
206374
  import { access as access2, cp, readdir as readdir3, stat as stat2 } from "fs/promises";
206351
206375
  import { basename as basename4, join as join11, relative as relative6, resolve as resolve13 } from "path";
206352
206376
  var { uniq } = import_lodash5.default;
@@ -207076,7 +207100,7 @@ async function detectVariantMaven(projectDir) {
207076
207100
  }
207077
207101
 
207078
207102
  // ../docker-management/src/maven/gradle-version-detector.ts
207079
- import { existsSync as existsSync12 } from "fs";
207103
+ import { existsSync as existsSync13 } from "fs";
207080
207104
  import { join as join13 } from "path";
207081
207105
  import { readFile as readFile15 } from "fs/promises";
207082
207106
  async function detectVariantGradle(projectDir) {
@@ -207084,7 +207108,7 @@ async function detectVariantGradle(projectDir) {
207084
207108
  }
207085
207109
  async function detect(projectDir) {
207086
207110
  const gradleWrapperPropertiesPath = join13(projectDir, "gradle", "wrapper", "gradle-wrapper.properties");
207087
- const gradleWrapperProperties = existsSync12(gradleWrapperPropertiesPath) ? (await readFile15(gradleWrapperPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
207111
+ const gradleWrapperProperties = existsSync13(gradleWrapperPropertiesPath) ? (await readFile15(gradleWrapperPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
207088
207112
  if (!gradleWrapperProperties) return void 0;
207089
207113
  const distributionUrlRegex = /.*gradle-(\d+(\.\d+(\.\d+)?)?)/;
207090
207114
  for (const prop2 of gradleWrapperProperties) {
@@ -207098,7 +207122,7 @@ async function detect(projectDir) {
207098
207122
  }
207099
207123
 
207100
207124
  // ../docker-management/src/maven/sbt-version-detector.ts
207101
- import { existsSync as existsSync13 } from "fs";
207125
+ import { existsSync as existsSync14 } from "fs";
207102
207126
  import { join as join14 } from "path";
207103
207127
  import { readFile as readFile16 } from "fs/promises";
207104
207128
  async function detectVariantSbt(projectDir) {
@@ -207106,7 +207130,7 @@ async function detectVariantSbt(projectDir) {
207106
207130
  }
207107
207131
  async function detect2(projectDir) {
207108
207132
  const sbtBuildPropertiesPath = join14(projectDir, "project", "build.properties");
207109
- const sbtBuildProperties = existsSync13(sbtBuildPropertiesPath) ? (await readFile16(sbtBuildPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
207133
+ const sbtBuildProperties = existsSync14(sbtBuildPropertiesPath) ? (await readFile16(sbtBuildPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
207110
207134
  if (!sbtBuildProperties) return void 0;
207111
207135
  for (const prop2 of sbtBuildProperties) {
207112
207136
  const [key, value] = prop2.split("=");
@@ -207227,7 +207251,7 @@ import { join as join17, posix as posix2, relative as relative8, sep as sep3 } f
207227
207251
  // ../utils/src/file-utils.ts
207228
207252
  var import_lodash8 = __toESM(require_lodash(), 1);
207229
207253
  var import_micromatch2 = __toESM(require_micromatch(), 1);
207230
- import { existsSync as existsSync14 } from "fs";
207254
+ import { existsSync as existsSync15 } from "fs";
207231
207255
  import { access as access3, cp as cp2, readdir as readdir4, stat as stat3 } from "fs/promises";
207232
207256
  import { basename as basename5, join as join15, relative as relative7, resolve as resolve16 } from "path";
207233
207257
  var { uniq: uniq2 } = import_lodash8.default;
@@ -208344,7 +208368,7 @@ async function verifyFixes(fixes, otherModulesCommunicator, rootPath) {
208344
208368
  if (pathsForEachFixIdData.length !== new Set(pathsForEachFixIdData).size) {
208345
208369
  throw new Error("Multiple fix IDs found for the same subproject, workspace and ecosystem");
208346
208370
  }
208347
- const subprojectsNotFound = uniq3(fixes.filter(({ vulnerabilityInstance: v }) => !existsSync15(resolve19(rootPath, v.subprojectPath))).map(({ vulnerabilityInstance: v }) => `${v.subprojectPath}:${v.ecosystem}`));
208371
+ const subprojectsNotFound = uniq3(fixes.filter(({ vulnerabilityInstance: v }) => !existsSync16(resolve19(rootPath, v.subprojectPath))).map(({ vulnerabilityInstance: v }) => `${v.subprojectPath}:${v.ecosystem}`));
208348
208372
  if (subprojectsNotFound.length > 0) {
208349
208373
  throw new Error(`Cannot find the following subprojects: ${subprojectsNotFound.join(", ")}`);
208350
208374
  }
@@ -209150,12 +209174,12 @@ import { readdir as readdir6 } from "fs/promises";
209150
209174
  import { join as join20, relative as relative9, resolve as resolve22 } from "path";
209151
209175
 
209152
209176
  // ../project-management/src/project-management/ecosystem-management/ecosystem-specs.ts
209153
- import { existsSync as existsSync17 } from "fs";
209177
+ import { existsSync as existsSync18 } from "fs";
209154
209178
  import { readdir as readdir5, readFile as readFile20 } from "fs/promises";
209155
209179
  import { join as join19, sep as sep4 } from "path";
209156
209180
 
209157
209181
  // ../utils/src/pip-utils.ts
209158
- import { existsSync as existsSync16 } from "fs";
209182
+ import { existsSync as existsSync17 } from "fs";
209159
209183
  import { readFile as readFile19 } from "fs/promises";
209160
209184
  import { resolve as resolve21 } from "path";
209161
209185
  import util4 from "util";
@@ -209252,7 +209276,7 @@ function getEcosystemSpecs(ecosystems) {
209252
209276
  }
209253
209277
  function packageManagerIfPackageJSONExistsAndValid(packageManager) {
209254
209278
  return async (projectDir) => {
209255
- if (!existsSync17(join19(projectDir, "package.json"))) return void 0;
209279
+ if (!existsSync18(join19(projectDir, "package.json"))) return void 0;
209256
209280
  const packageJSONPath = join19(projectDir, "package.json");
209257
209281
  try {
209258
209282
  JSON.parse(await readFile20(packageJSONPath, "utf-8"));
@@ -209927,16 +209951,16 @@ function isVulnChainWithParentsMap(v) {
209927
209951
  var DEFAULT_REPORT_FILENAME_BASE = "coana-report";
209928
209952
 
209929
209953
  // dist/internal/exclude-dirs-from-configuration-files.js
209930
- import { existsSync as existsSync18 } from "fs";
209954
+ import { existsSync as existsSync19 } from "fs";
209931
209955
  import { readFile as readFile21 } from "fs/promises";
209932
209956
  import { basename as basename6, resolve as resolve24 } from "path";
209933
209957
  var import_yaml2 = __toESM(require_dist11(), 1);
209934
209958
  async function inferExcludeDirsFromConfigurationFiles(rootWorkingDir) {
209935
209959
  const socketYmlConfigFile = resolve24(rootWorkingDir, "socket.yml");
209936
- if (existsSync18(socketYmlConfigFile))
209960
+ if (existsSync19(socketYmlConfigFile))
209937
209961
  return inferExcludeDirsFromSocketConfig(socketYmlConfigFile);
209938
209962
  const socketYamlConfigFile = resolve24(rootWorkingDir, "socket.yaml");
209939
- if (existsSync18(socketYamlConfigFile))
209963
+ if (existsSync19(socketYamlConfigFile))
209940
209964
  return inferExcludeDirsFromSocketConfig(socketYamlConfigFile);
209941
209965
  return void 0;
209942
209966
  }
@@ -210065,7 +210089,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
210065
210089
  case "NPM": {
210066
210090
  const base = basename7(manifestPath);
210067
210091
  const dir = dirname8(manifestPath);
210068
- return base === "package.json" ? dir === "" ? "." : dir : void 0;
210092
+ return base === "package.json" ? dir || "." : void 0;
210069
210093
  }
210070
210094
  case "MAVEN": {
210071
210095
  return ".";
@@ -210096,6 +210120,11 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
210096
210120
  case "RUST": {
210097
210121
  return dirname8(manifestPath) || ".";
210098
210122
  }
210123
+ case "GO": {
210124
+ const base = basename7(manifestPath);
210125
+ const dir = dirname8(manifestPath);
210126
+ return base === "go.mod" ? dir || "." : void 0;
210127
+ }
210099
210128
  default: {
210100
210129
  return ".";
210101
210130
  }
@@ -224020,7 +224049,7 @@ var { root: root2 } = static_exports;
224020
224049
 
224021
224050
  // ../utils/src/maven-utils.ts
224022
224051
  var import_lodash14 = __toESM(require_lodash(), 1);
224023
- import { existsSync as existsSync19, readdirSync as readdirSync4, statSync as statSync4 } from "fs";
224052
+ import { existsSync as existsSync20, readdirSync as readdirSync4, statSync as statSync4 } from "fs";
224024
224053
  import { join as join21 } from "path";
224025
224054
  var { memoize: memoize3 } = import_lodash14.default;
224026
224055
  var memoizedParseShellArgs = memoize3(parseShellArgs);
@@ -225392,7 +225421,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
225392
225421
  }
225393
225422
 
225394
225423
  // dist/version.js
225395
- var version2 = "14.11.13";
225424
+ var version2 = "14.11.15";
225396
225425
 
225397
225426
  // dist/cli-core.js
225398
225427
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -225572,7 +225601,7 @@ var CliCore = class {
225572
225601
  otherModulesCommunicator,
225573
225602
  this.rootWorkingDirectory,
225574
225603
  ecosystem,
225575
- ["NPM", "PIP"].includes(ecosystem) && isEcosystemToAnalyze
225604
+ ["NPM", "PIP", "GO"].includes(ecosystem) && isEcosystemToAnalyze
225576
225605
  )).flat());
225577
225606
  this.sendProgress("RUN_ON_SUBPROJECT", false, this.rootWorkingDirectory);
225578
225607
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.11.13",
3
+ "version": "14.11.15",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9234,7 +9234,7 @@ var require_pipeline = __commonJS({
9234
9234
  if (typeof streams[streams.length - 1] !== "function") return noop4;
9235
9235
  return streams.pop();
9236
9236
  }
9237
- function pipeline() {
9237
+ function pipeline2() {
9238
9238
  for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
9239
9239
  streams[_key] = arguments[_key];
9240
9240
  }
@@ -9257,7 +9257,7 @@ var require_pipeline = __commonJS({
9257
9257
  });
9258
9258
  return streams.reduce(pipe);
9259
9259
  }
9260
- module.exports = pipeline;
9260
+ module.exports = pipeline2;
9261
9261
  }
9262
9262
  });
9263
9263
 
@@ -11444,7 +11444,7 @@ var require_file = __commonJS({
11444
11444
  var fs12 = __require("fs");
11445
11445
  var path9 = __require("path");
11446
11446
  var asyncSeries = require_series();
11447
- var zlib2 = __require("zlib");
11447
+ var zlib3 = __require("zlib");
11448
11448
  var { MESSAGE } = require_triple_beam();
11449
11449
  var { Stream: Stream2, PassThrough } = require_readable();
11450
11450
  var TransportStream = require_winston_transport();
@@ -12013,7 +12013,7 @@ var require_file = __commonJS({
12013
12013
  if (err) {
12014
12014
  return callback();
12015
12015
  }
12016
- var gzip = zlib2.createGzip();
12016
+ var gzip = zlib3.createGzip();
12017
12017
  var inp = fs12.createReadStream(src);
12018
12018
  var out = fs12.createWriteStream(dest);
12019
12019
  out.on("finish", () => {
@@ -43748,7 +43748,7 @@ var require_client = __commonJS({
43748
43748
  var assert9 = __require("assert");
43749
43749
  var net = __require("net");
43750
43750
  var http2 = __require("http");
43751
- var { pipeline } = __require("stream");
43751
+ var { pipeline: pipeline2 } = __require("stream");
43752
43752
  var util6 = require_util2();
43753
43753
  var timers = require_timers();
43754
43754
  var Request2 = require_request();
@@ -45166,7 +45166,7 @@ upgrade: ${upgrade}\r
45166
45166
  let onPipeData = function(chunk2) {
45167
45167
  request.onBodySent(chunk2);
45168
45168
  };
45169
- const pipe = pipeline(
45169
+ const pipe = pipeline2(
45170
45170
  body,
45171
45171
  h2stream,
45172
45172
  (err) => {
@@ -46926,7 +46926,7 @@ var require_api_pipeline = __commonJS({
46926
46926
  util6.destroy(ret, err);
46927
46927
  }
46928
46928
  };
46929
- function pipeline(opts, handler) {
46929
+ function pipeline2(opts, handler) {
46930
46930
  try {
46931
46931
  const pipelineHandler = new PipelineHandler(opts, handler);
46932
46932
  this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler);
@@ -46935,7 +46935,7 @@ var require_api_pipeline = __commonJS({
46935
46935
  return new PassThrough().destroy(err);
46936
46936
  }
46937
46937
  }
46938
- module.exports = pipeline;
46938
+ module.exports = pipeline2;
46939
46939
  }
46940
46940
  });
46941
46941
 
@@ -49832,7 +49832,7 @@ var require_fetch = __commonJS({
49832
49832
  } = require_response();
49833
49833
  var { Headers } = require_headers();
49834
49834
  var { Request: Request2, makeRequest } = require_request2();
49835
- var zlib2 = __require("zlib");
49835
+ var zlib3 = __require("zlib");
49836
49836
  var {
49837
49837
  bytesMatch,
49838
49838
  makePolicyContainer,
@@ -49876,7 +49876,7 @@ var require_fetch = __commonJS({
49876
49876
  } = require_constants3();
49877
49877
  var { kHeadersList } = require_symbols();
49878
49878
  var EE3 = __require("events");
49879
- var { Readable: Readable2, pipeline } = __require("stream");
49879
+ var { Readable: Readable2, pipeline: pipeline2 } = __require("stream");
49880
49880
  var { addAbortListener, isErrored, isReadable: isReadable2, nodeMajor, nodeMinor } = require_util2();
49881
49881
  var { dataURLProcessor, serializeAMimeType } = require_dataURL();
49882
49882
  var { TransformStream } = __require("stream/web");
@@ -50773,18 +50773,18 @@ var require_fetch = __commonJS({
50773
50773
  if (request.method !== "HEAD" && request.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) {
50774
50774
  for (const coding of codings) {
50775
50775
  if (coding === "x-gzip" || coding === "gzip") {
50776
- decoders.push(zlib2.createGunzip({
50776
+ decoders.push(zlib3.createGunzip({
50777
50777
  // Be less strict when decoding compressed responses, since sometimes
50778
50778
  // servers send slightly invalid responses that are still accepted
50779
50779
  // by common browsers.
50780
50780
  // Always using Z_SYNC_FLUSH is what cURL does.
50781
- flush: zlib2.constants.Z_SYNC_FLUSH,
50782
- finishFlush: zlib2.constants.Z_SYNC_FLUSH
50781
+ flush: zlib3.constants.Z_SYNC_FLUSH,
50782
+ finishFlush: zlib3.constants.Z_SYNC_FLUSH
50783
50783
  }));
50784
50784
  } else if (coding === "deflate") {
50785
- decoders.push(zlib2.createInflate());
50785
+ decoders.push(zlib3.createInflate());
50786
50786
  } else if (coding === "br") {
50787
- decoders.push(zlib2.createBrotliDecompress());
50787
+ decoders.push(zlib3.createBrotliDecompress());
50788
50788
  } else {
50789
50789
  decoders.length = 0;
50790
50790
  break;
@@ -50795,7 +50795,7 @@ var require_fetch = __commonJS({
50795
50795
  status,
50796
50796
  statusText,
50797
50797
  headersList: headers[kHeadersList],
50798
- body: decoders.length ? pipeline(this.body, ...decoders, () => {
50798
+ body: decoders.length ? pipeline2(this.body, ...decoders, () => {
50799
50799
  }) : this.body.on("error", () => {
50800
50800
  })
50801
50801
  });
@@ -59413,7 +59413,7 @@ var require_upload_gzip = __commonJS({
59413
59413
  Object.defineProperty(exports, "__esModule", { value: true });
59414
59414
  exports.createGZipFileInBuffer = exports.createGZipFileOnDisk = void 0;
59415
59415
  var fs12 = __importStar(__require("fs"));
59416
- var zlib2 = __importStar(__require("zlib"));
59416
+ var zlib3 = __importStar(__require("zlib"));
59417
59417
  var util_1 = __require("util");
59418
59418
  var stat3 = (0, util_1.promisify)(fs12.stat);
59419
59419
  var gzipExemptFileExtensions = [
@@ -59449,7 +59449,7 @@ var require_upload_gzip = __commonJS({
59449
59449
  }
59450
59450
  return new Promise((resolve17, reject) => {
59451
59451
  const inputStream = fs12.createReadStream(originalFilePath);
59452
- const gzip = zlib2.createGzip();
59452
+ const gzip = zlib3.createGzip();
59453
59453
  const outputStream = fs12.createWriteStream(tempFilePath);
59454
59454
  inputStream.pipe(gzip).pipe(outputStream);
59455
59455
  outputStream.on("finish", () => __awaiter(this, void 0, void 0, function* () {
@@ -59469,7 +59469,7 @@ var require_upload_gzip = __commonJS({
59469
59469
  return new Promise((resolve17) => __awaiter(this, void 0, void 0, function* () {
59470
59470
  var _a2, e_1, _b, _c;
59471
59471
  const inputStream = fs12.createReadStream(originalFilePath);
59472
- const gzip = zlib2.createGzip();
59472
+ const gzip = zlib3.createGzip();
59473
59473
  inputStream.pipe(gzip);
59474
59474
  const chunks = [];
59475
59475
  try {
@@ -60071,7 +60071,7 @@ var require_download_http_client = __commonJS({
60071
60071
  exports.DownloadHttpClient = void 0;
60072
60072
  var fs12 = __importStar(__require("fs"));
60073
60073
  var core = __importStar(require_core());
60074
- var zlib2 = __importStar(__require("zlib"));
60074
+ var zlib3 = __importStar(__require("zlib"));
60075
60075
  var utils_1 = require_utils3();
60076
60076
  var url_1 = __require("url");
60077
60077
  var status_reporter_1 = require_status_reporter();
@@ -60249,7 +60249,7 @@ var require_download_http_client = __commonJS({
60249
60249
  return __awaiter(this, void 0, void 0, function* () {
60250
60250
  yield new Promise((resolve17, reject) => {
60251
60251
  if (isGzip) {
60252
- const gunzip = zlib2.createGunzip();
60252
+ const gunzip = zlib3.createGunzip();
60253
60253
  response.message.on("error", (error) => {
60254
60254
  core.info(`An error occurred while attempting to read the response stream`);
60255
60255
  gunzip.close();
@@ -66504,14 +66504,14 @@ var require_headers2 = __commonJS({
66504
66504
  var require_deflater = __commonJS({
66505
66505
  "../../node_modules/.pnpm/adm-zip@0.5.16/node_modules/adm-zip/methods/deflater.js"(exports, module) {
66506
66506
  module.exports = function(inbuf) {
66507
- var zlib2 = __require("zlib");
66507
+ var zlib3 = __require("zlib");
66508
66508
  var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };
66509
66509
  return {
66510
66510
  deflate: function() {
66511
- return zlib2.deflateRawSync(inbuf, opts);
66511
+ return zlib3.deflateRawSync(inbuf, opts);
66512
66512
  },
66513
66513
  deflateAsync: function(callback) {
66514
- var tmp = zlib2.createDeflateRaw(opts), parts = [], total = 0;
66514
+ var tmp = zlib3.createDeflateRaw(opts), parts = [], total = 0;
66515
66515
  tmp.on("data", function(data2) {
66516
66516
  parts.push(data2);
66517
66517
  total += data2.length;
@@ -66538,14 +66538,14 @@ var require_inflater = __commonJS({
66538
66538
  "../../node_modules/.pnpm/adm-zip@0.5.16/node_modules/adm-zip/methods/inflater.js"(exports, module) {
66539
66539
  var version3 = +(process.versions ? process.versions.node : "").split(".")[0] || 0;
66540
66540
  module.exports = function(inbuf, expectedLength) {
66541
- var zlib2 = __require("zlib");
66541
+ var zlib3 = __require("zlib");
66542
66542
  const option = version3 >= 15 && expectedLength > 0 ? { maxOutputLength: expectedLength } : {};
66543
66543
  return {
66544
66544
  inflate: function() {
66545
- return zlib2.inflateRawSync(inbuf, option);
66545
+ return zlib3.inflateRawSync(inbuf, option);
66546
66546
  },
66547
66547
  inflateAsync: function(callback) {
66548
- var tmp = zlib2.createInflateRaw(option), parts = [], total = 0;
66548
+ var tmp = zlib3.createInflateRaw(option), parts = [], total = 0;
66549
66549
  tmp.on("data", function(data2) {
66550
66550
  parts.push(data2);
66551
66551
  total += data2.length;
@@ -94983,9 +94983,11 @@ function transformSourceLocations(fileMappings, detectedOccurrences) {
94983
94983
  // dist/whole-program-code-aware-vulnerability-scanner/go/go-code-aware-vulnerability-scanner.js
94984
94984
  var import_lodash11 = __toESM(require_lodash(), 1);
94985
94985
  import assert4 from "assert";
94986
- import { existsSync as existsSync9 } from "fs";
94986
+ import { existsSync as existsSync9, createReadStream, createWriteStream as createWriteStream2 } from "fs";
94987
94987
  import { readFile as readFile7, rm as rm4, cp as cp4 } from "fs/promises";
94988
+ import zlib2 from "zlib";
94988
94989
  import { join as join13, resolve as resolve10, sep } from "path";
94990
+ import { pipeline } from "stream/promises";
94989
94991
  var { uniq: uniq5 } = import_lodash11.default;
94990
94992
  var GoCodeAwareVulnerabilityScanner = class {
94991
94993
  projectDir;
@@ -94995,6 +94997,11 @@ var GoCodeAwareVulnerabilityScanner = class {
94995
94997
  this.projectDir = projectDir;
94996
94998
  this.options = options;
94997
94999
  }
95000
+ get compressedGoanaBinaryName() {
95001
+ const { platform: platform6, arch } = process;
95002
+ const rarch = arch === "arm" ? "arm64" : arch === "x64" ? "amd64" : arch;
95003
+ return `goana-${platform6}-${rarch}.gz`;
95004
+ }
94998
95005
  async runAnalysis(vulns, heuristic, _analyzesAllVulns) {
94999
95006
  logger.info("Started instantiating Go code-aware analysis");
95000
95007
  if (!existsSync9(join13(this.projectDir, "go.mod")))
@@ -95004,14 +95011,19 @@ var GoCodeAwareVulnerabilityScanner = class {
95004
95011
  const vulnsOutputFile = join13(tmpDir, "vulns.json");
95005
95012
  const diagnosticsOutputFile = join13(tmpDir, "diagnostics.json");
95006
95013
  try {
95014
+ const binaryName = this.compressedGoanaBinaryName;
95015
+ const binaryPath = join13(COANA_REPOS_PATH(), "goana/bin", binaryName);
95016
+ if (!await exists(binaryPath))
95017
+ throw new Error(`goana binary '${binaryName}' not found`);
95018
+ await pipeline(createReadStream(binaryPath), zlib2.createGunzip(), createWriteStream2(join13(tmpDir, "goana"), { mode: 493 }));
95007
95019
  const vulnAccPaths = uniq5(vulns.flatMap((v) => v.vulnerabilityAccessPaths));
95008
- const { error, stderr } = await execNeverFail(cmdt`${COANA_REPOS_PATH()}/goana/goana
95020
+ const { error, stderr } = await execNeverFail(cmdt`${join13(tmpDir, "goana")}
95009
95021
  -output-vulnerabilities ${vulnsOutputFile}
95010
95022
  -output-diagnostics ${diagnosticsOutputFile}
95011
95023
  -topk=4 ${heuristic.includeTests && "-tests"}
95012
95024
  ${this.projectDir} ${vulnAccPaths}`, void 0, {
95013
95025
  timeout: timeoutInSeconds ? timeoutInSeconds * 1e3 : void 0,
95014
- env: memoryLimitInMB ? { ...process.env, GOMEMLIMIT: `${memoryLimitInMB}MB` } : void 0
95026
+ env: memoryLimitInMB ? { ...process.env, GOMEMLIMIT: `${memoryLimitInMB}MiB` } : void 0
95015
95027
  });
95016
95028
  if (error) {
95017
95029
  logger.error("Error running Go code-aware analysis", error);