@coana-tech/cli 14.12.200 → 14.12.201
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 +1 -1
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +123 -20
- 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
|
@@ -251677,7 +251677,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
251677
251677
|
}
|
|
251678
251678
|
|
|
251679
251679
|
// dist/version.js
|
|
251680
|
-
var version3 = "14.12.
|
|
251680
|
+
var version3 = "14.12.201";
|
|
251681
251681
|
|
|
251682
251682
|
// dist/cli-core.js
|
|
251683
251683
|
var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
|
package/package.json
CHANGED
|
@@ -88572,7 +88572,7 @@ function addPathToTrie(root3, vulnPath) {
|
|
|
88572
88572
|
var import_lodash14 = __toESM(require_lodash(), 1);
|
|
88573
88573
|
import assert6 from "assert";
|
|
88574
88574
|
import { existsSync as existsSync13 } from "fs";
|
|
88575
|
-
import { cp as cp7, readdir as
|
|
88575
|
+
import { cp as cp7, readdir as readdir5, readFile as readFile12, rm as rm5 } from "fs/promises";
|
|
88576
88576
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
88577
88577
|
import { basename as basename11, dirname as dirname15, join as join17, resolve as resolve17, sep as sep5 } from "path";
|
|
88578
88578
|
import util5 from "util";
|
|
@@ -94244,7 +94244,7 @@ var CocoaHeuristics = {
|
|
|
94244
94244
|
|
|
94245
94245
|
// dist/whole-program-code-aware-vulnerability-scanner/dotnet/dotnet-code-aware-vulnerability-scanner.js
|
|
94246
94246
|
var import_adm_zip = __toESM(require_adm_zip(), 1);
|
|
94247
|
-
import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile5 } from "fs/promises";
|
|
94247
|
+
import { mkdir as mkdir5, readdir as readdir4, readFile as readFile7, writeFile as writeFile5 } from "fs/promises";
|
|
94248
94248
|
import { randomUUID } from "node:crypto";
|
|
94249
94249
|
|
|
94250
94250
|
// dist/whole-program-code-aware-vulnerability-scanner/dotnet/constants.js
|
|
@@ -96464,7 +96464,13 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
96464
96464
|
const outputFile = resolve9(tmpDir, "output.json");
|
|
96465
96465
|
await writeFile5(inputFile, JSON.stringify(options));
|
|
96466
96466
|
const timeoutMs = Math.max(timeoutInSeconds * 1.5, timeoutInSeconds + 30) * 1e3;
|
|
96467
|
-
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetReachabilityAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, {
|
|
96467
|
+
const result = await execNeverFail2(cmdt`${await getNodeExecutable(ToolPathResolver.nodeExecutablePath)} ${getClassGraphAnalysisCliPath()} runDotnetReachabilityAnalysis -i ${inputFile} -o ${outputFile} --cocoa ${getCocoaPath()} --tree-sitter-c-sharp ${getTreeSitterCSharpPath()}`, void 0, {
|
|
96468
|
+
timeout: timeoutMs,
|
|
96469
|
+
killSignal: "SIGKILL",
|
|
96470
|
+
heartbeat: HEARTBEATS.dotnet,
|
|
96471
|
+
telemetryHandler,
|
|
96472
|
+
analyzerTelemetryHandler
|
|
96473
|
+
});
|
|
96468
96474
|
if (result.error)
|
|
96469
96475
|
return { type: "error", message: result.error.message ?? "unknown error" };
|
|
96470
96476
|
const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile7(outputFile, "utf-8")).result;
|
|
@@ -96555,18 +96561,29 @@ async function downloadAndExtractNugetPackage(packageName, version3, tmpDir) {
|
|
|
96555
96561
|
const packageUrl = getUrlForPackage(packageName, version3);
|
|
96556
96562
|
const success = await downloadFile(packageUrl, packageFile);
|
|
96557
96563
|
if (!success) {
|
|
96558
|
-
|
|
96559
|
-
return void 0;
|
|
96564
|
+
throw new Error(`Failed to download nuget package ${packageName}/${version3}`);
|
|
96560
96565
|
}
|
|
96561
96566
|
}
|
|
96562
96567
|
return extractNugetPackage(packageFile, packageName, version3, tmpDir);
|
|
96563
96568
|
}
|
|
96564
96569
|
async function convertDependencyChain(dependencyChain, tmpDir) {
|
|
96570
|
+
const runtimePaths = await getDotnetRuntimeSharedPaths();
|
|
96571
|
+
const runtimeFileIndex = await buildRuntimeFileIndex(runtimePaths);
|
|
96565
96572
|
const nugetDependencyChain = await asyncMap(dependencyChain, async (dep) => {
|
|
96566
|
-
|
|
96567
|
-
|
|
96568
|
-
|
|
96569
|
-
|
|
96573
|
+
const binFiles = [];
|
|
96574
|
+
if (dep.version) {
|
|
96575
|
+
try {
|
|
96576
|
+
const extracted = await downloadAndExtractNugetPackage(dep.packageName, dep.version, tmpDir);
|
|
96577
|
+
if (extracted)
|
|
96578
|
+
binFiles.push(...extracted);
|
|
96579
|
+
} catch (e) {
|
|
96580
|
+
logger.warn(`${e.message}`);
|
|
96581
|
+
}
|
|
96582
|
+
const runtimeFiles = findStdlibRuntimeFiles(dep.packageName, runtimeFileIndex);
|
|
96583
|
+
if (runtimeFiles)
|
|
96584
|
+
binFiles.push(...runtimeFiles);
|
|
96585
|
+
}
|
|
96586
|
+
return { ...dep, bin: binFiles.length > 0 ? binFiles : void 0 };
|
|
96570
96587
|
}, 4);
|
|
96571
96588
|
return nugetDependencyChain;
|
|
96572
96589
|
}
|
|
@@ -96592,23 +96609,109 @@ async function findNuGetPackageInLocalRepo(repo, packageName, version3, tmpDir)
|
|
|
96592
96609
|
const nupkgFile = allFiles.find((file) => basename7(file).toLowerCase() === targetNupkg);
|
|
96593
96610
|
return nupkgFile ? extractNugetPackage(nupkgFile, packageName, version3, tmpDir) : void 0;
|
|
96594
96611
|
}
|
|
96612
|
+
async function getDotnetRuntimeSharedPaths() {
|
|
96613
|
+
const result = await execNeverFail2(cmdt`dotnet --list-runtimes`);
|
|
96614
|
+
if (result.error ?? !result.stdout)
|
|
96615
|
+
return [];
|
|
96616
|
+
const paths = [];
|
|
96617
|
+
for (const line of result.stdout.split("\n")) {
|
|
96618
|
+
const match2 = line.trim().match(/^(\S+)\s+(\S+)\s+\[(.+)\]$/);
|
|
96619
|
+
if (match2) {
|
|
96620
|
+
const runtimeDir = resolve9(match2[3], match2[2]);
|
|
96621
|
+
if (existsSync7(runtimeDir)) {
|
|
96622
|
+
paths.push(runtimeDir);
|
|
96623
|
+
}
|
|
96624
|
+
}
|
|
96625
|
+
}
|
|
96626
|
+
return paths;
|
|
96627
|
+
}
|
|
96628
|
+
async function buildRuntimeFileIndex(runtimePaths) {
|
|
96629
|
+
const index2 = /* @__PURE__ */ new Map();
|
|
96630
|
+
for (const runtimePath of runtimePaths) {
|
|
96631
|
+
try {
|
|
96632
|
+
const entries = await readdir4(runtimePath, { withFileTypes: true });
|
|
96633
|
+
for (const entry of entries) {
|
|
96634
|
+
if (!entry.isFile())
|
|
96635
|
+
continue;
|
|
96636
|
+
const name2 = entry.name.toLowerCase();
|
|
96637
|
+
const fullPath = resolve9(runtimePath, entry.name);
|
|
96638
|
+
const existing = index2.get(name2);
|
|
96639
|
+
if (existing) {
|
|
96640
|
+
existing.push(fullPath);
|
|
96641
|
+
} else {
|
|
96642
|
+
index2.set(name2, [fullPath]);
|
|
96643
|
+
}
|
|
96644
|
+
}
|
|
96645
|
+
} catch (e) {
|
|
96646
|
+
logger.debug(`Failed to read runtime path ${runtimePath}: ${e.message}`);
|
|
96647
|
+
}
|
|
96648
|
+
}
|
|
96649
|
+
return index2;
|
|
96650
|
+
}
|
|
96651
|
+
function findStdlibRuntimeFiles(packageName, runtimeFileIndex) {
|
|
96652
|
+
if (runtimeFileIndex.size === 0)
|
|
96653
|
+
return void 0;
|
|
96654
|
+
const possibleFileNames = /* @__PURE__ */ new Set();
|
|
96655
|
+
if (packageName.toLowerCase() === "netstandard.library") {
|
|
96656
|
+
possibleFileNames.add("netstandard.dll");
|
|
96657
|
+
} else {
|
|
96658
|
+
const lowerName = packageName.toLowerCase();
|
|
96659
|
+
const componentName = lowerName.startsWith("runtime.native.") ? lowerName.slice("runtime.native.".length) : lowerName;
|
|
96660
|
+
const nameVariants = [componentName, `${componentName}.Native`];
|
|
96661
|
+
const lastDotIndex = componentName.lastIndexOf(".");
|
|
96662
|
+
if (lastDotIndex !== -1) {
|
|
96663
|
+
nameVariants.push(componentName.slice(0, lastDotIndex) + ".Native" + componentName.slice(lastDotIndex));
|
|
96664
|
+
}
|
|
96665
|
+
for (const name2 of nameVariants) {
|
|
96666
|
+
possibleFileNames.add(`${name2}.dll`.toLowerCase());
|
|
96667
|
+
possibleFileNames.add(`lib${name2}.dylib`.toLowerCase());
|
|
96668
|
+
possibleFileNames.add(`lib${name2}.so`.toLowerCase());
|
|
96669
|
+
}
|
|
96670
|
+
}
|
|
96671
|
+
const matchedFiles = [];
|
|
96672
|
+
for (const fileName2 of possibleFileNames) {
|
|
96673
|
+
const files = runtimeFileIndex.get(fileName2);
|
|
96674
|
+
if (files)
|
|
96675
|
+
matchedFiles.push(...files);
|
|
96676
|
+
}
|
|
96677
|
+
return matchedFiles.length > 0 ? matchedFiles : void 0;
|
|
96678
|
+
}
|
|
96595
96679
|
async function convertSocketArtifacts(artifacts, tmpDir) {
|
|
96596
96680
|
const localRepositories = getNuGetLocalRepositoryPaths();
|
|
96681
|
+
const runtimePaths = await getDotnetRuntimeSharedPaths();
|
|
96682
|
+
const runtimeFileIndex = await buildRuntimeFileIndex(runtimePaths);
|
|
96597
96683
|
async function resolveNuGetPackage(packageName, version3) {
|
|
96684
|
+
const binFiles = [];
|
|
96598
96685
|
for (const repo of localRepositories) {
|
|
96599
96686
|
const localPackage = await findNuGetPackageInLocalRepo(repo, packageName, version3, tmpDir);
|
|
96600
|
-
if (localPackage)
|
|
96601
|
-
|
|
96687
|
+
if (localPackage) {
|
|
96688
|
+
binFiles.push(...localPackage);
|
|
96689
|
+
break;
|
|
96690
|
+
}
|
|
96691
|
+
}
|
|
96692
|
+
if (binFiles.length === 0) {
|
|
96693
|
+
const downloaded = await downloadAndExtractNugetPackage(packageName, version3, tmpDir);
|
|
96694
|
+
if (downloaded)
|
|
96695
|
+
binFiles.push(...downloaded);
|
|
96602
96696
|
}
|
|
96603
|
-
|
|
96697
|
+
const runtimeFiles = findStdlibRuntimeFiles(packageName, runtimeFileIndex);
|
|
96698
|
+
if (runtimeFiles)
|
|
96699
|
+
binFiles.push(...runtimeFiles);
|
|
96700
|
+
return binFiles.length > 0 ? binFiles : void 0;
|
|
96604
96701
|
}
|
|
96605
96702
|
const deps = {};
|
|
96606
96703
|
const depIdToPurl = /* @__PURE__ */ new Map();
|
|
96607
96704
|
await asyncForEach(artifacts, async (artifact) => {
|
|
96608
96705
|
depIdToPurl.set(artifact.id, getPurlFromSocketFactArtifact(artifact));
|
|
96609
|
-
|
|
96610
|
-
|
|
96611
|
-
|
|
96706
|
+
let bin;
|
|
96707
|
+
if (artifact.name && artifact.version) {
|
|
96708
|
+
try {
|
|
96709
|
+
bin = await resolveNuGetPackage(artifact.name, artifact.version);
|
|
96710
|
+
} catch (e) {
|
|
96711
|
+
logger.warn(`${e.message}`);
|
|
96712
|
+
}
|
|
96713
|
+
}
|
|
96714
|
+
deps[artifact.id] = { bin };
|
|
96612
96715
|
}, 4);
|
|
96613
96716
|
return { deps, depIdToPurl };
|
|
96614
96717
|
}
|
|
@@ -112659,7 +112762,7 @@ ${msg}`;
|
|
|
112659
112762
|
await this.updateVirtualEnvInfo(tmpDir, installStats);
|
|
112660
112763
|
}
|
|
112661
112764
|
async updateVirtualEnvInfo(virtualEnvFolder, packageInstallationStats) {
|
|
112662
|
-
const entries = await
|
|
112765
|
+
const entries = await readdir5(join17(virtualEnvFolder, ".venv", "lib"));
|
|
112663
112766
|
const pydir = entries.find((entry) => entry.startsWith("python"));
|
|
112664
112767
|
assert6(pydir, `No python* directory found in virtual environment: ${util5.inspect(entries)}`);
|
|
112665
112768
|
this.virtualEnvInfo = {
|
|
@@ -112756,7 +112859,7 @@ async function setupMambalade() {
|
|
|
112756
112859
|
logger.debug(`Using Python interpreter: ${python}`);
|
|
112757
112860
|
await exec2(cmdt`${uvCommand} venv --no-project --no-config --python=${python} .`, venvDir);
|
|
112758
112861
|
const mambaladeWheelsPath = ToolPathResolver.mambaladeDistPath;
|
|
112759
|
-
const mambaladeWheels = (await
|
|
112862
|
+
const mambaladeWheels = (await readdir5(mambaladeWheelsPath)).filter((f2) => f2.endsWith(".whl")).map((f2) => join17(mambaladeWheelsPath, f2));
|
|
112760
112863
|
if (!mambaladeWheels.length)
|
|
112761
112864
|
throw new Error(`No mambalade wheel files found in ${mambaladeWheelsPath}`);
|
|
112762
112865
|
logger.debug(`Installing mambalade wheels: ${mambaladeWheels.join(", ")}`);
|
|
@@ -113801,7 +113904,7 @@ import { resolve as resolve21 } from "path";
|
|
|
113801
113904
|
// dist/whole-program-code-aware-vulnerability-scanner/ruby/ruby-code-aware-vulnerability-scanner.js
|
|
113802
113905
|
var import_lodash20 = __toESM(require_lodash(), 1);
|
|
113803
113906
|
import { createWriteStream as createWriteStream5, existsSync as existsSync15 } from "fs";
|
|
113804
|
-
import { mkdir as mkdir9, readdir as
|
|
113907
|
+
import { mkdir as mkdir9, readdir as readdir6, readFile as readFile13, rm as rm7 } from "fs/promises";
|
|
113805
113908
|
import { join as join18, relative as relative9 } from "path";
|
|
113806
113909
|
import { pipeline as pipeline3 } from "stream/promises";
|
|
113807
113910
|
var PRINT_ANALYSIS_COMMAND = false;
|
|
@@ -113954,12 +114057,12 @@ var RubyCodeAwareVulnerabilityScanner = class {
|
|
|
113954
114057
|
}
|
|
113955
114058
|
const bundlerGemsDir = join18(this.vendorDir, "bundle", "ruby");
|
|
113956
114059
|
if (existsSync15(bundlerGemsDir)) {
|
|
113957
|
-
const rubyVersions = await
|
|
114060
|
+
const rubyVersions = await readdir6(bundlerGemsDir);
|
|
113958
114061
|
for (const rubyVersion of rubyVersions) {
|
|
113959
114062
|
const gemsDir = join18(bundlerGemsDir, rubyVersion, "gems");
|
|
113960
114063
|
if (existsSync15(gemsDir)) {
|
|
113961
114064
|
const nameToEntry = /* @__PURE__ */ new Map();
|
|
113962
|
-
for (const entry of await
|
|
114065
|
+
for (const entry of await readdir6(gemsDir, { withFileTypes: true }))
|
|
113963
114066
|
if (entry.isDirectory()) {
|
|
113964
114067
|
const match2 = entry.name.match(/^([\w-_]+)-(\d+\.\d+\.\d+)/);
|
|
113965
114068
|
if (match2)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|