@coana-tech/cli 14.12.183 → 14.12.185
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 +59 -25
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +40 -18
- package/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
- package/repos/coana-tech/javap-service/javap-service.jar +0 -0
package/cli.mjs
CHANGED
|
@@ -204870,7 +204870,7 @@ function getSocketAPI() {
|
|
|
204870
204870
|
|
|
204871
204871
|
// ../utils/src/tool-extractor.ts
|
|
204872
204872
|
import { createHash } from "node:crypto";
|
|
204873
|
-
import { createReadStream, createWriteStream as createWriteStream3, readFileSync
|
|
204873
|
+
import { createReadStream, createWriteStream as createWriteStream3, readFileSync, statSync as statSync2 } from "node:fs";
|
|
204874
204874
|
import { copyFile, cp as cp2, mkdir as mkdir4, writeFile as writeFile2 } from "node:fs/promises";
|
|
204875
204875
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
204876
204876
|
import { basename as basename3, dirname as dirname5, join as join5 } from "node:path";
|
|
@@ -205430,7 +205430,7 @@ var TelemetryCollector = class _TelemetryCollector {
|
|
|
205430
205430
|
};
|
|
205431
205431
|
|
|
205432
205432
|
// ../utils/src/telemetry/analyzer-telemetry-server.ts
|
|
205433
|
-
import { existsSync,
|
|
205433
|
+
import { existsSync, openSync, fstatSync, readSync, closeSync, watchFile, unwatchFile } from "fs";
|
|
205434
205434
|
import { unlink, writeFile } from "fs/promises";
|
|
205435
205435
|
import { tmpdir } from "os";
|
|
205436
205436
|
import { join as join2 } from "path";
|
|
@@ -205444,11 +205444,14 @@ var AnalyzerTelemetryServer = class {
|
|
|
205444
205444
|
filePath;
|
|
205445
205445
|
lastReadPosition = 0;
|
|
205446
205446
|
watching = false;
|
|
205447
|
+
fd;
|
|
205448
|
+
trailingBytes = Buffer.alloc(0);
|
|
205447
205449
|
/**
|
|
205448
205450
|
* Starts the server and returns the file path that analyzers should write to.
|
|
205449
205451
|
*/
|
|
205450
205452
|
async start() {
|
|
205451
205453
|
await writeFile(this.filePath, "");
|
|
205454
|
+
this.fd = openSync(this.filePath, "r");
|
|
205452
205455
|
this.watching = true;
|
|
205453
205456
|
watchFile(this.filePath, { interval: 1e3 }, () => {
|
|
205454
205457
|
this.processNewEvents();
|
|
@@ -205456,13 +205459,22 @@ var AnalyzerTelemetryServer = class {
|
|
|
205456
205459
|
return this.filePath;
|
|
205457
205460
|
}
|
|
205458
205461
|
processNewEvents() {
|
|
205459
|
-
if (
|
|
205462
|
+
if (this.fd === void 0) return;
|
|
205460
205463
|
try {
|
|
205461
|
-
const
|
|
205462
|
-
const
|
|
205463
|
-
|
|
205464
|
-
|
|
205465
|
-
const
|
|
205464
|
+
const stat5 = fstatSync(this.fd);
|
|
205465
|
+
const bytesToRead = stat5.size - this.lastReadPosition;
|
|
205466
|
+
if (bytesToRead <= 0) return;
|
|
205467
|
+
const buffer = Buffer.alloc(bytesToRead);
|
|
205468
|
+
const bytesRead = readSync(this.fd, buffer, 0, bytesToRead, this.lastReadPosition);
|
|
205469
|
+
this.lastReadPosition += bytesRead;
|
|
205470
|
+
const combined = Buffer.concat([this.trailingBytes, buffer.subarray(0, bytesRead)]);
|
|
205471
|
+
const lastNewline = combined.lastIndexOf(10);
|
|
205472
|
+
if (lastNewline === -1) {
|
|
205473
|
+
this.trailingBytes = combined;
|
|
205474
|
+
return;
|
|
205475
|
+
}
|
|
205476
|
+
this.trailingBytes = combined.subarray(lastNewline + 1);
|
|
205477
|
+
const lines = combined.toString("utf-8", 0, lastNewline).split("\n");
|
|
205466
205478
|
for (const line of lines) {
|
|
205467
205479
|
if (line.trim()) {
|
|
205468
205480
|
try {
|
|
@@ -205481,11 +205493,16 @@ var AnalyzerTelemetryServer = class {
|
|
|
205481
205493
|
*/
|
|
205482
205494
|
async close() {
|
|
205483
205495
|
this.processNewEvents();
|
|
205496
|
+
this.trailingBytes = Buffer.alloc(0);
|
|
205484
205497
|
this.handler.close?.();
|
|
205485
205498
|
if (this.watching) {
|
|
205486
205499
|
unwatchFile(this.filePath);
|
|
205487
205500
|
this.watching = false;
|
|
205488
205501
|
}
|
|
205502
|
+
if (this.fd !== void 0) {
|
|
205503
|
+
closeSync(this.fd);
|
|
205504
|
+
this.fd = void 0;
|
|
205505
|
+
}
|
|
205489
205506
|
if (existsSync(this.filePath)) {
|
|
205490
205507
|
try {
|
|
205491
205508
|
await unlink(this.filePath);
|
|
@@ -211845,7 +211862,7 @@ function getCliVersion() {
|
|
|
211845
211862
|
if (cliVersion) return cliVersion;
|
|
211846
211863
|
try {
|
|
211847
211864
|
const packageJsonPath = isNexeMode() ? join5(NEXE_VIRTUAL_FS_ROOT, "package.json") : join5(dirname5(dirname5(dirname5(dirname5(__filename)))), "npm-package-cli", "package.json");
|
|
211848
|
-
const packageJson = JSON.parse(
|
|
211865
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
211849
211866
|
if (process.env.ALWAYS_REEXTRACT_TOOLS === "true") {
|
|
211850
211867
|
logger.info("ALWAYS_REEXTRACT_TOOLS is set to true, re-extracting tools");
|
|
211851
211868
|
const randomVersion = Math.random().toString().slice(2, 8);
|
|
@@ -211874,7 +211891,7 @@ function loadChecksums() {
|
|
|
211874
211891
|
throw new Error("Tool extraction is only supported in nexe mode");
|
|
211875
211892
|
}
|
|
211876
211893
|
const checksumsPath = join5(NEXE_VIRTUAL_FS_ROOT, "checksums.json");
|
|
211877
|
-
return JSON.parse(
|
|
211894
|
+
return JSON.parse(readFileSync(checksumsPath, "utf-8"));
|
|
211878
211895
|
} catch (error) {
|
|
211879
211896
|
logger.warn("Failed to load checksums.json:", error);
|
|
211880
211897
|
throw new Error(
|
|
@@ -224733,7 +224750,7 @@ var TelemetryCollector2 = class _TelemetryCollector {
|
|
|
224733
224750
|
};
|
|
224734
224751
|
|
|
224735
224752
|
// ../utils/dist/telemetry/analyzer-telemetry-server.js
|
|
224736
|
-
import { existsSync as existsSync10,
|
|
224753
|
+
import { existsSync as existsSync10, openSync as openSync2, fstatSync as fstatSync2, readSync as readSync2, closeSync as closeSync2, watchFile as watchFile2, unwatchFile as unwatchFile2 } from "fs";
|
|
224737
224754
|
import { unlink as unlink2, writeFile as writeFile5 } from "fs/promises";
|
|
224738
224755
|
import { tmpdir as tmpdir3 } from "os";
|
|
224739
224756
|
import { join as join10 } from "path";
|
|
@@ -224743,6 +224760,8 @@ var AnalyzerTelemetryServer2 = class {
|
|
|
224743
224760
|
filePath;
|
|
224744
224761
|
lastReadPosition = 0;
|
|
224745
224762
|
watching = false;
|
|
224763
|
+
fd;
|
|
224764
|
+
trailingBytes = Buffer.alloc(0);
|
|
224746
224765
|
constructor(handler) {
|
|
224747
224766
|
this.handler = handler;
|
|
224748
224767
|
const fileId = randomBytes3(8).toString("hex");
|
|
@@ -224753,6 +224772,7 @@ var AnalyzerTelemetryServer2 = class {
|
|
|
224753
224772
|
*/
|
|
224754
224773
|
async start() {
|
|
224755
224774
|
await writeFile5(this.filePath, "");
|
|
224775
|
+
this.fd = openSync2(this.filePath, "r");
|
|
224756
224776
|
this.watching = true;
|
|
224757
224777
|
watchFile2(this.filePath, { interval: 1e3 }, () => {
|
|
224758
224778
|
this.processNewEvents();
|
|
@@ -224760,15 +224780,24 @@ var AnalyzerTelemetryServer2 = class {
|
|
|
224760
224780
|
return this.filePath;
|
|
224761
224781
|
}
|
|
224762
224782
|
processNewEvents() {
|
|
224763
|
-
if (
|
|
224783
|
+
if (this.fd === void 0)
|
|
224764
224784
|
return;
|
|
224765
224785
|
try {
|
|
224766
|
-
const
|
|
224767
|
-
const
|
|
224768
|
-
|
|
224769
|
-
|
|
224786
|
+
const stat5 = fstatSync2(this.fd);
|
|
224787
|
+
const bytesToRead = stat5.size - this.lastReadPosition;
|
|
224788
|
+
if (bytesToRead <= 0)
|
|
224789
|
+
return;
|
|
224790
|
+
const buffer = Buffer.alloc(bytesToRead);
|
|
224791
|
+
const bytesRead = readSync2(this.fd, buffer, 0, bytesToRead, this.lastReadPosition);
|
|
224792
|
+
this.lastReadPosition += bytesRead;
|
|
224793
|
+
const combined = Buffer.concat([this.trailingBytes, buffer.subarray(0, bytesRead)]);
|
|
224794
|
+
const lastNewline = combined.lastIndexOf(10);
|
|
224795
|
+
if (lastNewline === -1) {
|
|
224796
|
+
this.trailingBytes = combined;
|
|
224770
224797
|
return;
|
|
224771
|
-
|
|
224798
|
+
}
|
|
224799
|
+
this.trailingBytes = combined.subarray(lastNewline + 1);
|
|
224800
|
+
const lines = combined.toString("utf-8", 0, lastNewline).split("\n");
|
|
224772
224801
|
for (const line of lines) {
|
|
224773
224802
|
if (line.trim()) {
|
|
224774
224803
|
try {
|
|
@@ -224787,11 +224816,16 @@ var AnalyzerTelemetryServer2 = class {
|
|
|
224787
224816
|
*/
|
|
224788
224817
|
async close() {
|
|
224789
224818
|
this.processNewEvents();
|
|
224819
|
+
this.trailingBytes = Buffer.alloc(0);
|
|
224790
224820
|
this.handler.close?.();
|
|
224791
224821
|
if (this.watching) {
|
|
224792
224822
|
unwatchFile2(this.filePath);
|
|
224793
224823
|
this.watching = false;
|
|
224794
224824
|
}
|
|
224825
|
+
if (this.fd !== void 0) {
|
|
224826
|
+
closeSync2(this.fd);
|
|
224827
|
+
this.fd = void 0;
|
|
224828
|
+
}
|
|
224795
224829
|
if (existsSync10(this.filePath)) {
|
|
224796
224830
|
try {
|
|
224797
224831
|
await unlink2(this.filePath);
|
|
@@ -225026,7 +225060,7 @@ async function runCommandResolveStdOut4(cmd, dir, options) {
|
|
|
225026
225060
|
|
|
225027
225061
|
// ../utils/dist/package-utils.js
|
|
225028
225062
|
import { parse as parse5, join as join11, resolve as resolve17, normalize as normalize2, dirname as dirname12, basename as basename5, relative as relative4 } from "path";
|
|
225029
|
-
import { existsSync as existsSync11, readFileSync as
|
|
225063
|
+
import { existsSync as existsSync11, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync as statSync3, writeFileSync } from "fs";
|
|
225030
225064
|
function getPackageJsonObject(workspaceRoot) {
|
|
225031
225065
|
const packageJSONContent = getPackageJsonContent(workspaceRoot);
|
|
225032
225066
|
if (!packageJSONContent)
|
|
@@ -225036,7 +225070,7 @@ function getPackageJsonObject(workspaceRoot) {
|
|
|
225036
225070
|
function getPackageJsonContent(workspaceRoot) {
|
|
225037
225071
|
const packageJsonPath = getPackageJSONPath(workspaceRoot);
|
|
225038
225072
|
if (existsSync11(packageJsonPath))
|
|
225039
|
-
return
|
|
225073
|
+
return readFileSync2(packageJsonPath, "utf8");
|
|
225040
225074
|
return void 0;
|
|
225041
225075
|
}
|
|
225042
225076
|
function getPackageJSONPath(workspaceRoot) {
|
|
@@ -225455,7 +225489,7 @@ import { relative as relative8, resolve as resolve23 } from "path";
|
|
|
225455
225489
|
|
|
225456
225490
|
// ../utils/src/package-utils.ts
|
|
225457
225491
|
import { parse as parse7, join as join13, resolve as resolve22, normalize as normalize3, dirname as dirname13, basename as basename6, relative as relative7 } from "path";
|
|
225458
|
-
import { existsSync as existsSync14, readFileSync as
|
|
225492
|
+
import { existsSync as existsSync14, readFileSync as readFileSync3, readdirSync as readdirSync3, statSync as statSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
225459
225493
|
function setFieldInPackageJson(workspaceRoot, field, value2) {
|
|
225460
225494
|
const packageJSONContentObj = getPackageJsonObject2(workspaceRoot);
|
|
225461
225495
|
if (!packageJSONContentObj) return void 0;
|
|
@@ -225472,7 +225506,7 @@ function writePackageJsonContent(workspaceRoot, packageJsonContent) {
|
|
|
225472
225506
|
}
|
|
225473
225507
|
function getPackageJsonContent2(workspaceRoot) {
|
|
225474
225508
|
const packageJsonPath = getPackageJSONPath2(workspaceRoot);
|
|
225475
|
-
if (existsSync14(packageJsonPath)) return
|
|
225509
|
+
if (existsSync14(packageJsonPath)) return readFileSync3(packageJsonPath, "utf8");
|
|
225476
225510
|
return void 0;
|
|
225477
225511
|
}
|
|
225478
225512
|
function getPackageJSONPath2(workspaceRoot) {
|
|
@@ -230264,7 +230298,7 @@ import assert14 from "node:assert";
|
|
|
230264
230298
|
var import_good_enough_parser4 = __toESM(require_cjs(), 1);
|
|
230265
230299
|
init_ruby_lang();
|
|
230266
230300
|
import { resolve as resolve32, dirname as dirname21, relative as relative13 } from "node:path";
|
|
230267
|
-
import { existsSync as existsSync18, readFileSync as
|
|
230301
|
+
import { existsSync as existsSync18, readFileSync as readFileSync4, readdirSync as readdirSync4 } from "node:fs";
|
|
230268
230302
|
init_gemspec_utils();
|
|
230269
230303
|
var booleanQuery2 = import_good_enough_parser4.query.alt(
|
|
230270
230304
|
import_good_enough_parser4.query.sym(/^true|false$/, (ctx, { value: value2, offset }) => {
|
|
@@ -230380,7 +230414,7 @@ var evalGemfileQuery = import_good_enough_parser4.query.sym("eval_gemfile").join
|
|
|
230380
230414
|
const rootDir = ctx.gemfile.rootDir;
|
|
230381
230415
|
const file = relative13(rootDir, resolve32(rootDir, dirname21(ctx.gemfile.file), pathEvaluated));
|
|
230382
230416
|
if (!existsSync18(resolve32(rootDir, file))) return ctx;
|
|
230383
|
-
const sourceText =
|
|
230417
|
+
const sourceText = readFileSync4(resolve32(rootDir, file), "utf-8");
|
|
230384
230418
|
const parser2 = import_good_enough_parser4.lang.createLang(lang3);
|
|
230385
230419
|
const cursor = parser2.parse(sourceText);
|
|
230386
230420
|
const otherCtx = parser2.query(cursor, treeQuery4, {
|
|
@@ -230472,7 +230506,7 @@ var gemspecQuery = import_good_enough_parser4.query.sym("gemspec").opt(
|
|
|
230472
230506
|
const gemspecFullPath = resolve32(searchDir, gemspecFile);
|
|
230473
230507
|
const gemspecRelativePath = relative13(rootDir, gemspecFullPath);
|
|
230474
230508
|
try {
|
|
230475
|
-
const sourceText =
|
|
230509
|
+
const sourceText = readFileSync4(gemspecFullPath, "utf-8");
|
|
230476
230510
|
const gemspec = parseGemspec(rootDir, gemspecRelativePath, sourceText);
|
|
230477
230511
|
ctx.gemspecs.push(gemspec);
|
|
230478
230512
|
ctx.gems.push(...gemspec.dependencies);
|
|
@@ -251427,7 +251461,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
251427
251461
|
}
|
|
251428
251462
|
|
|
251429
251463
|
// dist/version.js
|
|
251430
|
-
var version3 = "14.12.
|
|
251464
|
+
var version3 = "14.12.185";
|
|
251431
251465
|
|
|
251432
251466
|
// dist/cli-core.js
|
|
251433
251467
|
var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
|
package/package.json
CHANGED
|
@@ -81110,7 +81110,7 @@ var TelemetryCollector = class _TelemetryCollector {
|
|
|
81110
81110
|
};
|
|
81111
81111
|
|
|
81112
81112
|
// ../utils/src/telemetry/analyzer-telemetry-server.ts
|
|
81113
|
-
import { existsSync,
|
|
81113
|
+
import { existsSync, openSync, fstatSync, readSync, closeSync, watchFile, unwatchFile } from "fs";
|
|
81114
81114
|
import { unlink, writeFile as writeFile2 } from "fs/promises";
|
|
81115
81115
|
import { tmpdir } from "os";
|
|
81116
81116
|
import { join as join2 } from "path";
|
|
@@ -81124,11 +81124,14 @@ var AnalyzerTelemetryServer = class {
|
|
|
81124
81124
|
filePath;
|
|
81125
81125
|
lastReadPosition = 0;
|
|
81126
81126
|
watching = false;
|
|
81127
|
+
fd;
|
|
81128
|
+
trailingBytes = Buffer.alloc(0);
|
|
81127
81129
|
/**
|
|
81128
81130
|
* Starts the server and returns the file path that analyzers should write to.
|
|
81129
81131
|
*/
|
|
81130
81132
|
async start() {
|
|
81131
81133
|
await writeFile2(this.filePath, "");
|
|
81134
|
+
this.fd = openSync(this.filePath, "r");
|
|
81132
81135
|
this.watching = true;
|
|
81133
81136
|
watchFile(this.filePath, { interval: 1e3 }, () => {
|
|
81134
81137
|
this.processNewEvents();
|
|
@@ -81136,13 +81139,22 @@ var AnalyzerTelemetryServer = class {
|
|
|
81136
81139
|
return this.filePath;
|
|
81137
81140
|
}
|
|
81138
81141
|
processNewEvents() {
|
|
81139
|
-
if (
|
|
81142
|
+
if (this.fd === void 0) return;
|
|
81140
81143
|
try {
|
|
81141
|
-
const
|
|
81142
|
-
const
|
|
81143
|
-
|
|
81144
|
-
|
|
81145
|
-
const
|
|
81144
|
+
const stat3 = fstatSync(this.fd);
|
|
81145
|
+
const bytesToRead = stat3.size - this.lastReadPosition;
|
|
81146
|
+
if (bytesToRead <= 0) return;
|
|
81147
|
+
const buffer = Buffer.alloc(bytesToRead);
|
|
81148
|
+
const bytesRead = readSync(this.fd, buffer, 0, bytesToRead, this.lastReadPosition);
|
|
81149
|
+
this.lastReadPosition += bytesRead;
|
|
81150
|
+
const combined = Buffer.concat([this.trailingBytes, buffer.subarray(0, bytesRead)]);
|
|
81151
|
+
const lastNewline = combined.lastIndexOf(10);
|
|
81152
|
+
if (lastNewline === -1) {
|
|
81153
|
+
this.trailingBytes = combined;
|
|
81154
|
+
return;
|
|
81155
|
+
}
|
|
81156
|
+
this.trailingBytes = combined.subarray(lastNewline + 1);
|
|
81157
|
+
const lines = combined.toString("utf-8", 0, lastNewline).split("\n");
|
|
81146
81158
|
for (const line of lines) {
|
|
81147
81159
|
if (line.trim()) {
|
|
81148
81160
|
try {
|
|
@@ -81161,11 +81173,16 @@ var AnalyzerTelemetryServer = class {
|
|
|
81161
81173
|
*/
|
|
81162
81174
|
async close() {
|
|
81163
81175
|
this.processNewEvents();
|
|
81176
|
+
this.trailingBytes = Buffer.alloc(0);
|
|
81164
81177
|
this.handler.close?.();
|
|
81165
81178
|
if (this.watching) {
|
|
81166
81179
|
unwatchFile(this.filePath);
|
|
81167
81180
|
this.watching = false;
|
|
81168
81181
|
}
|
|
81182
|
+
if (this.fd !== void 0) {
|
|
81183
|
+
closeSync(this.fd);
|
|
81184
|
+
this.fd = void 0;
|
|
81185
|
+
}
|
|
81169
81186
|
if (existsSync(this.filePath)) {
|
|
81170
81187
|
try {
|
|
81171
81188
|
await unlink(this.filePath);
|
|
@@ -88604,13 +88621,13 @@ async function downloadFile(fileUrl, outputFile) {
|
|
|
88604
88621
|
}
|
|
88605
88622
|
|
|
88606
88623
|
// ../utils/src/file-tree-utils.ts
|
|
88607
|
-
import { closeSync, lstatSync as lstatSync2, openSync, readdirSync as readdirSync3, readSync } from "fs";
|
|
88624
|
+
import { closeSync as closeSync2, lstatSync as lstatSync2, openSync as openSync2, readdirSync as readdirSync3, readSync as readSync2 } from "fs";
|
|
88608
88625
|
import { readdir as readdir3 } from "fs/promises";
|
|
88609
88626
|
import { basename as basename3, join as join8, relative as relative3, resolve as resolve5 } from "path";
|
|
88610
88627
|
|
|
88611
88628
|
// ../utils/src/package-utils.ts
|
|
88612
88629
|
import { parse as parse2, join as join7, resolve as resolve4, normalize as normalize2, dirname as dirname3, basename as basename2, relative as relative2 } from "path";
|
|
88613
|
-
import { existsSync as existsSync5, readFileSync
|
|
88630
|
+
import { existsSync as existsSync5, readFileSync, readdirSync as readdirSync2, statSync, writeFileSync } from "fs";
|
|
88614
88631
|
function getPackageJsonObject(workspaceRoot) {
|
|
88615
88632
|
const packageJSONContent = getPackageJsonContent(workspaceRoot);
|
|
88616
88633
|
if (!packageJSONContent) return void 0;
|
|
@@ -88618,7 +88635,7 @@ function getPackageJsonObject(workspaceRoot) {
|
|
|
88618
88635
|
}
|
|
88619
88636
|
function getPackageJsonContent(workspaceRoot) {
|
|
88620
88637
|
const packageJsonPath = getPackageJSONPath(workspaceRoot);
|
|
88621
|
-
if (existsSync5(packageJsonPath)) return
|
|
88638
|
+
if (existsSync5(packageJsonPath)) return readFileSync(packageJsonPath, "utf8");
|
|
88622
88639
|
return void 0;
|
|
88623
88640
|
}
|
|
88624
88641
|
function getPackageJSONPath(workspaceRoot) {
|
|
@@ -88901,7 +88918,7 @@ var ToolPathResolver = class {
|
|
|
88901
88918
|
|
|
88902
88919
|
// dist/whole-program-code-aware-vulnerability-scanner/code-aware-vulnerability-scanner.js
|
|
88903
88920
|
var import_lodash13 = __toESM(require_lodash(), 1);
|
|
88904
|
-
import { readFileSync as
|
|
88921
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
88905
88922
|
import { resolve as resolve16 } from "path";
|
|
88906
88923
|
|
|
88907
88924
|
// dist/whole-program-code-aware-vulnerability-scanner/dotnet/dotnet-code-aware-vulnerability-scanner.js
|
|
@@ -88918,7 +88935,7 @@ function getUrlForPackage(packageName, version3) {
|
|
|
88918
88935
|
|
|
88919
88936
|
// ../utils/src/tool-extractor.ts
|
|
88920
88937
|
import { createHash } from "node:crypto";
|
|
88921
|
-
import { createReadStream, createWriteStream as createWriteStream3, readFileSync as
|
|
88938
|
+
import { createReadStream, createWriteStream as createWriteStream3, readFileSync as readFileSync2, statSync as statSync3 } from "node:fs";
|
|
88922
88939
|
import { copyFile as copyFile2, cp as cp4, mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
|
|
88923
88940
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
88924
88941
|
import { basename as basename5, dirname as dirname8, join as join11 } from "node:path";
|
|
@@ -94082,7 +94099,7 @@ function getCliVersion() {
|
|
|
94082
94099
|
if (cliVersion) return cliVersion;
|
|
94083
94100
|
try {
|
|
94084
94101
|
const packageJsonPath = isNexeMode() ? join11(NEXE_VIRTUAL_FS_ROOT, "package.json") : join11(dirname8(dirname8(dirname8(dirname8(__filename)))), "npm-package-cli", "package.json");
|
|
94085
|
-
const packageJson = JSON.parse(
|
|
94102
|
+
const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
|
|
94086
94103
|
if (process.env.ALWAYS_REEXTRACT_TOOLS === "true") {
|
|
94087
94104
|
logger.info("ALWAYS_REEXTRACT_TOOLS is set to true, re-extracting tools");
|
|
94088
94105
|
const randomVersion = Math.random().toString().slice(2, 8);
|
|
@@ -94111,7 +94128,7 @@ function loadChecksums() {
|
|
|
94111
94128
|
throw new Error("Tool extraction is only supported in nexe mode");
|
|
94112
94129
|
}
|
|
94113
94130
|
const checksumsPath = join11(NEXE_VIRTUAL_FS_ROOT, "checksums.json");
|
|
94114
|
-
return JSON.parse(
|
|
94131
|
+
return JSON.parse(readFileSync2(checksumsPath, "utf-8"));
|
|
94115
94132
|
} catch (error) {
|
|
94116
94133
|
logger.warn("Failed to load checksums.json:", error);
|
|
94117
94134
|
throw new Error(
|
|
@@ -111445,6 +111462,11 @@ ${stderr}`);
|
|
|
111445
111462
|
logger.debug("Analysis results", result);
|
|
111446
111463
|
const reachedModules = JSON.parse(await readFile10(reachedModulesOutputFile, "utf8"));
|
|
111447
111464
|
logger.debug("Reached modules", reachedModules);
|
|
111465
|
+
let [vulnAnalysisTime, vulnPathsTime] = [0, 0];
|
|
111466
|
+
for (const run of diagnostics.runs) {
|
|
111467
|
+
vulnAnalysisTime += run.vulnAnalysisTime;
|
|
111468
|
+
vulnPathsTime += run.vulnPathsTime;
|
|
111469
|
+
}
|
|
111448
111470
|
return {
|
|
111449
111471
|
type: "success",
|
|
111450
111472
|
diagnostics: {
|
|
@@ -111452,9 +111474,9 @@ ${stderr}`);
|
|
|
111452
111474
|
timeout: false,
|
|
111453
111475
|
aborted: false,
|
|
111454
111476
|
timings: {
|
|
111455
|
-
analysisTime: diagnostics.
|
|
111456
|
-
patternMatchingTime:
|
|
111457
|
-
vulnerablePathDetectionTime:
|
|
111477
|
+
analysisTime: diagnostics.time - vulnAnalysisTime - vulnPathsTime,
|
|
111478
|
+
patternMatchingTime: vulnAnalysisTime,
|
|
111479
|
+
vulnerablePathDetectionTime: vulnPathsTime
|
|
111458
111480
|
}
|
|
111459
111481
|
},
|
|
111460
111482
|
reachedDependencies: true,
|
|
@@ -112250,7 +112272,7 @@ async function runWithJSHeuristics(cb) {
|
|
|
112250
112272
|
function getCurrentCommitHash(project) {
|
|
112251
112273
|
const headShaPath = resolve16(COANA_REPOS_PATH(), project, "HEAD_SHA");
|
|
112252
112274
|
try {
|
|
112253
|
-
const content =
|
|
112275
|
+
const content = readFileSync3(headShaPath, "utf-8").trim();
|
|
112254
112276
|
const colonIndex = content.indexOf(":");
|
|
112255
112277
|
return colonIndex !== -1 ? content.slice(colonIndex + 1) : content;
|
|
112256
112278
|
} catch {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|