@coana-tech/cli 14.12.140 → 14.12.142
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 +154 -80
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +178 -39
- 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/repos/coana-tech/jelly-private/dist/bundle/approx.js +3 -3
- package/repos/coana-tech/jelly-private/dist/bundle/{chunk-IEQ4BC6O.js → chunk-3MLCDX4W.js} +2 -2
- package/repos/coana-tech/jelly-private/dist/bundle/{chunk-IK6PDI7V.js → chunk-5V2V4LSG.js} +2 -2
- package/repos/coana-tech/jelly-private/dist/bundle/{chunk-4VFJ6VRH.js → chunk-NIHHHBFM.js} +2 -2
- package/repos/coana-tech/jelly-private/dist/bundle/{chunk-BDEOKPLQ.js → chunk-ODOUARTV.js} +25 -12
- package/repos/coana-tech/jelly-private/dist/bundle/hooks.js +3 -3
- package/repos/coana-tech/jelly-private/dist/bundle/jelly.js +7324 -7163
package/cli.mjs
CHANGED
|
@@ -209030,6 +209030,28 @@ function prettyPrintAxiosError(error) {
|
|
|
209030
209030
|
}
|
|
209031
209031
|
|
|
209032
209032
|
// ../utils/src/dashboard-api/socket-api.ts
|
|
209033
|
+
var HEARTBEAT_DEBUG = !!process.env.HEARTBEAT_DEBUG;
|
|
209034
|
+
var HEARTBEAT_INTERVAL_MS = HEARTBEAT_DEBUG ? 1e4 : 3e4;
|
|
209035
|
+
function formatElapsed(elapsedMs) {
|
|
209036
|
+
const secs = Math.floor(elapsedMs / 1e3);
|
|
209037
|
+
const mins = Math.floor(secs / 60);
|
|
209038
|
+
const remainingSecs = secs % 60;
|
|
209039
|
+
return `${mins}m ${remainingSecs}s`;
|
|
209040
|
+
}
|
|
209041
|
+
async function withHeartbeat(prefix, messages, operation) {
|
|
209042
|
+
const startTime = Date.now();
|
|
209043
|
+
let index2 = 0;
|
|
209044
|
+
const timer = setInterval(() => {
|
|
209045
|
+
const msg = messages[index2 % messages.length];
|
|
209046
|
+
logger.info(`${prefix}: ${msg} (${formatElapsed(Date.now() - startTime)})`);
|
|
209047
|
+
index2++;
|
|
209048
|
+
}, HEARTBEAT_INTERVAL_MS);
|
|
209049
|
+
try {
|
|
209050
|
+
return await operation();
|
|
209051
|
+
} finally {
|
|
209052
|
+
clearInterval(timer);
|
|
209053
|
+
}
|
|
209054
|
+
}
|
|
209033
209055
|
var axios2 = getAxiosClient();
|
|
209034
209056
|
function getSocketApiUrl(endpoint) {
|
|
209035
209057
|
let baseUrl = process.env.SOCKET_CLI_API_BASE_URL ?? "https://api.socket.dev/v0/";
|
|
@@ -209300,40 +209322,50 @@ async function initializePregeneratedSbomMatcher() {
|
|
|
209300
209322
|
}
|
|
209301
209323
|
return pregeneratedSbomMatcher;
|
|
209302
209324
|
}
|
|
209325
|
+
var SOCKET_HEARTBEAT_MESSAGES = [
|
|
209326
|
+
"Waiting for Socket backend...",
|
|
209327
|
+
"Processing dependencies...",
|
|
209328
|
+
"Building dependency graph...",
|
|
209329
|
+
"Crawling artifacts...",
|
|
209330
|
+
"Checking for vulnerabilities...",
|
|
209331
|
+
"Resolving SBOM..."
|
|
209332
|
+
];
|
|
209303
209333
|
async function fetchArtifactsFromManifestsTarHash(manifestsTarHash, includePrecomputedReachabilityResults, useOnlyPregeneratedSboms) {
|
|
209304
209334
|
logger.info("Fetching artifacts from Socket backend (this may take a while)");
|
|
209305
209335
|
logger.debug("manifests tar hash", manifestsTarHash);
|
|
209306
|
-
|
|
209307
|
-
|
|
209308
|
-
|
|
209309
|
-
|
|
209310
|
-
|
|
209311
|
-
|
|
209312
|
-
|
|
209313
|
-
|
|
209314
|
-
|
|
209315
|
-
|
|
209316
|
-
|
|
209317
|
-
|
|
209318
|
-
|
|
209319
|
-
|
|
209320
|
-
|
|
209321
|
-
|
|
209322
|
-
|
|
209323
|
-
if (result.artifacts.length === 0) {
|
|
209324
|
-
logger.error(
|
|
209325
|
-
"No artifacts found from pregenerated SBOMs. Make sure there are CDX or SPDX files in your project when using the --reach-use-only-pregenerated-sboms flag."
|
|
209336
|
+
return withHeartbeat("Socket", SOCKET_HEARTBEAT_MESSAGES, async () => {
|
|
209337
|
+
let responseData;
|
|
209338
|
+
try {
|
|
209339
|
+
const params = new URLSearchParams({
|
|
209340
|
+
tarHash: manifestsTarHash,
|
|
209341
|
+
includePrecomputedReachabilityResults: String(includePrecomputedReachabilityResults ?? false)
|
|
209342
|
+
});
|
|
209343
|
+
const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/compute-artifacts?${params.toString()}`);
|
|
209344
|
+
responseData = (await axios2.post(url2, {}, { headers: getAuthHeaders() })).data;
|
|
209345
|
+
const result = parseComputeArtifactsResponse(responseData);
|
|
209346
|
+
if (useOnlyPregeneratedSboms) {
|
|
209347
|
+
const matcher = await initializePregeneratedSbomMatcher();
|
|
209348
|
+
result.artifacts = result.artifacts.filter(
|
|
209349
|
+
(artifact) => artifact.manifestFiles?.some((ref) => {
|
|
209350
|
+
const fileName3 = ref.file.split("/").pop() ?? ref.file;
|
|
209351
|
+
return matcher(fileName3);
|
|
209352
|
+
})
|
|
209326
209353
|
);
|
|
209354
|
+
if (result.artifacts.length === 0) {
|
|
209355
|
+
logger.error(
|
|
209356
|
+
"No artifacts found from pregenerated SBOMs. Make sure there are CDX or SPDX files in your project when using the --reach-use-only-pregenerated-sboms flag."
|
|
209357
|
+
);
|
|
209358
|
+
}
|
|
209327
209359
|
}
|
|
209360
|
+
return result;
|
|
209361
|
+
} catch (e) {
|
|
209362
|
+
if (!(e instanceof AxiosError2)) {
|
|
209363
|
+
logger.debug(`compute artifacts response data:${responseData ?? "no response data"}`);
|
|
209364
|
+
}
|
|
209365
|
+
handleError(e, "Failed to fetch artifacts from Socket API using manifests tar hash", true);
|
|
209366
|
+
throw new Error("we should never reach this point");
|
|
209328
209367
|
}
|
|
209329
|
-
|
|
209330
|
-
} catch (e) {
|
|
209331
|
-
if (!(e instanceof AxiosError2)) {
|
|
209332
|
-
logger.debug(`compute artifacts response data:${responseData ?? "no response data"}`);
|
|
209333
|
-
}
|
|
209334
|
-
handleError(e, "Failed to fetch artifacts from Socket API using manifests tar hash", true);
|
|
209335
|
-
throw new Error("we should never reach this point");
|
|
209336
|
-
}
|
|
209368
|
+
});
|
|
209337
209369
|
}
|
|
209338
209370
|
async function uploadManifestsAndGetTarHash(rootDir, manifestFiles) {
|
|
209339
209371
|
const formData = new import_form_data2.default();
|
|
@@ -209723,11 +209755,17 @@ var Spinner = class _Spinner {
|
|
|
209723
209755
|
getText() {
|
|
209724
209756
|
return this.header;
|
|
209725
209757
|
}
|
|
209726
|
-
setStatus(status) {
|
|
209758
|
+
async setStatus(status) {
|
|
209759
|
+
await this.mutex.acquire();
|
|
209727
209760
|
this.status = status;
|
|
209761
|
+
this.oraInstance.text = this.getCombinedText();
|
|
209762
|
+
this.mutex.release();
|
|
209728
209763
|
}
|
|
209729
|
-
clearStatus() {
|
|
209764
|
+
async clearStatus() {
|
|
209765
|
+
await this.mutex.acquire();
|
|
209730
209766
|
this.status = void 0;
|
|
209767
|
+
this.oraInstance.text = this.getCombinedText();
|
|
209768
|
+
this.mutex.release();
|
|
209731
209769
|
}
|
|
209732
209770
|
async succeed() {
|
|
209733
209771
|
if (this.tasks.size > 0) return;
|
|
@@ -209827,34 +209865,49 @@ ${stderr}`) ? em.slice(0, -stderr.length - 1) : em}`);
|
|
|
209827
209865
|
logger[logLevel](`stdout: ${stdout}`);
|
|
209828
209866
|
logger[logLevel](`stderr: ${stderr}`);
|
|
209829
209867
|
}
|
|
209868
|
+
function startHeartbeat(options) {
|
|
209869
|
+
const startTime = Date.now();
|
|
209870
|
+
let index2 = Math.floor(Math.random() * options.messages.length);
|
|
209871
|
+
const timer = setInterval(() => {
|
|
209872
|
+
options.onMessage(options.messages[index2], Date.now() - startTime);
|
|
209873
|
+
index2 = (index2 + 1) % options.messages.length;
|
|
209874
|
+
}, options.intervalMs);
|
|
209875
|
+
timer.unref?.();
|
|
209876
|
+
return () => clearInterval(timer);
|
|
209877
|
+
}
|
|
209830
209878
|
async function execNeverFail(cmd, dir, options) {
|
|
209831
|
-
|
|
209832
|
-
|
|
209833
|
-
|
|
209834
|
-
|
|
209835
|
-
|
|
209836
|
-
|
|
209837
|
-
|
|
209838
|
-
|
|
209839
|
-
|
|
209840
|
-
|
|
209841
|
-
|
|
209842
|
-
|
|
209843
|
-
|
|
209844
|
-
|
|
209845
|
-
|
|
209846
|
-
|
|
209879
|
+
const stopHeartbeat = options?.heartbeat ? startHeartbeat(options.heartbeat) : void 0;
|
|
209880
|
+
try {
|
|
209881
|
+
return await new Promise((resolve45) => {
|
|
209882
|
+
let args2;
|
|
209883
|
+
if (typeof cmd !== "string") [cmd, ...args2] = cmd;
|
|
209884
|
+
const timeout = options?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
209885
|
+
const childProcess = execFile(
|
|
209886
|
+
cmd,
|
|
209887
|
+
args2,
|
|
209888
|
+
{ ...options, cwd: dir, maxBuffer: 1024 * 1024 * 1024, shell: args2 === void 0, timeout },
|
|
209889
|
+
(error, stdout, stderr) => {
|
|
209890
|
+
resolve45({ error, stdout, stderr });
|
|
209891
|
+
}
|
|
209892
|
+
);
|
|
209893
|
+
if (options?.pipe) {
|
|
209894
|
+
childProcess.stdout?.on("data", (data2) => {
|
|
209895
|
+
Spinner.instance().suspend(() => {
|
|
209896
|
+
process.stdout.write(data2);
|
|
209897
|
+
});
|
|
209847
209898
|
});
|
|
209848
|
-
|
|
209849
|
-
|
|
209850
|
-
|
|
209851
|
-
|
|
209899
|
+
childProcess.stderr?.on("data", (data2) => {
|
|
209900
|
+
Spinner.instance().suspend(() => {
|
|
209901
|
+
process.stderr.write(data2);
|
|
209902
|
+
});
|
|
209852
209903
|
});
|
|
209853
|
-
}
|
|
209854
|
-
|
|
209855
|
-
|
|
209856
|
-
|
|
209857
|
-
}
|
|
209904
|
+
}
|
|
209905
|
+
if (options?.stdin) childProcess.stdin?.write(options.stdin);
|
|
209906
|
+
childProcess.stdin?.end();
|
|
209907
|
+
});
|
|
209908
|
+
} finally {
|
|
209909
|
+
stopHeartbeat?.();
|
|
209910
|
+
}
|
|
209858
209911
|
}
|
|
209859
209912
|
async function exec(cmd, dir, options) {
|
|
209860
209913
|
const { error, stdout, stderr } = await execNeverFail(cmd, dir, options);
|
|
@@ -228633,11 +228686,17 @@ var Spinner2 = class _Spinner {
|
|
|
228633
228686
|
getText() {
|
|
228634
228687
|
return this.header;
|
|
228635
228688
|
}
|
|
228636
|
-
setStatus(status) {
|
|
228689
|
+
async setStatus(status) {
|
|
228690
|
+
await this.mutex.acquire();
|
|
228637
228691
|
this.status = status;
|
|
228692
|
+
this.oraInstance.text = this.getCombinedText();
|
|
228693
|
+
this.mutex.release();
|
|
228638
228694
|
}
|
|
228639
|
-
clearStatus() {
|
|
228695
|
+
async clearStatus() {
|
|
228696
|
+
await this.mutex.acquire();
|
|
228640
228697
|
this.status = void 0;
|
|
228698
|
+
this.oraInstance.text = this.getCombinedText();
|
|
228699
|
+
this.mutex.release();
|
|
228641
228700
|
}
|
|
228642
228701
|
async succeed() {
|
|
228643
228702
|
if (this.tasks.size > 0)
|
|
@@ -228737,31 +228796,46 @@ ${stderr}`) ? em.slice(0, -stderr.length - 1) : em}`);
|
|
|
228737
228796
|
logger[logLevel](`stdout: ${stdout}`);
|
|
228738
228797
|
logger[logLevel](`stderr: ${stderr}`);
|
|
228739
228798
|
}
|
|
228799
|
+
function startHeartbeat2(options) {
|
|
228800
|
+
const startTime = Date.now();
|
|
228801
|
+
let index2 = Math.floor(Math.random() * options.messages.length);
|
|
228802
|
+
const timer = setInterval(() => {
|
|
228803
|
+
options.onMessage(options.messages[index2], Date.now() - startTime);
|
|
228804
|
+
index2 = (index2 + 1) % options.messages.length;
|
|
228805
|
+
}, options.intervalMs);
|
|
228806
|
+
timer.unref?.();
|
|
228807
|
+
return () => clearInterval(timer);
|
|
228808
|
+
}
|
|
228740
228809
|
async function execNeverFail3(cmd, dir, options) {
|
|
228741
|
-
|
|
228742
|
-
|
|
228743
|
-
|
|
228744
|
-
|
|
228745
|
-
|
|
228746
|
-
|
|
228747
|
-
|
|
228748
|
-
|
|
228749
|
-
|
|
228750
|
-
childProcess.stdout?.on("data", (data2) => {
|
|
228751
|
-
Spinner2.instance().suspend(() => {
|
|
228752
|
-
process.stdout.write(data2);
|
|
228753
|
-
});
|
|
228810
|
+
const stopHeartbeat = options?.heartbeat ? startHeartbeat2(options.heartbeat) : void 0;
|
|
228811
|
+
try {
|
|
228812
|
+
return await new Promise((resolve45) => {
|
|
228813
|
+
let args2;
|
|
228814
|
+
if (typeof cmd !== "string")
|
|
228815
|
+
[cmd, ...args2] = cmd;
|
|
228816
|
+
const timeout = options?.timeout ?? DEFAULT_TIMEOUT_MS2;
|
|
228817
|
+
const childProcess = execFile2(cmd, args2, { ...options, cwd: dir, maxBuffer: 1024 * 1024 * 1024, shell: args2 === void 0, timeout }, (error, stdout, stderr) => {
|
|
228818
|
+
resolve45({ error, stdout, stderr });
|
|
228754
228819
|
});
|
|
228755
|
-
|
|
228756
|
-
|
|
228757
|
-
|
|
228820
|
+
if (options?.pipe) {
|
|
228821
|
+
childProcess.stdout?.on("data", (data2) => {
|
|
228822
|
+
Spinner2.instance().suspend(() => {
|
|
228823
|
+
process.stdout.write(data2);
|
|
228824
|
+
});
|
|
228758
228825
|
});
|
|
228759
|
-
|
|
228760
|
-
|
|
228761
|
-
|
|
228762
|
-
|
|
228763
|
-
|
|
228764
|
-
|
|
228826
|
+
childProcess.stderr?.on("data", (data2) => {
|
|
228827
|
+
Spinner2.instance().suspend(() => {
|
|
228828
|
+
process.stderr.write(data2);
|
|
228829
|
+
});
|
|
228830
|
+
});
|
|
228831
|
+
}
|
|
228832
|
+
if (options?.stdin)
|
|
228833
|
+
childProcess.stdin?.write(options.stdin);
|
|
228834
|
+
childProcess.stdin?.end();
|
|
228835
|
+
});
|
|
228836
|
+
} finally {
|
|
228837
|
+
stopHeartbeat?.();
|
|
228838
|
+
}
|
|
228765
228839
|
}
|
|
228766
228840
|
async function runCommandResolveStdOut3(cmd, dir, options) {
|
|
228767
228841
|
const { stdout, error } = await execNeverFail3(cmd, dir, options);
|
|
@@ -254983,7 +255057,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
254983
255057
|
}
|
|
254984
255058
|
|
|
254985
255059
|
// dist/version.js
|
|
254986
|
-
var version3 = "14.12.
|
|
255060
|
+
var version3 = "14.12.142";
|
|
254987
255061
|
|
|
254988
255062
|
// dist/cli-core.js
|
|
254989
255063
|
var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
|
package/package.json
CHANGED
|
@@ -76214,11 +76214,17 @@ var Spinner = class _Spinner {
|
|
|
76214
76214
|
getText() {
|
|
76215
76215
|
return this.header;
|
|
76216
76216
|
}
|
|
76217
|
-
setStatus(status) {
|
|
76217
|
+
async setStatus(status) {
|
|
76218
|
+
await this.mutex.acquire();
|
|
76218
76219
|
this.status = status;
|
|
76220
|
+
this.oraInstance.text = this.getCombinedText();
|
|
76221
|
+
this.mutex.release();
|
|
76219
76222
|
}
|
|
76220
|
-
clearStatus() {
|
|
76223
|
+
async clearStatus() {
|
|
76224
|
+
await this.mutex.acquire();
|
|
76221
76225
|
this.status = void 0;
|
|
76226
|
+
this.oraInstance.text = this.getCombinedText();
|
|
76227
|
+
this.mutex.release();
|
|
76222
76228
|
}
|
|
76223
76229
|
async succeed() {
|
|
76224
76230
|
if (this.tasks.size > 0) return;
|
|
@@ -80594,6 +80600,7 @@ function getPurlFromSocketFactArtifact(artifact) {
|
|
|
80594
80600
|
}
|
|
80595
80601
|
|
|
80596
80602
|
// ../utils/src/dashboard-api/socket-api.ts
|
|
80603
|
+
var HEARTBEAT_DEBUG = !!process.env.HEARTBEAT_DEBUG;
|
|
80597
80604
|
var axios2 = getAxiosClient();
|
|
80598
80605
|
function getSocketApiUrl(endpoint) {
|
|
80599
80606
|
let baseUrl = process.env.SOCKET_CLI_API_BASE_URL ?? "https://api.socket.dev/v0/";
|
|
@@ -81008,34 +81015,49 @@ ${stderr}`) ? em.slice(0, -stderr.length - 1) : em}`);
|
|
|
81008
81015
|
logger[logLevel](`stdout: ${stdout}`);
|
|
81009
81016
|
logger[logLevel](`stderr: ${stderr}`);
|
|
81010
81017
|
}
|
|
81018
|
+
function startHeartbeat(options) {
|
|
81019
|
+
const startTime = Date.now();
|
|
81020
|
+
let index2 = Math.floor(Math.random() * options.messages.length);
|
|
81021
|
+
const timer = setInterval(() => {
|
|
81022
|
+
options.onMessage(options.messages[index2], Date.now() - startTime);
|
|
81023
|
+
index2 = (index2 + 1) % options.messages.length;
|
|
81024
|
+
}, options.intervalMs);
|
|
81025
|
+
timer.unref?.();
|
|
81026
|
+
return () => clearInterval(timer);
|
|
81027
|
+
}
|
|
81011
81028
|
async function execNeverFail(cmd, dir, options) {
|
|
81012
|
-
|
|
81013
|
-
|
|
81014
|
-
|
|
81015
|
-
|
|
81016
|
-
|
|
81017
|
-
|
|
81018
|
-
|
|
81019
|
-
|
|
81020
|
-
|
|
81021
|
-
|
|
81022
|
-
|
|
81023
|
-
|
|
81024
|
-
|
|
81025
|
-
|
|
81026
|
-
|
|
81027
|
-
|
|
81029
|
+
const stopHeartbeat = options?.heartbeat ? startHeartbeat(options.heartbeat) : void 0;
|
|
81030
|
+
try {
|
|
81031
|
+
return await new Promise((resolve23) => {
|
|
81032
|
+
let args;
|
|
81033
|
+
if (typeof cmd !== "string") [cmd, ...args] = cmd;
|
|
81034
|
+
const timeout = options?.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
81035
|
+
const childProcess = execFile(
|
|
81036
|
+
cmd,
|
|
81037
|
+
args,
|
|
81038
|
+
{ ...options, cwd: dir, maxBuffer: 1024 * 1024 * 1024, shell: args === void 0, timeout },
|
|
81039
|
+
(error, stdout, stderr) => {
|
|
81040
|
+
resolve23({ error, stdout, stderr });
|
|
81041
|
+
}
|
|
81042
|
+
);
|
|
81043
|
+
if (options?.pipe) {
|
|
81044
|
+
childProcess.stdout?.on("data", (data2) => {
|
|
81045
|
+
Spinner.instance().suspend(() => {
|
|
81046
|
+
process.stdout.write(data2);
|
|
81047
|
+
});
|
|
81028
81048
|
});
|
|
81029
|
-
|
|
81030
|
-
|
|
81031
|
-
|
|
81032
|
-
|
|
81049
|
+
childProcess.stderr?.on("data", (data2) => {
|
|
81050
|
+
Spinner.instance().suspend(() => {
|
|
81051
|
+
process.stderr.write(data2);
|
|
81052
|
+
});
|
|
81033
81053
|
});
|
|
81034
|
-
}
|
|
81035
|
-
|
|
81036
|
-
|
|
81037
|
-
|
|
81038
|
-
}
|
|
81054
|
+
}
|
|
81055
|
+
if (options?.stdin) childProcess.stdin?.write(options.stdin);
|
|
81056
|
+
childProcess.stdin?.end();
|
|
81057
|
+
});
|
|
81058
|
+
} finally {
|
|
81059
|
+
stopHeartbeat?.();
|
|
81060
|
+
}
|
|
81039
81061
|
}
|
|
81040
81062
|
async function exec(cmd, dir, options) {
|
|
81041
81063
|
const { error, stdout, stderr } = await execNeverFail(cmd, dir, options);
|
|
@@ -88292,6 +88314,118 @@ async function withTmpDirectory(prefix, fn, deleteTmpDir = true) {
|
|
|
88292
88314
|
// ../web-compat-utils/src/vuln-chain-detail-utils.ts
|
|
88293
88315
|
var ROOT_NODE_STR = "";
|
|
88294
88316
|
|
|
88317
|
+
// dist/analyzer-heartbeats.js
|
|
88318
|
+
var DEBUG_MODE = !!process.env.HEARTBEAT_DEBUG;
|
|
88319
|
+
var HEARTBEAT_INTERVAL_MS = DEBUG_MODE ? 1e4 : 3e4;
|
|
88320
|
+
function formatElapsed(elapsedMs) {
|
|
88321
|
+
const secs = Math.floor(elapsedMs / 1e3);
|
|
88322
|
+
const mins = Math.floor(secs / 60);
|
|
88323
|
+
const remainingSecs = secs % 60;
|
|
88324
|
+
return `${mins}m ${remainingSecs}s`;
|
|
88325
|
+
}
|
|
88326
|
+
function createHeartbeat(prefix, messages) {
|
|
88327
|
+
return {
|
|
88328
|
+
intervalMs: HEARTBEAT_INTERVAL_MS,
|
|
88329
|
+
messages,
|
|
88330
|
+
onMessage: (msg, elapsed) => {
|
|
88331
|
+
logger.info(`${prefix}: ${msg} (${formatElapsed(elapsed)})`);
|
|
88332
|
+
}
|
|
88333
|
+
};
|
|
88334
|
+
}
|
|
88335
|
+
var HEARTBEATS = {
|
|
88336
|
+
// Data flow analyzers
|
|
88337
|
+
js: createHeartbeat("JS Reachability Analyzer", [
|
|
88338
|
+
"Building call graph...",
|
|
88339
|
+
"Tracing data flow...",
|
|
88340
|
+
"Analyzing reachability paths...",
|
|
88341
|
+
"Processing dependencies...",
|
|
88342
|
+
"Mapping function calls...",
|
|
88343
|
+
"Evaluating vulnerability exposure...",
|
|
88344
|
+
"Propagating data flow through assignments...",
|
|
88345
|
+
"Resolving dynamic property accesses...",
|
|
88346
|
+
"Tracking inter-procedural data flow...",
|
|
88347
|
+
"Analyzing callback invocations...",
|
|
88348
|
+
"Computing points-to sets...",
|
|
88349
|
+
"Evaluating reachability..."
|
|
88350
|
+
]),
|
|
88351
|
+
python: createHeartbeat("Python Reachability Analyzer", [
|
|
88352
|
+
"Analyzing modules...",
|
|
88353
|
+
"Tracing import paths...",
|
|
88354
|
+
"Building dependency graph...",
|
|
88355
|
+
"Building call graph...",
|
|
88356
|
+
"Analyzing reachability paths...",
|
|
88357
|
+
"Checking reachability...",
|
|
88358
|
+
"Propagating data flow through functions...",
|
|
88359
|
+
"Resolving dynamic attribute accesses...",
|
|
88360
|
+
"Tracking flow through decorators...",
|
|
88361
|
+
"Analyzing generator and async flows...",
|
|
88362
|
+
"Computing inter-module data dependencies...",
|
|
88363
|
+
"Evaluating reachability..."
|
|
88364
|
+
]),
|
|
88365
|
+
go: createHeartbeat("Go Reachability Analyzer", [
|
|
88366
|
+
"Analyzing Go packages...",
|
|
88367
|
+
"Building call graph...",
|
|
88368
|
+
"Tracing function calls...",
|
|
88369
|
+
"Checking reachability...",
|
|
88370
|
+
"Propagating data flow through channels...",
|
|
88371
|
+
"Resolving interface method calls...",
|
|
88372
|
+
"Tracking goroutine data flow...",
|
|
88373
|
+
"Analyzing pointer receivers...",
|
|
88374
|
+
"Computing inter-package dependencies...",
|
|
88375
|
+
"Tracing data through struct fields...",
|
|
88376
|
+
"Evaluating reachability..."
|
|
88377
|
+
]),
|
|
88378
|
+
ruby: createHeartbeat("Ruby Reachability Analyzer", [
|
|
88379
|
+
"Analyzing Ruby gems...",
|
|
88380
|
+
"Tracing method calls...",
|
|
88381
|
+
"Building dependency graph...",
|
|
88382
|
+
"Checking reachability...",
|
|
88383
|
+
"Propagating data through blocks...",
|
|
88384
|
+
"Resolving dynamic method invocations...",
|
|
88385
|
+
"Tracking flow through mixins...",
|
|
88386
|
+
"Analyzing metaprogramming patterns...",
|
|
88387
|
+
"Computing inter-gem data flow...",
|
|
88388
|
+
"Tracing data through instance variables...",
|
|
88389
|
+
"Evaluating reachability..."
|
|
88390
|
+
]),
|
|
88391
|
+
// Class/type-based analyzers
|
|
88392
|
+
java: createHeartbeat("Java Reachability Analyzer", [
|
|
88393
|
+
"Analyzing Java bytecode...",
|
|
88394
|
+
"Building class graph...",
|
|
88395
|
+
"Checking reachability...",
|
|
88396
|
+
"Resolving class hierarchy...",
|
|
88397
|
+
"Analyzing interface implementations...",
|
|
88398
|
+
"Computing virtual method dispatch...",
|
|
88399
|
+
"Tracing inheritance chains...",
|
|
88400
|
+
"Resolving generic type parameters...",
|
|
88401
|
+
"Analyzing annotation processors...",
|
|
88402
|
+
"Mapping overridden methods..."
|
|
88403
|
+
]),
|
|
88404
|
+
dotnet: createHeartbeat(".NET Reachability Analyzer", [
|
|
88405
|
+
"Analyzing .NET assemblies...",
|
|
88406
|
+
"Building type graph...",
|
|
88407
|
+
"Checking reachability...",
|
|
88408
|
+
"Resolving type hierarchy...",
|
|
88409
|
+
"Analyzing interface implementations...",
|
|
88410
|
+
"Tracing inheritance chains...",
|
|
88411
|
+
"Resolving generic type arguments...",
|
|
88412
|
+
"Analyzing extension methods...",
|
|
88413
|
+
"Mapping overridden members..."
|
|
88414
|
+
]),
|
|
88415
|
+
rust: createHeartbeat("Rust Reachability Analyzer", [
|
|
88416
|
+
"Analyzing Rust crates...",
|
|
88417
|
+
"Building call graph...",
|
|
88418
|
+
"Tracing function calls...",
|
|
88419
|
+
"Checking reachability...",
|
|
88420
|
+
"Resolving trait implementations...",
|
|
88421
|
+
"Analyzing generic type bounds...",
|
|
88422
|
+
"Computing trait object dispatch...",
|
|
88423
|
+
"Tracing impl blocks...",
|
|
88424
|
+
"Resolving associated types...",
|
|
88425
|
+
"Analyzing derive macros..."
|
|
88426
|
+
])
|
|
88427
|
+
};
|
|
88428
|
+
|
|
88295
88429
|
// dist/tool-path-resolver.js
|
|
88296
88430
|
import { resolve as resolve6 } from "path";
|
|
88297
88431
|
var ToolPathResolver = class {
|
|
@@ -95903,7 +96037,7 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
95903
96037
|
const outputFile = resolve9(tmpDir, "output.json");
|
|
95904
96038
|
await writeFile4(inputFile, JSON.stringify(options));
|
|
95905
96039
|
const timeoutMs = Math.max(timeoutInSeconds * 1.5, timeoutInSeconds + 30) * 1e3;
|
|
95906
|
-
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL" });
|
|
96040
|
+
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.dotnet });
|
|
95907
96041
|
if (result.error)
|
|
95908
96042
|
return void 0;
|
|
95909
96043
|
const packageIds = JSON.parse(await readFile6(outputFile, "utf-8")).result;
|
|
@@ -95942,7 +96076,7 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
95942
96076
|
const outputFile = resolve9(tmpDir, "output.json");
|
|
95943
96077
|
await writeFile4(inputFile, JSON.stringify(options));
|
|
95944
96078
|
const timeoutMs = Math.max(timeoutInSeconds * 1.5, timeoutInSeconds + 30) * 1e3;
|
|
95945
|
-
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetReachabilityAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL" });
|
|
96079
|
+
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetReachabilityAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.dotnet });
|
|
95946
96080
|
if (result.error)
|
|
95947
96081
|
return { type: "error", message: result.error.message ?? "unknown error" };
|
|
95948
96082
|
const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile6(outputFile, "utf-8")).result;
|
|
@@ -109879,7 +110013,7 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
109879
110013
|
const outputFile = resolve10(tmpDir, "output.json");
|
|
109880
110014
|
await writeFile5(inputFile, JSON.stringify(options));
|
|
109881
110015
|
const timeoutMs = Math.max(timeoutInSeconds * 1.5, timeoutInSeconds + 30) * 1e3;
|
|
109882
|
-
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runJvmDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${getJavapServicePath()} --tree-sitter-java ${getTreeSitterJavaPath()} --tree-sitter-kotlin ${getTreeSitterKotlinPath()} --tree-sitter-scala ${getTreeSitterScalaPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL" });
|
|
110016
|
+
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runJvmDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${getJavapServicePath()} --tree-sitter-java ${getTreeSitterJavaPath()} --tree-sitter-kotlin ${getTreeSitterKotlinPath()} --tree-sitter-scala ${getTreeSitterScalaPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.java });
|
|
109883
110017
|
if (result.error)
|
|
109884
110018
|
return void 0;
|
|
109885
110019
|
const packageIds = JSON.parse(await readFile7(outputFile, "utf-8")).result;
|
|
@@ -109918,7 +110052,7 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
109918
110052
|
const outputFile = resolve10(tmpDir, "output.json");
|
|
109919
110053
|
await writeFile5(inputFile, JSON.stringify(options));
|
|
109920
110054
|
const timeoutMs = Math.max(timeoutInSeconds * 1.5, timeoutInSeconds + 30) * 1e3;
|
|
109921
|
-
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runJvmReachabilityAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${getJavapServicePath()} --tree-sitter-java ${getTreeSitterJavaPath()} --tree-sitter-kotlin ${getTreeSitterKotlinPath()} --tree-sitter-scala ${getTreeSitterScalaPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL" });
|
|
110055
|
+
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runJvmReachabilityAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${getJavapServicePath()} --tree-sitter-java ${getTreeSitterJavaPath()} --tree-sitter-kotlin ${getTreeSitterKotlinPath()} --tree-sitter-scala ${getTreeSitterScalaPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.java });
|
|
109922
110056
|
if (result.error)
|
|
109923
110057
|
return { type: "error", message: result.error.message ?? "unknown error" };
|
|
109924
110058
|
const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile7(outputFile, "utf-8")).result;
|
|
@@ -110550,7 +110684,7 @@ async function runJellyAnalysis(mainProjectRoot, projectRoot, jellyOptions, reac
|
|
|
110550
110684
|
jellyCmd,
|
|
110551
110685
|
void 0,
|
|
110552
110686
|
// Use SIGKILL to ensure termination even if the process is unresponsive 50% above the timeout (e.g., due to GC pressure).
|
|
110553
|
-
{ timeout: timeoutInSeconds * 1e3 * 1.5, killSignal: "SIGKILL" }
|
|
110687
|
+
{ timeout: timeoutInSeconds * 1e3 * 1.5, killSignal: "SIGKILL", heartbeat: HEARTBEATS.js }
|
|
110554
110688
|
);
|
|
110555
110689
|
if (reachabilityAnalysisOptions.printLogFile)
|
|
110556
110690
|
logger.info("JS analysis log file:", await readFile8(logFile, "utf-8"));
|
|
@@ -110593,7 +110727,8 @@ async function runJellyPhantomDependencyAnalysis(projectRoot, options) {
|
|
|
110593
110727
|
--reachable-json ${reachablePackagesFile} ${projectRoot}`;
|
|
110594
110728
|
await runCommandResolveStdOut2(jellyCmd, void 0, {
|
|
110595
110729
|
timeout: options.timeoutSeconds.allVulnRuns * 1e3,
|
|
110596
|
-
killSignal: "SIGKILL"
|
|
110730
|
+
killSignal: "SIGKILL",
|
|
110731
|
+
heartbeat: HEARTBEATS.js
|
|
110597
110732
|
});
|
|
110598
110733
|
return JSON.parse(await readFile8(reachablePackagesFile, "utf-8")).packages;
|
|
110599
110734
|
} finally {
|
|
@@ -110613,7 +110748,8 @@ async function runJellyImportReachabilityAnalysis(mainProjectRoot, projectRoot,
|
|
|
110613
110748
|
${options.entryPoints ?? projectRoot}`;
|
|
110614
110749
|
await runCommandResolveStdOut2(jellyCmd, void 0, {
|
|
110615
110750
|
timeout: options.timeoutSeconds.allVulnRuns * 1e3,
|
|
110616
|
-
killSignal: "SIGKILL"
|
|
110751
|
+
killSignal: "SIGKILL",
|
|
110752
|
+
heartbeat: HEARTBEATS.js
|
|
110617
110753
|
});
|
|
110618
110754
|
return JSON.parse(await readFile8(reachableModulesFile, "utf-8"));
|
|
110619
110755
|
} finally {
|
|
@@ -110874,7 +111010,8 @@ var GoCodeAwareVulnerabilityScanner = class {
|
|
|
110874
111010
|
${this.projectDir} ${vulnAccPaths}`, void 0, {
|
|
110875
111011
|
timeout: timeoutInSeconds * 1e3,
|
|
110876
111012
|
killSignal: "SIGKILL",
|
|
110877
|
-
env: memoryLimitInMB ? { ...process.env, GOMEMLIMIT: `${memoryLimitInMB}MiB` } : void 0
|
|
111013
|
+
env: memoryLimitInMB ? { ...process.env, GOMEMLIMIT: `${memoryLimitInMB}MiB` } : void 0,
|
|
111014
|
+
heartbeat: HEARTBEATS.go
|
|
110878
111015
|
});
|
|
110879
111016
|
if (error) {
|
|
110880
111017
|
logger.error("Error running Go code-aware analysis", error);
|
|
@@ -111273,7 +111410,7 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
111273
111410
|
const outputFile = resolve15(tmpDir, "output.json");
|
|
111274
111411
|
await writeFile8(inputFile, JSON.stringify(options));
|
|
111275
111412
|
const timeoutMs = Math.max(timeoutInSeconds * 1.5, timeoutInSeconds + 30) * 1e3;
|
|
111276
|
-
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runRustDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --tree-sitter-rust ${getTreeSitterRustPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL" });
|
|
111413
|
+
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runRustDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --tree-sitter-rust ${getTreeSitterRustPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.rust });
|
|
111277
111414
|
if (result.error)
|
|
111278
111415
|
return void 0;
|
|
111279
111416
|
const packageIds = JSON.parse(await readFile10(outputFile, "utf-8")).result;
|
|
@@ -111309,7 +111446,7 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
111309
111446
|
const outputFile = resolve15(tmpDir, "output.json");
|
|
111310
111447
|
await writeFile8(inputFile, JSON.stringify(options));
|
|
111311
111448
|
const timeoutMs = Math.max(effectiveTimeout * 1.5, effectiveTimeout + 30) * 1e3;
|
|
111312
|
-
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runRustReachabilityAnalysis -i ${inputFile} -o ${outputFile} --tree-sitter-rust ${getTreeSitterRustPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL" });
|
|
111449
|
+
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runRustReachabilityAnalysis -i ${inputFile} -o ${outputFile} --tree-sitter-rust ${getTreeSitterRustPath()}`, void 0, { timeout: timeoutMs, killSignal: "SIGKILL", heartbeat: HEARTBEATS.rust });
|
|
111313
111450
|
if (result.error)
|
|
111314
111451
|
return { type: "error", message: result.error.message ?? "unknown error" };
|
|
111315
111452
|
const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile10(outputFile, "utf-8")).result;
|
|
@@ -111833,7 +111970,8 @@ var PythonCodeAwareVulnerabilityScanner = class {
|
|
|
111833
111970
|
// Forcefully kill the process if the internal timeout mechanism fails.
|
|
111834
111971
|
// Use SIGKILL to ensure termination even if the process is unresponsive.
|
|
111835
111972
|
timeout: (timeoutInSeconds * 1.5 + 15) * 1e3,
|
|
111836
|
-
killSignal: "SIGKILL"
|
|
111973
|
+
killSignal: "SIGKILL",
|
|
111974
|
+
heartbeat: HEARTBEATS.python
|
|
111837
111975
|
});
|
|
111838
111976
|
logger.debug("Done running mambalade");
|
|
111839
111977
|
const errors = stderr.split("\n").filter((line) => line.startsWith("ERROR:") && !/^ERROR: Excluded distribution/.test(line));
|
|
@@ -116579,7 +116717,8 @@ var RubyCodeAwareVulnerabilityScanner = class {
|
|
|
116579
116717
|
this.numberAnalysesRun++;
|
|
116580
116718
|
await exec2(cmd, this.projectDir, {
|
|
116581
116719
|
timeout: (timeoutInSeconds * 1.5 + 10) * 1e3,
|
|
116582
|
-
killSignal: "SIGKILL"
|
|
116720
|
+
killSignal: "SIGKILL",
|
|
116721
|
+
heartbeat: HEARTBEATS.ruby
|
|
116583
116722
|
});
|
|
116584
116723
|
const result = JSON.parse(await readFile12(vulnsOutputFile, "utf-8"));
|
|
116585
116724
|
const relativeLoadPathsToPackageNames = new Map([...loadPathsToPackageNames.entries()].map(([k, v]) => [join17("vendor", relative8(this.vendorDir, k)), v]));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|