@coana-tech/cli 14.12.208 → 14.12.210

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
@@ -251742,7 +251742,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
251742
251742
  }
251743
251743
 
251744
251744
  // dist/version.js
251745
- var version3 = "14.12.208";
251745
+ var version3 = "14.12.210";
251746
251746
 
251747
251747
  // dist/cli-core.js
251748
251748
  var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.208",
3
+ "version": "14.12.210",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -110928,6 +110928,9 @@ function convertToArtifactForInstallation(dep) {
110928
110928
  }
110929
110929
 
110930
110930
  // dist/whole-program-code-aware-vulnerability-scanner/js/heuristics.js
110931
+ var largeIndirectionBoundOptions = {
110932
+ maxIndirections: 1024
110933
+ };
110931
110934
  var lazyIndirectionBoundOptions = {
110932
110935
  maxIndirections: 5
110933
110936
  };
@@ -111863,7 +111866,9 @@ var SparJSAnalysisEngine = class extends JSAnalysisEngine {
111863
111866
  --reachable-json ${affectedPackagesFile}
111864
111867
  ${getExcludes(mainProjectRoot, projectRoot, reachabilityAnalysisOptions)}
111865
111868
  --diagnostics-json ${diagnosticsFile}
111866
- --max-indirections ${maxIndirections}
111869
+ --max-indirections=${/* XXX: maxIndirections is tuned for --lazy mode, which SparJS doesn't support,
111870
+ * so we use a value that's better for non-lazy analysis. */
111871
+ maxIndirections ? largeIndirectionBoundOptions.maxIndirections : void 0}
111867
111872
  ${!!includePackages && (includePackages.length ? ["--include-packages", ...includePackages] : ["--ignore-dependencies"])}
111868
111873
  ${/* XXX: Requires Node 22+ */
111869
111874
  approx && "--approx"}
@@ -113914,8 +113919,8 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
113914
113919
  const bucketsFromLastAnalysisAndCliVersion = await dashboardAPI.getBucketsForLastReport(relative9(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, vulnerabilities[0].ecosystem ?? "NPM", COANA_REPORT_ID, apiKey);
113915
113920
  if (!bucketsFromLastAnalysisAndCliVersion)
113916
113921
  return void 0;
113917
- const { cliVersion: cliVersion2, buckets: bucketsFromLastAnalysis } = bucketsFromLastAnalysisAndCliVersion;
113918
- if (bucketsFromLastAnalysis.some((b) => b.heuristicName === heuristics.IGNORE_DEPENDENCIES_AND_MAX_ROUNDS_3.name))
113922
+ const { cliVersion: cliVersion2, buckets: rawBucketsFromLastAnalysis } = bucketsFromLastAnalysisAndCliVersion;
113923
+ if (rawBucketsFromLastAnalysis.some((b) => b.heuristicName === heuristics.IGNORE_DEPENDENCIES_AND_MAX_ROUNDS_3.name))
113919
113924
  return;
113920
113925
  try {
113921
113926
  if ((0, import_semver4.lt)(cliVersion2, CLI_VERSION_TO_USE_CACHING_FROM[ecosystem] ?? CLI_VERSION_TO_USE_CACHING_FROM_DEFAULT))
@@ -113923,6 +113928,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
113923
113928
  } catch (e) {
113924
113929
  return void 0;
113925
113930
  }
113931
+ const bucketsFromLastAnalysis = rawBucketsFromLastAnalysis.filter((b) => b.heuristicName !== "IMPORT_REACHABILITY");
113926
113932
  const duplicateUrls = findDuplicateVulnsInBuckets(bucketsFromLastAnalysis);
113927
113933
  if (duplicateUrls.length > 0) {
113928
113934
  sendWarningToDashboard(`Assertion error: Detected bucket(s) with non-unique vulnerability URLs. Non-unique URLs: ${duplicateUrls.join(" ")}.`, {
@@ -2166,6 +2166,10 @@ var require_telemetry_emitter = __commonJS({
2166
2166
  exports.telemetryEmitter = void 0;
2167
2167
  var fs_1 = __require("fs");
2168
2168
  var filePath = process.env.ANALYZER_TELEMETRY_FILE_PATH;
2169
+ function enabled() {
2170
+ return !!filePath;
2171
+ }
2172
+ __name(enabled, "enabled");
2169
2173
  function emit(eventType, data = {}) {
2170
2174
  if (!filePath)
2171
2175
  return;
@@ -2193,10 +2197,16 @@ var require_telemetry_emitter = __commonJS({
2193
2197
  emit("diagnostics", metadata);
2194
2198
  }
2195
2199
  __name(diagnostics, "diagnostics");
2200
+ function graph(name, nodes) {
2201
+ emit("graph", { name, nodes });
2202
+ }
2203
+ __name(graph, "graph");
2196
2204
  exports.telemetryEmitter = {
2205
+ enabled,
2197
2206
  phaseStarted,
2198
2207
  phaseCompleted,
2199
- diagnostics
2208
+ diagnostics,
2209
+ graph
2200
2210
  };
2201
2211
  }
2202
2212
  });
@@ -2384,6 +2394,7 @@ var require_escaping = __commonJS({
2384
2394
  var accesspaths_1 = require_accesspaths();
2385
2395
  var ecmascript_1 = require_ecmascript();
2386
2396
  var options_1 = require_options();
2397
+ var SKIP_RESOLVED_READS = false;
2387
2398
  function findEscapingObjects(ms, solver) {
2388
2399
  const a = solver.globalState;
2389
2400
  const f = solver.fragmentState;
@@ -2448,6 +2459,11 @@ var require_escaping = __commonJS({
2448
2459
  if (!(0, ecmascript_1.isInternalProperty)(p)) {
2449
2460
  const w = f.varProducer.objPropVar(t, p);
2450
2461
  addToWorklist(w);
2462
+ if (SKIP_RESOLVED_READS) {
2463
+ const readResult = f.varProducer.readResultVar(t, p);
2464
+ if (f.processedReadResultVars.has(readResult) && f.getTokensSize(f.getRepresentative(readResult))[0] > 0)
2465
+ continue;
2466
+ }
2451
2467
  solver.addToken(theUnknownAccessPathToken, f.getRepresentative(w));
2452
2468
  }
2453
2469
  }
@@ -4208,15 +4224,14 @@ var require_analysisstatereporter = __commonJS({
4208
4224
  modules.push({ moduleName: dm.getOfficialName() });
4209
4225
  return modules;
4210
4226
  }
4211
- modulesToJSON() {
4227
+ modulesToJSON(anonymize = false) {
4212
4228
  const modules = new Array();
4213
4229
  const ids = /* @__PURE__ */ new Map();
4214
- const mods = [];
4230
+ let appIdx = 0;
4215
4231
  for (const m of this.f.a.moduleInfos.values()) {
4216
4232
  ids.set(m, ids.size);
4217
- mods.push(m);
4218
4233
  const s = {
4219
- name: m.toString(),
4234
+ name: anonymize && !m.packageInfo.dir.includes("node_modules/") ? `app${appIdx++}` : m.toString(),
4220
4235
  dependencies: []
4221
4236
  };
4222
4237
  if (m.packageInfo.isEntry)
@@ -14028,6 +14043,7 @@ var require_main = __commonJS({
14028
14043
  var apiexported_1 = require_apiexported();
14029
14044
  var merge_1 = require_merge();
14030
14045
  var processmanager_1 = require_processmanager();
14046
+ var telemetry_emitter_1 = require_telemetry_emitter();
14031
14047
  var assert_1 = __importDefault(__require("assert"));
14032
14048
  var semver_1 = __importDefault(require_semver2());
14033
14049
  var ENGINES_NODE = require_package()?.engines?.node;
@@ -14293,8 +14309,11 @@ Memory limit is ${(0, memory_1.getMemoryLimit)()}MB.${options_1.PKG ? "" : " Cha
14293
14309
  out.saveCallGraph(options_1.options.callgraphJson, files);
14294
14310
  if (options_1.options.diagnosticsJson)
14295
14311
  out.saveDiagnostics(solver.diagnostics, options_1.options.diagnosticsJson);
14296
- if (options_1.options.modulesOnly)
14312
+ if (options_1.options.modulesOnly) {
14297
14313
  out.reportReachablePackagesAndModules();
14314
+ if (telemetry_emitter_1.telemetryEmitter.enabled())
14315
+ telemetry_emitter_1.telemetryEmitter.graph("modules", out.modulesToJSON(true));
14316
+ }
14298
14317
  if (options_1.options.soundness)
14299
14318
  (0, compare_1.compareCallGraphs)(options_1.options.soundness, "<computed>", out.callGraphToJSON(files), false, options_1.options.reachability);
14300
14319
  if (tapirPatterns && patterns)