@coana-tech/cli 14.12.107 → 14.12.109

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
@@ -250700,7 +250700,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
250700
250700
  }
250701
250701
 
250702
250702
  // dist/version.js
250703
- var version3 = "14.12.107";
250703
+ var version3 = "14.12.109";
250704
250704
 
250705
250705
  // dist/cli-core.js
250706
250706
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -250798,7 +250798,7 @@ var CliCore = class {
250798
250798
  if (!this.options.repoUrl && !this.options.projectName && !this.options.disableReportSubmission && !this.options.offlineDatabase && !this.options.socketMode) {
250799
250799
  throw new Error("Either --repo-url or --project-name is required for dashboard integration. Use --disable-report-submission to skip report submission.");
250800
250800
  }
250801
- if ((this.options.disableReportSubmission || this.options.offlineDatabase) && !this.options.outputDir && !this.options.printReport) {
250801
+ if ((this.options.disableReportSubmission || this.options.offlineDatabase) && !this.options.outputDir && !this.options.printReport && !this.options.socketMode) {
250802
250802
  throw new Error("Either --output-dir or --print-report is required when --disable-report-submission or --offline-database is used.");
250803
250803
  }
250804
250804
  if (this.options.ecosystems)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.107",
3
+ "version": "14.12.109",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -110412,24 +110412,11 @@ function getMaxRoundsHeuristicOptions(maxRounds) {
110412
110412
  }
110413
110413
  function getOnlyPackagesInVulnPathsWithoutLeafPackagesHeuristicOptions(vulnerabilities) {
110414
110414
  return {
110415
- includePackages: computePackagesOnVulnPathExcludingVulnerablePackage(vulnerabilities)
110415
+ includePackages: computePackagesOnVulnPath(vulnerabilities)
110416
110416
  };
110417
110417
  }
110418
- function computePackagesOnVulnPathExcludingVulnerablePackage(vulnerabilities) {
110419
- const packagesToAnalyze = /* @__PURE__ */ new Set();
110420
- vulnerabilities.filter((v) => !v.vulnerabilityAccessPaths || typeof v.vulnerabilityAccessPaths !== "string").forEach((v) => {
110421
- const visitedIdentifiers = [];
110422
- const helper = (node) => {
110423
- if (node.children && node.children.length > 0)
110424
- packagesToAnalyze.add(node.packageName);
110425
- node.children?.filter((c) => !visitedIdentifiers.includes(c)).forEach((c) => {
110426
- visitedIdentifiers.push(c);
110427
- helper(v.vulnChainDetails.transitiveDependencies[c]);
110428
- });
110429
- };
110430
- helper(v.vulnChainDetails);
110431
- });
110432
- return [...packagesToAnalyze];
110418
+ function computePackagesOnVulnPath(vulnerabilities, { includeLeafPackages = false } = {}) {
110419
+ return [...new Set(vulnerabilities.filter((v) => !v.vulnerabilityAccessPaths || typeof v.vulnerabilityAccessPaths !== "string").flatMap((v) => Object.values(v.vulnChainDetails?.transitiveDependencies ?? {}).filter((d) => includeLeafPackages || d.children?.length).map((d) => d.packageName)))];
110433
110420
  }
110434
110421
 
110435
110422
  // dist/whole-program-code-aware-vulnerability-scanner/js/jelly-runner.js
@@ -110441,7 +110428,7 @@ var PRINT_JELLY_COMMAND = false;
110441
110428
  async function runJellyAnalysis(mainProjectRoot, projectRoot, jellyOptions, reachabilityAnalysisOptions, timeoutInSeconds, vulnerabilities, experiment) {
110442
110429
  const tmpFolder = await createTmpDirectory("jelly-analysis");
110443
110430
  try {
110444
- const filesToAnalyze = reachabilityAnalysisOptions.entryPoints ? reachabilityAnalysisOptions.entryPoints : [projectRoot];
110431
+ const filesToAnalyze = reachabilityAnalysisOptions.entryPoints ?? [projectRoot];
110445
110432
  const jellyExecutable = ToolPathResolver.jellyPath;
110446
110433
  const vulnerabilitiesInJellyFormat = vulnerabilities.map((v) => ({
110447
110434
  osv: v,
@@ -110454,12 +110441,6 @@ async function runJellyAnalysis(mainProjectRoot, projectRoot, jellyOptions, reac
110454
110441
  const affectedPackagesFile = resolve14(tmpFolder, "affected-packages.json");
110455
110442
  const logFile = reachabilityAnalysisOptions.analysisLogFile ?? (reachabilityAnalysisOptions.printLogFile && resolve14(projectRoot, "js-analysis.log"));
110456
110443
  await writeFile6(vulnerabilitiesFile, JSON.stringify(vulnerabilitiesInJellyFormat));
110457
- let excludeEntries;
110458
- if (reachabilityAnalysisOptions.excludeDirs?.length) {
110459
- const excludeDirsRelativeToProjectRoot = reachabilityAnalysisOptions.excludeDirs.map((d) => relative6(projectRoot, resolve14(mainProjectRoot, d)));
110460
- const excludeDirsRelativeToProjectRootWithWildcards = excludeDirsRelativeToProjectRoot.map((d) => `${d}/**`);
110461
- excludeEntries = [...excludeDirsRelativeToProjectRoot, ...excludeDirsRelativeToProjectRootWithWildcards];
110462
- }
110463
110444
  const jellyCmd = cmdt`
110464
110445
  ${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} --max-old-space-size=${reachabilityAnalysisOptions.memoryLimitInMB ?? 8192}
110465
110446
  ${jellyExecutable}
@@ -110467,10 +110448,10 @@ async function runJellyAnalysis(mainProjectRoot, projectRoot, jellyOptions, reac
110467
110448
  --timeout ${timeoutInSeconds}
110468
110449
  --vulnerabilities ${vulnerabilitiesFile}
110469
110450
  --reachable-json ${affectedPackagesFile}
110470
- ${excludeEntries && ["--exclude-entries", ...excludeEntries]}
110451
+ ${getExcludes(mainProjectRoot, projectRoot, reachabilityAnalysisOptions)}
110471
110452
  --diagnostics-json ${diagnosticsFile}
110472
110453
  --max-indirections=${jellyOptions.maxIndirections}
110473
- ${jellyOptions.includePackages && ["--include-packages", ...jellyOptions.includePackages]}
110454
+ ${!!jellyOptions.includePackages?.length && ["--include-packages", ...jellyOptions.includePackages]}
110474
110455
  ${jellyOptions.approx && "--approx"}
110475
110456
  ${logFile ? ["--logfile", logFile] : []}
110476
110457
  --callstacks-json ${callStackFile}
@@ -110528,20 +110509,30 @@ async function runJellyPhantomDependencyAnalysis(projectRoot, options) {
110528
110509
  await rm2(tmpFolder, { recursive: true });
110529
110510
  }
110530
110511
  }
110531
- async function runJellyImportReachabilityAnalysis(baseDir, projectDir, options) {
110512
+ async function runJellyImportReachabilityAnalysis(mainProjectRoot, projectRoot, vulnerabilities, options) {
110532
110513
  const tmpFolder = await createTmpDirectory("jelly-analysis");
110533
110514
  try {
110534
- const jellyExecutable = ToolPathResolver.jellyPath;
110515
+ const includePackages = computePackagesOnVulnPath(vulnerabilities, { includeLeafPackages: true });
110535
110516
  const reachableModulesFile = resolve14(tmpFolder, "reachable-modules.json");
110536
110517
  const jellyCmd = cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} --max-old-space-size=${options.memoryLimitInMB}
110537
- ${jellyExecutable} --basedir ${baseDir} --modules-only
110538
- --reachable-json ${reachableModulesFile} ${projectDir}`;
110518
+ ${ToolPathResolver.jellyPath} --basedir ${mainProjectRoot} --modules-only
110519
+ ${!!includePackages.length && ["--include-packages", ...includePackages]}
110520
+ ${getExcludes(mainProjectRoot, projectRoot, options)}
110521
+ --reachable-json ${reachableModulesFile}
110522
+ ${options.entryPoints ?? projectRoot}`;
110539
110523
  await runCommandResolveStdOut2(jellyCmd, void 0, { timeout: options.timeoutSeconds.allVulnRuns * 1e3 });
110540
110524
  return JSON.parse(await readFile8(reachableModulesFile, "utf-8"));
110541
110525
  } finally {
110542
110526
  await rm2(tmpFolder, { recursive: true });
110543
110527
  }
110544
110528
  }
110529
+ function getExcludes(mainProjectRoot, projectRoot, options) {
110530
+ if (options.excludeDirs?.length) {
110531
+ const excludeDirsRelativeToProjectRoot = options.excludeDirs.map((d) => relative6(projectRoot, resolve14(mainProjectRoot, d)));
110532
+ const excludeDirsRelativeToProjectRootWithWildcards = excludeDirsRelativeToProjectRoot.map((d) => `${d}/**`);
110533
+ return [...excludeDirsRelativeToProjectRoot, ...excludeDirsRelativeToProjectRootWithWildcards];
110534
+ }
110535
+ }
110545
110536
  function relativizeSourceLocations(projectDir, paths) {
110546
110537
  return {
110547
110538
  ...paths,
@@ -112811,7 +112802,7 @@ var NpmAnalyzer = class {
112811
112802
  try {
112812
112803
  statusUpdater?.("Running import reachability analysis");
112813
112804
  logger.debug("Starting jelly import reachability analysis");
112814
- reachable = await runJellyImportReachabilityAnalysis(this.state.rootWorkingDir, this.projectDir, this.state.reachabilityAnalysisOptions);
112805
+ reachable = await runJellyImportReachabilityAnalysis(this.state.rootWorkingDir, this.projectDir, vulns, this.state.reachabilityAnalysisOptions);
112815
112806
  } catch (e) {
112816
112807
  logger.debug("Error while running jelly import reachability analysis:", e);
112817
112808
  }
@@ -7,11 +7,11 @@ import "./iterator-helpers-polyfill.js";
7
7
  import {
8
8
  require_hints,
9
9
  require_parser
10
- } from "./chunk-VD62II65.js";
10
+ } from "./chunk-PAV2YSLW.js";
11
11
  import {
12
12
  require_proxy,
13
13
  require_sandbox
14
- } from "./chunk-GSPO4CLX.js";
14
+ } from "./chunk-XJM6ACML.js";
15
15
  import {
16
16
  __commonJS,
17
17
  __name,
@@ -21,7 +21,7 @@ import {
21
21
  require_options,
22
22
  require_transform,
23
23
  require_util
24
- } from "./chunk-LY4UAG7A.js";
24
+ } from "./chunk-VDHMBLB5.js";
25
25
 
26
26
  // lib/approx/approx.js
27
27
  var require_approx = __commonJS({
@@ -10,7 +10,7 @@ import {
10
10
  __require,
11
11
  require_logger,
12
12
  require_options
13
- } from "./chunk-LY4UAG7A.js";
13
+ } from "./chunk-VDHMBLB5.js";
14
14
 
15
15
  // node_modules/source-map/lib/base64.js
16
16
  var require_base64 = __commonJS({
@@ -224314,4 +224314,4 @@ typescript/lib/typescript.js:
224314
224314
  and limitations under the License.
224315
224315
  ***************************************************************************** *)
224316
224316
  */
224317
- //# sourceMappingURL=chunk-QVZRZ7F3.js.map
224317
+ //# sourceMappingURL=chunk-AO2BBATE.js.map
@@ -14,7 +14,7 @@ import {
14
14
  require_options,
15
15
  require_tokens,
16
16
  require_util
17
- } from "./chunk-LY4UAG7A.js";
17
+ } from "./chunk-VDHMBLB5.js";
18
18
 
19
19
  // lib/parsing/parser.js
20
20
  var require_parser = __commonJS({
@@ -516,4 +516,4 @@ export {
516
516
  require_patching,
517
517
  require_hints
518
518
  };
519
- //# sourceMappingURL=chunk-VD62II65.js.map
519
+ //# sourceMappingURL=chunk-PAV2YSLW.js.map
@@ -10924,6 +10924,16 @@ var require_logger2 = __commonJS({
10924
10924
  exports.default = logger;
10925
10925
  function setLogLevel(level) {
10926
10926
  logger.level = options_1.options.loglevel = level;
10927
+ for (const lvl of Object.keys(colors)) {
10928
+ const fnName = `is${lvl.charAt(0).toUpperCase() + lvl.slice(1)}Enabled`;
10929
+ delete logger[fnName];
10930
+ Object.defineProperty(logger, fnName, {
10931
+ value: logger.isLevelEnabled(lvl) ? () => true : () => false,
10932
+ writable: false,
10933
+ configurable: true,
10934
+ enumerable: false
10935
+ });
10936
+ }
10927
10937
  }
10928
10938
  __name(setLogLevel, "setLogLevel");
10929
10939
  function logToFile(file) {
@@ -19701,4 +19711,4 @@ fill-range/index.js:
19701
19711
  * Licensed under the MIT License.
19702
19712
  *)
19703
19713
  */
19704
- //# sourceMappingURL=chunk-LY4UAG7A.js.map
19714
+ //# sourceMappingURL=chunk-VDHMBLB5.js.map
@@ -9,7 +9,7 @@ import {
9
9
  __name,
10
10
  __require,
11
11
  require_transform
12
- } from "./chunk-LY4UAG7A.js";
12
+ } from "./chunk-VDHMBLB5.js";
13
13
 
14
14
  // lib/approx/proxy.js
15
15
  var require_proxy = __commonJS({
@@ -268,4 +268,4 @@ export {
268
268
  require_proxy,
269
269
  require_sandbox
270
270
  };
271
- //# sourceMappingURL=chunk-GSPO4CLX.js.map
271
+ //# sourceMappingURL=chunk-XJM6ACML.js.map
@@ -6,10 +6,10 @@ import "./iterator-helpers-polyfill.js";
6
6
 
7
7
  import {
8
8
  require_moduleresolver
9
- } from "./chunk-QVZRZ7F3.js";
9
+ } from "./chunk-AO2BBATE.js";
10
10
  import {
11
11
  require_sandbox
12
- } from "./chunk-GSPO4CLX.js";
12
+ } from "./chunk-XJM6ACML.js";
13
13
  import {
14
14
  __commonJS,
15
15
  __name,
@@ -17,7 +17,7 @@ import {
17
17
  require_files,
18
18
  require_options,
19
19
  require_transform
20
- } from "./chunk-LY4UAG7A.js";
20
+ } from "./chunk-VDHMBLB5.js";
21
21
 
22
22
  // lib/approx/hooks.js
23
23
  var require_hooks = __commonJS({
@@ -9,11 +9,11 @@ import {
9
9
  require_hints,
10
10
  require_parser,
11
11
  require_patching
12
- } from "./chunk-VD62II65.js";
12
+ } from "./chunk-PAV2YSLW.js";
13
13
  import {
14
14
  require_moduleresolver,
15
15
  require_typescript
16
- } from "./chunk-QVZRZ7F3.js";
16
+ } from "./chunk-AO2BBATE.js";
17
17
  import {
18
18
  __commonJS,
19
19
  __name,
@@ -37,7 +37,7 @@ import {
37
37
  require_tokens,
38
38
  require_transform,
39
39
  require_util
40
- } from "./chunk-LY4UAG7A.js";
40
+ } from "./chunk-VDHMBLB5.js";
41
41
 
42
42
  // lib/misc/timer.js
43
43
  var require_timer = __commonJS({
@@ -4367,6 +4367,8 @@ var require_analyzer = __commonJS({
4367
4367
  }
4368
4368
  if (options_1.options.modulesOnly) {
4369
4369
  (0, modulefinder_1.findModules)(ast, solver.fragmentState, moduleInfo);
4370
+ if (d.modules % 16 === 0)
4371
+ a.timeoutTimer.checkTimeout();
4370
4372
  } else {
4371
4373
  const moduleParams = (0, extras_1.preprocessAst)(ast, moduleInfo);
4372
4374
  (0, logger_1.writeStdOutIfActive)("Initializing...");