@coana-tech/cli 14.0.7 → 14.0.9

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.
Files changed (2) hide show
  1. package/cli.js +60 -26
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -92666,24 +92666,33 @@ var init_docker_spec = __esm({
92666
92666
  file: (0, import_path12.join)("package-management", "maven", "Dockerfile"),
92667
92667
  variants: {
92668
92668
  jdk8: { JDK_VERSION: "8" },
92669
- jdk9: { JDK_VERSION: "9", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.18" },
92670
- jdk10: { JDK_VERSION: "10", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.18" },
92669
+ jdk9: { JDK_VERSION: "9", ALPINE_BRANCH: "v3.18", ALPINE_REPOSITORY: "community" },
92670
+ jdk10: { JDK_VERSION: "10", ALPINE_BRANCH: "v3.18", ALPINE_REPOSITORY: "community" },
92671
92671
  jdk11: { JDK_VERSION: "11" },
92672
- jdk12: { JDK_VERSION: "12", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.18" },
92673
- jdk13: { JDK_VERSION: "13", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.18" },
92674
- jdk14: { JDK_VERSION: "14", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.18" },
92675
- jdk15: { JDK_VERSION: "15", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.18" },
92676
- jdk16: { JDK_VERSION: "16", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.18" },
92672
+ jdk12: { JDK_VERSION: "12", ALPINE_BRANCH: "v3.18", ALPINE_REPOSITORY: "community" },
92673
+ jdk13: { JDK_VERSION: "13", ALPINE_BRANCH: "v3.18", ALPINE_REPOSITORY: "community" },
92674
+ jdk14: { JDK_VERSION: "14", ALPINE_BRANCH: "v3.18", ALPINE_REPOSITORY: "community" },
92675
+ jdk15: { JDK_VERSION: "15", ALPINE_BRANCH: "v3.18", ALPINE_REPOSITORY: "community" },
92676
+ jdk16: { JDK_VERSION: "16", ALPINE_BRANCH: "v3.18", ALPINE_REPOSITORY: "community" },
92677
92677
  jdk17: { JDK_VERSION: "17" },
92678
- jdk18: { JDK_VERSION: "18", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.19" },
92679
- jdk19: { JDK_VERSION: "19", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.19" },
92680
- jdk20: { JDK_VERSION: "20", ALPINE_COMMUNITY_REPOSITORY_VERSION: "3.19" },
92678
+ jdk18: { JDK_VERSION: "18", ALPINE_BRANCH: "v3.19", ALPINE_REPOSITORY: "community" },
92679
+ jdk19: { JDK_VERSION: "19", ALPINE_BRANCH: "v3.19", ALPINE_REPOSITORY: "community" },
92680
+ jdk20: { JDK_VERSION: "20", ALPINE_BRANCH: "v3.19", ALPINE_REPOSITORY: "community" },
92681
92681
  jdk21: { JDK_VERSION: "21" }
92682
+ // jdk22: { JDK_VERSION: '22', ALPINE_BRANCH: 'edge', ALPINE_REPOSITORY: 'testing' },
92683
+ // jdk23: { JDK_VERSION: '23', ALPINE_BRANCH: 'edge', ALPINE_REPOSITORY: 'testing' },
92682
92684
  },
92683
92685
  from: {
92684
92686
  name: "maven-builder"
92685
92687
  }
92686
92688
  },
92689
+ {
92690
+ name: "maven-package-managers",
92691
+ file: (0, import_path12.join)("package-management", "maven", "Dockerfile-glibc"),
92692
+ variants: {
92693
+ jdk23: {}
92694
+ }
92695
+ },
92687
92696
  {
92688
92697
  name: "pip-package-managers",
92689
92698
  file: (0, import_path12.join)("package-management", "pip", "Dockerfile"),
@@ -93193,15 +93202,27 @@ var init_jdk_constants = __esm({
93193
93202
  "use strict";
93194
93203
  import_comparable_version3 = __toESM(require_comparable_version());
93195
93204
  MINIMUM_JDK = new import_comparable_version3.ComparableVersion("8");
93196
- MAXIMUM_JDK = new import_comparable_version3.ComparableVersion("21");
93205
+ MAXIMUM_JDK = new import_comparable_version3.ComparableVersion("23");
93197
93206
  DEFAULT_JDK = new import_comparable_version3.ComparableVersion("21");
93198
93207
  DEFAULT_KOTLIN_JDK = new import_comparable_version3.ComparableVersion("8");
93199
93208
  DEFAULT_SCALA_JDK = new import_comparable_version3.ComparableVersion("8");
93200
93209
  GRADLE_TO_JDK_COMPATIBILITY_MATRIX = {
93201
93210
  "2.0.0": new import_comparable_version3.ComparableVersion("8"),
93211
+ "4.3.0": new import_comparable_version3.ComparableVersion("9"),
93212
+ "4.7.0": new import_comparable_version3.ComparableVersion("10"),
93202
93213
  "5.0.0": new import_comparable_version3.ComparableVersion("11"),
93214
+ "5.4.0": new import_comparable_version3.ComparableVersion("12"),
93215
+ "6.0.0": new import_comparable_version3.ComparableVersion("13"),
93216
+ "6.3.0": new import_comparable_version3.ComparableVersion("14"),
93217
+ "6.7.0": new import_comparable_version3.ComparableVersion("15"),
93218
+ "7.0.0": new import_comparable_version3.ComparableVersion("16"),
93203
93219
  "7.3.0": new import_comparable_version3.ComparableVersion("17"),
93204
- "8.5.0": new import_comparable_version3.ComparableVersion("21")
93220
+ "7.5.0": new import_comparable_version3.ComparableVersion("18"),
93221
+ "7.6.0": new import_comparable_version3.ComparableVersion("19"),
93222
+ "8.3.0": new import_comparable_version3.ComparableVersion("20"),
93223
+ "8.5.0": new import_comparable_version3.ComparableVersion("21"),
93224
+ "8.8.0": new import_comparable_version3.ComparableVersion("22"),
93225
+ "8.10.0": new import_comparable_version3.ComparableVersion("23")
93205
93226
  };
93206
93227
  SBT_TO_JDK_COMPATIBILITY_MATRIX = {
93207
93228
  "1.0.0": new import_comparable_version3.ComparableVersion("8"),
@@ -93525,7 +93546,7 @@ function extractJdkVersionFromProperties(properties) {
93525
93546
  }
93526
93547
  function getGradleVersionFromWrapper(gradleWrapperProperties) {
93527
93548
  if (!gradleWrapperProperties) return void 0;
93528
- const distributionUrlRegex = /.*gradle-(\d+(_\d+(_\d+)?)?)/;
93549
+ const distributionUrlRegex = /.*gradle-(\d+(\.\d+(\.\d+)?)?)/;
93529
93550
  for (const prop2 of gradleWrapperProperties) {
93530
93551
  const [key, value] = prop2.split("=");
93531
93552
  if (key.trim() === "distributionUrl") {
@@ -93540,8 +93561,9 @@ function getJdkForGradleWrapperVersion(version2) {
93540
93561
  let chosenJdk = Object.values(GRADLE_TO_JDK_COMPATIBILITY_MATRIX)[0];
93541
93562
  if (!v || !chosenJdk) return void 0;
93542
93563
  for (const [gradleVersion, jdk] of Object.entries(GRADLE_TO_JDK_COMPATIBILITY_MATRIX).slice(1)) {
93543
- if (v.compareTo(new import_comparable_version4.ComparableVersion(gradleVersion)) >= 0) break;
93544
- chosenJdk = jdk;
93564
+ if (v.compareTo(new import_comparable_version4.ComparableVersion(gradleVersion)) >= 0) {
93565
+ chosenJdk = jdk;
93566
+ }
93545
93567
  }
93546
93568
  return chosenJdk ?? void 0;
93547
93569
  }
@@ -95452,18 +95474,16 @@ async function findPackageManagerDockerImage(packageManagerName, subprojectPath)
95452
95474
  await detectVariantMaven(subprojectPath)
95453
95475
  );
95454
95476
  }
95455
- case "GRADLE": {
95477
+ case "GRADLE":
95456
95478
  return findPackageManagerDockerImageFromSpecifier(
95457
95479
  "maven-package-managers",
95458
95480
  await detectVariantGradle(subprojectPath)
95459
95481
  );
95460
- }
95461
- case "SBT": {
95482
+ case "SBT":
95462
95483
  return findPackageManagerDockerImageFromSpecifier(
95463
95484
  "maven-package-managers",
95464
95485
  await detectVariantSbt(subprojectPath)
95465
95486
  );
95466
- }
95467
95487
  case "POETRY":
95468
95488
  case "PIP_REQUIREMENTS":
95469
95489
  case "PIPENV":
@@ -193969,7 +193989,7 @@ var require_version = __commonJS({
193969
193989
  "use strict";
193970
193990
  Object.defineProperty(exports2, "__esModule", { value: true });
193971
193991
  exports2.version = void 0;
193972
- exports2.version = "14.0.7";
193992
+ exports2.version = "14.0.9";
193973
193993
  }
193974
193994
  });
193975
193995
 
@@ -194033,18 +194053,27 @@ var require_cli_core = __commonJS({
194033
194053
  logger_singleton_1.logger.warn("--write-report-to-file is deprecated. Please use --output json instead");
194034
194054
  }
194035
194055
  if (!this.options.offlineDatabase && !this.options.apiKey) {
194036
- throw new Error("API key is required for online vulnerability scanning");
194056
+ throw new Error("An API key is required to run the Coana CLI");
194057
+ }
194058
+ if (this.options.apiKey) {
194059
+ const checkIfApiKeyIsEmptyMessage = "You may be trying to provide the API key through an environment variable or CI secret which is either undefined or empty.";
194060
+ if (this.options.apiKey.length < 15 && this.options.apiKey.startsWith("-")) {
194061
+ throw new Error(`The provided API key '${this.options.apiKey}' is invalid. ${checkIfApiKeyIsEmptyMessage}`);
194062
+ }
194063
+ if (this.options.apiKey.length < 20 || this.options.apiKey.length > 21) {
194064
+ throw new Error(`The provided API key is invalid. ${checkIfApiKeyIsEmptyMessage}`);
194065
+ }
194037
194066
  }
194038
194067
  if (!this.options.repoUrl && !this.options.projectName && !this.options.disableReportSubmission) {
194039
- throw new Error("Either --repo-url or --project-name is required for dashboard integration. Use --disable-report-submission to skip report submission");
194068
+ throw new Error("Either --repo-url or --project-name is required for dashboard integration. Use --disable-report-submission to skip report submission.");
194040
194069
  }
194041
194070
  if (this.options.disableReportSubmission && !this.options.outputDir && !this.options.printReport) {
194042
- throw new Error("Either --output-dir or --print-report is required when --disable-report-submission is used");
194071
+ throw new Error("Either --output-dir or --print-report is required when --disable-report-submission is used.");
194043
194072
  }
194044
194073
  if (this.options.ecosystems)
194045
194074
  this.options.ecosystems.forEach((ecosystem) => {
194046
194075
  if (!ecosystem_support_1.ECOSYSTEMS_WITH_TRADITIONAL_SCA_SUPPORT.includes(ecosystem)) {
194047
- throw new Error(`Invalid ecosystem: ${ecosystem}`);
194076
+ throw new Error(`Invalid ecosystem: ${ecosystem}.`);
194048
194077
  }
194049
194078
  });
194050
194079
  }
@@ -194052,7 +194081,12 @@ var require_cli_core = __commonJS({
194052
194081
  this.coanaLogPath = (0, path_1.join)(await (0, tmp_file_1.createTmpDirectory)("coana-cli-"), "coana-log.txt");
194053
194082
  logger_singleton_1.logger.initWinstonLogger(this.options.debug, this.coanaLogPath);
194054
194083
  logger_singleton_1.logger.silent = this.options.silent;
194055
- await this.initialize();
194084
+ try {
194085
+ await this.initialize();
194086
+ } catch (e) {
194087
+ logger_singleton_1.logger.error(e.message);
194088
+ process.exit(1);
194089
+ }
194056
194090
  this.spinner.start();
194057
194091
  try {
194058
194092
  if (this.shareWithDashboard) {
@@ -194066,7 +194100,7 @@ var require_cli_core = __commonJS({
194066
194100
  return report;
194067
194101
  } catch (e) {
194068
194102
  await this.spinner.fail();
194069
- logger_singleton_1.logger.error("CLI failed with error:", e);
194103
+ logger_singleton_1.logger.error("CLI failed with error:", e.message);
194070
194104
  await this.shareErrorLogWithDashboard(e, true);
194071
194105
  throw e;
194072
194106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.0.7",
3
+ "version": "14.0.9",
4
4
  "description": "Coana CLI",
5
5
  "bin": {
6
6
  "@coana-tech/cli": "./cli.js"