@coana-tech/cli 14.12.87 → 14.12.89
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 +3 -2
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +118 -160
- package/repos/coana-tech/class-graph-analysis/dist/bundle/class-graph-analysis-cli.mjs +8062 -3647
- package/repos/coana-tech/cocoa/release/Coana.Cocoa.dll +0 -0
- 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/alucard/alucard.jar +0 -0
package/cli.mjs
CHANGED
|
@@ -221274,7 +221274,8 @@ var NpmSocketUpgradeManager = class {
|
|
|
221274
221274
|
const oldFileContent = await readFile16(resolve19(this.rootDir, lockfile2), "utf-8");
|
|
221275
221275
|
let result;
|
|
221276
221276
|
if (this.packageLockMatcher(lockfile2)) {
|
|
221277
|
-
const
|
|
221277
|
+
const npmBin = await getNpmBin();
|
|
221278
|
+
const command = mode === "LOCKFILE_ONLY" ? cmdt`${npmBin} install --package-lock-only --loglevel=verbose` : cmdt`${npmBin} install -f --ignore-scripts --no-fund --no-audit --no-progress --loglevel=verbose`;
|
|
221278
221279
|
result = await execNeverFail(command, lockfileDir);
|
|
221279
221280
|
} else if (this.pnpmLockMatcher(lockfile2)) {
|
|
221280
221281
|
const command = mode === "LOCKFILE_ONLY" ? cmdt`pnpm install --lockfile-only` : cmdt`pnpm install --ignore-scripts --fix-lockfile --config.confirmModulesPurge=false`;
|
|
@@ -245916,7 +245917,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
245916
245917
|
}
|
|
245917
245918
|
|
|
245918
245919
|
// dist/version.js
|
|
245919
|
-
var version2 = "14.12.
|
|
245920
|
+
var version2 = "14.12.89";
|
|
245920
245921
|
|
|
245921
245922
|
// dist/cli-core.js
|
|
245922
245923
|
var { mapValues, omit, partition, pick } = import_lodash15.default;
|
package/package.json
CHANGED
|
@@ -89812,27 +89812,20 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
89812
89812
|
}
|
|
89813
89813
|
static initFromDependencyTree(dependencyTree, timeoutInSeconds, statusUpdater) {
|
|
89814
89814
|
const apps = {
|
|
89815
|
-
|
|
89815
|
+
"<app>": {
|
|
89816
89816
|
src: dependencyTree.src,
|
|
89817
|
-
bin: dependencyTree.bin
|
|
89818
|
-
ecosystemSpecificPackageInfo: {
|
|
89819
|
-
type: "DOTNET"
|
|
89820
|
-
}
|
|
89817
|
+
bin: dependencyTree.bin
|
|
89821
89818
|
}
|
|
89822
89819
|
};
|
|
89823
89820
|
const deps = {};
|
|
89824
89821
|
const depIdToPurl = /* @__PURE__ */ new Map();
|
|
89825
|
-
Object.
|
|
89826
|
-
|
|
89827
|
-
|
|
89828
|
-
deps[uuid] = {
|
|
89822
|
+
for (const [depId, dep] of Object.entries(dependencyTree.transitiveDependencies)) {
|
|
89823
|
+
depIdToPurl.set(depId, getNugetPurl(dep.packageName, dep.version ?? void 0));
|
|
89824
|
+
deps[depId] = {
|
|
89829
89825
|
src: dep.src,
|
|
89830
|
-
bin: dep.bin
|
|
89831
|
-
ecosystemSpecificPackageInfo: {
|
|
89832
|
-
type: "DOTNET"
|
|
89833
|
-
}
|
|
89826
|
+
bin: dep.bin
|
|
89834
89827
|
};
|
|
89835
|
-
}
|
|
89828
|
+
}
|
|
89836
89829
|
return new _DotnetCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, timeoutInSeconds, statusUpdater);
|
|
89837
89830
|
}
|
|
89838
89831
|
static async initFromSocketArtifacts(subprojectDir, manifestFiles, artifacts, tmpDir, timeoutInSeconds, statusUpdater) {
|
|
@@ -89842,13 +89835,8 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
89842
89835
|
return project?.sourceFiles ?? [];
|
|
89843
89836
|
});
|
|
89844
89837
|
const apps = {
|
|
89845
|
-
|
|
89846
|
-
src: i(src)
|
|
89847
|
-
bin: void 0,
|
|
89848
|
-
// TODO: Extract from manifest file!
|
|
89849
|
-
ecosystemSpecificPackageInfo: {
|
|
89850
|
-
type: "DOTNET"
|
|
89851
|
-
}
|
|
89838
|
+
"<app>": {
|
|
89839
|
+
src: i(src)
|
|
89852
89840
|
}
|
|
89853
89841
|
};
|
|
89854
89842
|
const { deps, depIdToPurl } = await convertSocketArtifacts(artifacts, tmpDir);
|
|
@@ -89856,11 +89844,8 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
89856
89844
|
}
|
|
89857
89845
|
static async runOnAlreadyDownloadedPackages([appPath, ...depPaths], vulnerability, options) {
|
|
89858
89846
|
const apps = {
|
|
89859
|
-
|
|
89860
|
-
bin: await isDirectory(appPath) ? await getFiles(appPath) : [appPath]
|
|
89861
|
-
ecosystemSpecificPackageInfo: {
|
|
89862
|
-
type: "DOTNET"
|
|
89863
|
-
}
|
|
89847
|
+
"<app>": {
|
|
89848
|
+
bin: await isDirectory(appPath) ? await getFiles(appPath) : [appPath]
|
|
89864
89849
|
}
|
|
89865
89850
|
};
|
|
89866
89851
|
const deps = {};
|
|
@@ -89869,10 +89854,7 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
89869
89854
|
const uuid = randomUUID();
|
|
89870
89855
|
depIdToPurl.set(uuid, getNugetPurl("", void 0));
|
|
89871
89856
|
deps[uuid] = {
|
|
89872
|
-
bin: await isDirectory(depPath) ? await getFiles(depPath) : [depPath]
|
|
89873
|
-
ecosystemSpecificPackageInfo: {
|
|
89874
|
-
type: "DOTNET"
|
|
89875
|
-
}
|
|
89857
|
+
bin: await isDirectory(depPath) ? await getFiles(depPath) : [depPath]
|
|
89876
89858
|
};
|
|
89877
89859
|
}
|
|
89878
89860
|
const scanner = new _DotnetCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, options.timeoutInSeconds);
|
|
@@ -89889,12 +89871,9 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
89889
89871
|
try {
|
|
89890
89872
|
const nugetDependencyChain = await convertDependencyChain(dependencyChain, tmpDir);
|
|
89891
89873
|
const apps = {
|
|
89892
|
-
|
|
89874
|
+
"<app>": {
|
|
89893
89875
|
src: nugetDependencyChain[0].src,
|
|
89894
|
-
bin: nugetDependencyChain[0].bin
|
|
89895
|
-
ecosystemSpecificPackageInfo: {
|
|
89896
|
-
type: "DOTNET"
|
|
89897
|
-
}
|
|
89876
|
+
bin: nugetDependencyChain[0].bin
|
|
89898
89877
|
}
|
|
89899
89878
|
};
|
|
89900
89879
|
const deps = {};
|
|
@@ -89904,10 +89883,7 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
89904
89883
|
depIdToPurl.set(uuid, getNugetPurl(dep.packageName, dep.version ?? void 0));
|
|
89905
89884
|
deps[uuid] = {
|
|
89906
89885
|
src: dep.src,
|
|
89907
|
-
bin: dep.bin
|
|
89908
|
-
ecosystemSpecificPackageInfo: {
|
|
89909
|
-
type: "DOTNET"
|
|
89910
|
-
}
|
|
89886
|
+
bin: dep.bin
|
|
89911
89887
|
};
|
|
89912
89888
|
});
|
|
89913
89889
|
const scanner = new _DotnetCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, timeoutInSeconds, statusUpdater);
|
|
@@ -89996,9 +89972,9 @@ var DotnetCodeAwareVulnerabilityScanner = class _DotnetCodeAwareVulnerabilitySca
|
|
|
89996
89972
|
if (!vulnerablePathsForClass)
|
|
89997
89973
|
continue;
|
|
89998
89974
|
classStacks.push(...vulnerablePathsForClass.map((vulnPath) => {
|
|
89999
|
-
return vulnPath.map(({
|
|
89975
|
+
return vulnPath.map(({ displayName, confidence, packageId }) => ({
|
|
90000
89976
|
package: depIdToPurl.has(packageId) ? prettyPrintNugetPurl(depIdToPurl.get(packageId)) : "<app>",
|
|
90001
|
-
class:
|
|
89977
|
+
class: displayName,
|
|
90002
89978
|
confidence
|
|
90003
89979
|
}));
|
|
90004
89980
|
}));
|
|
@@ -90109,12 +90085,8 @@ async function convertSocketArtifacts(artifacts, tmpDir) {
|
|
|
90109
90085
|
const deps = {};
|
|
90110
90086
|
const depIdToPurl = /* @__PURE__ */ new Map();
|
|
90111
90087
|
await asyncForEach(artifacts, async (artifact) => {
|
|
90112
|
-
|
|
90113
|
-
|
|
90114
|
-
deps[uuid] = {
|
|
90115
|
-
ecosystemSpecificPackageInfo: {
|
|
90116
|
-
type: "DOTNET"
|
|
90117
|
-
},
|
|
90088
|
+
depIdToPurl.set(artifact.id, getPurlFromSocketFactArtifact(artifact));
|
|
90089
|
+
deps[artifact.id] = {
|
|
90118
90090
|
bin: artifact.name && artifact.version ? await resolveNuGetPackage(artifact.name, artifact.version) : void 0
|
|
90119
90091
|
};
|
|
90120
90092
|
}, 4);
|
|
@@ -90123,6 +90095,7 @@ async function convertSocketArtifacts(artifacts, tmpDir) {
|
|
|
90123
90095
|
|
|
90124
90096
|
// dist/whole-program-code-aware-vulnerability-scanner/java/java-code-aware-vulnerability-scanner.js
|
|
90125
90097
|
var import_lodash8 = __toESM(require_lodash(), 1);
|
|
90098
|
+
var import_adm_zip2 = __toESM(require_adm_zip(), 1);
|
|
90126
90099
|
import { existsSync as existsSync8 } from "node:fs";
|
|
90127
90100
|
import { mkdir as mkdir2, readFile as readFile7, writeFile as writeFile4 } from "node:fs/promises";
|
|
90128
90101
|
import { basename as basename6, dirname as dirname6, resolve as resolve9 } from "node:path";
|
|
@@ -103760,7 +103733,7 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
103760
103733
|
|
|
103761
103734
|
// dist/whole-program-code-aware-vulnerability-scanner/java/constants.js
|
|
103762
103735
|
import { join as join13 } from "node:path";
|
|
103763
|
-
var
|
|
103736
|
+
var javapServicePath = join13(COANA_REPOS_PATH(), "javap-service", "javap-service.jar");
|
|
103764
103737
|
var treeSitterJavaPath = join13(REPOS_PATH(), "tree-sitter", "tree-sitter-java");
|
|
103765
103738
|
var treeSitterKotlinPath = join13(REPOS_PATH(), "fwcd", "tree-sitter-kotlin");
|
|
103766
103739
|
var treeSitterScalaPath = join13(COANA_REPOS_PATH(), "tree-sitter-scala");
|
|
@@ -103782,30 +103755,23 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
103782
103755
|
this.timeoutInSeconds = timeoutInSeconds;
|
|
103783
103756
|
this.statusUpdater = statusUpdater;
|
|
103784
103757
|
}
|
|
103785
|
-
static initFromDependencyTree(dependencyTree, timeoutInSeconds, statusUpdater) {
|
|
103758
|
+
static async initFromDependencyTree(dependencyTree, tmpDir, timeoutInSeconds, statusUpdater) {
|
|
103786
103759
|
const apps = {
|
|
103787
|
-
|
|
103788
|
-
src: dependencyTree.src
|
|
103789
|
-
bin: dependencyTree.bin,
|
|
103790
|
-
ecosystemSpecificPackageInfo: {
|
|
103791
|
-
type: "JVM"
|
|
103792
|
-
}
|
|
103760
|
+
"<app>": {
|
|
103761
|
+
src: dependencyTree.src
|
|
103793
103762
|
}
|
|
103794
103763
|
};
|
|
103795
103764
|
const deps = {};
|
|
103796
103765
|
const depIdToPurl = /* @__PURE__ */ new Map();
|
|
103797
|
-
Object.
|
|
103798
|
-
const uuid = randomUUID2();
|
|
103766
|
+
for (const [depId, dep] of Object.entries(dependencyTree.transitiveDependencies)) {
|
|
103799
103767
|
const [groupId, artifactId] = dep.packageName.split(":");
|
|
103800
|
-
depIdToPurl.set(
|
|
103801
|
-
deps[
|
|
103768
|
+
depIdToPurl.set(depId, getMavenPurl(groupId, artifactId, dep.type, dep.classifier, dep.version ?? void 0));
|
|
103769
|
+
deps[depId] = {
|
|
103802
103770
|
src: dep.src,
|
|
103803
|
-
bin: dep.bin
|
|
103804
|
-
ecosystemSpecificPackageInfo: {
|
|
103805
|
-
type: "JVM"
|
|
103806
|
-
}
|
|
103771
|
+
bin: dep.bin
|
|
103807
103772
|
};
|
|
103808
|
-
}
|
|
103773
|
+
}
|
|
103774
|
+
await extractArchivesIfNeeded(tmpDir, apps, deps);
|
|
103809
103775
|
return new _JavaCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, timeoutInSeconds, statusUpdater);
|
|
103810
103776
|
}
|
|
103811
103777
|
static async initFromSocketArtifacts(subprojectDir, artifacts, tmpDir, timeoutInSeconds, statusUpdater) {
|
|
@@ -103813,55 +103779,40 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
103813
103779
|
cwd: subprojectDir,
|
|
103814
103780
|
absolute: true
|
|
103815
103781
|
});
|
|
103816
|
-
const binDirs = await glob(["{**/,}target/classes", "{**/,}target/scala-*/classes", "{**/,}build/classes/*/{main,test}"], {
|
|
103817
|
-
cwd: subprojectDir,
|
|
103818
|
-
absolute: true
|
|
103819
|
-
});
|
|
103820
|
-
const binJars = await glob(["{**/,}target/*.{jar,ear,war}", "{**/,}target/scala-*/*.{jar,ear,war}", "{**/,}build/**/*.{jar,ear,war}"], {
|
|
103821
|
-
cwd: subprojectDir,
|
|
103822
|
-
absolute: true,
|
|
103823
|
-
ignore: ["{**/,}build/{tmp,intermediates,cache}/**"]
|
|
103824
|
-
});
|
|
103825
103782
|
const apps = {
|
|
103826
|
-
|
|
103827
|
-
src: i(srcDirs)
|
|
103828
|
-
bin: i(binDirs.concat(binJars)),
|
|
103829
|
-
ecosystemSpecificPackageInfo: {
|
|
103830
|
-
type: "JVM"
|
|
103831
|
-
}
|
|
103783
|
+
"<app>": {
|
|
103784
|
+
src: i(srcDirs)
|
|
103832
103785
|
}
|
|
103833
103786
|
};
|
|
103834
103787
|
const { deps, depIdToPurl } = await convertSocketArtifacts2(subprojectDir, artifacts, tmpDir);
|
|
103788
|
+
await extractArchivesIfNeeded(tmpDir, apps, deps);
|
|
103835
103789
|
return new _JavaCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, timeoutInSeconds, statusUpdater);
|
|
103836
103790
|
}
|
|
103837
103791
|
static async runOnAlreadyDownloadedPackages([appPath, ...depPaths], vulnerability, options) {
|
|
103838
|
-
|
|
103839
|
-
|
|
103840
|
-
|
|
103841
|
-
|
|
103842
|
-
|
|
103792
|
+
return withTmpDirectory("java-run-on-dependency-chain", async (tmpDir) => {
|
|
103793
|
+
const apps = {};
|
|
103794
|
+
apps[randomUUID2()] = {
|
|
103795
|
+
bin: [appPath]
|
|
103796
|
+
};
|
|
103797
|
+
const deps = {};
|
|
103798
|
+
const depIdToPurl = /* @__PURE__ */ new Map();
|
|
103799
|
+
for (const depPath of depPaths) {
|
|
103800
|
+
const uuid = randomUUID2();
|
|
103801
|
+
depIdToPurl.set(uuid, getMavenPurl("", "", void 0, void 0, void 0));
|
|
103802
|
+
deps[uuid] = {
|
|
103803
|
+
bin: [depPath]
|
|
103804
|
+
};
|
|
103843
103805
|
}
|
|
103844
|
-
|
|
103845
|
-
|
|
103846
|
-
|
|
103847
|
-
|
|
103848
|
-
|
|
103849
|
-
|
|
103850
|
-
|
|
103851
|
-
|
|
103852
|
-
ecosystemSpecificPackageInfo: {
|
|
103853
|
-
type: "JVM"
|
|
103854
|
-
}
|
|
103806
|
+
await extractArchivesIfNeeded(tmpDir, apps, deps);
|
|
103807
|
+
const scanner = new _JavaCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, options.timeoutInSeconds);
|
|
103808
|
+
const result = await scanner.runAnalysis([vulnerability], AlucardHeuristics.ALL_PACKAGES, false);
|
|
103809
|
+
if (result.type === "error")
|
|
103810
|
+
return { error: result.message, terminatedEarly: true };
|
|
103811
|
+
return {
|
|
103812
|
+
detectedOccurrences: result.computeDetectedOccurrences(vulnerability),
|
|
103813
|
+
terminatedEarly: result.terminatedEarly
|
|
103855
103814
|
};
|
|
103856
|
-
}
|
|
103857
|
-
const scanner = new _JavaCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, options.timeoutInSeconds);
|
|
103858
|
-
const result = await scanner.runAnalysis([vulnerability], AlucardHeuristics.ALL_PACKAGES, false);
|
|
103859
|
-
if (result.type === "error")
|
|
103860
|
-
return { error: result.message, terminatedEarly: true };
|
|
103861
|
-
return {
|
|
103862
|
-
detectedOccurrences: result.computeDetectedOccurrences(vulnerability),
|
|
103863
|
-
terminatedEarly: result.terminatedEarly
|
|
103864
|
-
};
|
|
103815
|
+
});
|
|
103865
103816
|
}
|
|
103866
103817
|
static async runOnDependencyChain(dependencyChain, vulnerability, timeoutInSeconds, statusUpdater) {
|
|
103867
103818
|
return withTmpDirectory("java-run-on-dependency-chain", async (tmpDir) => {
|
|
@@ -103870,10 +103821,7 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
103870
103821
|
const apps = {
|
|
103871
103822
|
[randomUUID2()]: {
|
|
103872
103823
|
src: mavenDependencyChain[0].src,
|
|
103873
|
-
bin: mavenDependencyChain[0].bin
|
|
103874
|
-
ecosystemSpecificPackageInfo: {
|
|
103875
|
-
type: "JVM"
|
|
103876
|
-
}
|
|
103824
|
+
bin: mavenDependencyChain[0].bin
|
|
103877
103825
|
}
|
|
103878
103826
|
};
|
|
103879
103827
|
const deps = {};
|
|
@@ -103884,12 +103832,10 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
103884
103832
|
depIdToPurl.set(uuid, getMavenPurl(groupId, artifactId, dep.type, dep.classifier, dep.version ?? void 0));
|
|
103885
103833
|
deps[uuid] = {
|
|
103886
103834
|
src: dep.src,
|
|
103887
|
-
bin: dep.bin
|
|
103888
|
-
ecosystemSpecificPackageInfo: {
|
|
103889
|
-
type: "JVM"
|
|
103890
|
-
}
|
|
103835
|
+
bin: dep.bin
|
|
103891
103836
|
};
|
|
103892
103837
|
});
|
|
103838
|
+
await extractArchivesIfNeeded(tmpDir, apps, deps);
|
|
103893
103839
|
const scanner = new _JavaCodeAwareVulnerabilityScanner(apps, deps, depIdToPurl, timeoutInSeconds, statusUpdater);
|
|
103894
103840
|
const result = await scanner.actuallyRunAnalysis(vulnerability.vulnerabilityAccessPaths);
|
|
103895
103841
|
if (result.type === "error")
|
|
@@ -103914,7 +103860,7 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
103914
103860
|
const outputFile = resolve9(tmpDir, "output.json");
|
|
103915
103861
|
await writeFile4(inputFile, JSON.stringify(options));
|
|
103916
103862
|
const timeoutMs = this.timeoutInSeconds ? Math.max(this.timeoutInSeconds * 1.5, this.timeoutInSeconds + 30) * 1e3 : 750 * 1e3;
|
|
103917
|
-
const result = await execNeverFail(cmdt`node ${classGraphAnalysisCliPath} runJvmDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --
|
|
103863
|
+
const result = await execNeverFail(cmdt`node ${classGraphAnalysisCliPath} runJvmDirectDependencyAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${javapServicePath} --tree-sitter-java ${treeSitterJavaPath} --tree-sitter-kotlin ${treeSitterKotlinPath} --tree-sitter-scala ${treeSitterScalaPath}`, void 0, { timeout: timeoutMs });
|
|
103918
103864
|
if (result.error)
|
|
103919
103865
|
return void 0;
|
|
103920
103866
|
const packageIds = JSON.parse(await readFile7(outputFile, "utf-8")).result;
|
|
@@ -103948,7 +103894,7 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
103948
103894
|
const outputFile = resolve9(tmpDir, "output.json");
|
|
103949
103895
|
await writeFile4(inputFile, JSON.stringify(options));
|
|
103950
103896
|
const timeoutMs = this.timeoutInSeconds ? Math.max(this.timeoutInSeconds * 1.5, this.timeoutInSeconds + 30) * 1e3 : 750 * 1e3;
|
|
103951
|
-
const result = await execNeverFail(cmdt`node ${classGraphAnalysisCliPath} runJvmReachabilityAnalysis -i ${inputFile} -o ${outputFile} --
|
|
103897
|
+
const result = await execNeverFail(cmdt`node ${classGraphAnalysisCliPath} runJvmReachabilityAnalysis -i ${inputFile} -o ${outputFile} --javap-service ${javapServicePath} --tree-sitter-java ${treeSitterJavaPath} --tree-sitter-kotlin ${treeSitterKotlinPath} --tree-sitter-scala ${treeSitterScalaPath}`, void 0, { timeout: timeoutMs });
|
|
103952
103898
|
if (result.error)
|
|
103953
103899
|
return { type: "error", message: result.error.message ?? "unknown error" };
|
|
103954
103900
|
const { success, error, analysisDiagnostics: diagnostics, vulnerablePaths, reachablePackageIds } = JSON.parse(await readFile7(outputFile, "utf-8")).result;
|
|
@@ -103976,9 +103922,9 @@ var JavaCodeAwareVulnerabilityScanner = class _JavaCodeAwareVulnerabilityScanner
|
|
|
103976
103922
|
if (!vulnerablePathsForClass)
|
|
103977
103923
|
continue;
|
|
103978
103924
|
classStacks.push(...vulnerablePathsForClass.map((vulnPath) => {
|
|
103979
|
-
return vulnPath.map(({
|
|
103925
|
+
return vulnPath.map(({ displayName, confidence, packageId }) => ({
|
|
103980
103926
|
package: depIdToPurl.has(packageId) ? prettyPrintMavenPurl(depIdToPurl.get(packageId)) : "<app>",
|
|
103981
|
-
class:
|
|
103927
|
+
class: displayName,
|
|
103982
103928
|
confidence
|
|
103983
103929
|
}));
|
|
103984
103930
|
}));
|
|
@@ -104089,17 +104035,36 @@ async function convertSocketArtifacts2(rootDir, artifacts, tmpDir) {
|
|
|
104089
104035
|
]);
|
|
104090
104036
|
const pomFile = manifestFilesForArtifact.find((manifestFile) => pomMatcher(basename6(manifestFile)));
|
|
104091
104037
|
const artifactFile = artifact.namespace && artifact.name && artifact.version ? await resolveArtifact(artifact.namespace, artifact.name, artifact.qualifiers?.ext, artifact.qualifiers?.classifier, artifact.version, pomFile) : void 0;
|
|
104092
|
-
|
|
104093
|
-
|
|
104094
|
-
deps[uuid] = {
|
|
104095
|
-
ecosystemSpecificPackageInfo: {
|
|
104096
|
-
type: "JVM"
|
|
104097
|
-
},
|
|
104038
|
+
depIdToPurl.set(artifact.id, getPurlFromSocketFactArtifact(artifact));
|
|
104039
|
+
deps[artifact.id] = {
|
|
104098
104040
|
bin: artifactFile ? [artifactFile] : void 0
|
|
104099
104041
|
};
|
|
104100
104042
|
}, 4);
|
|
104101
104043
|
return { deps, depIdToPurl };
|
|
104102
104044
|
}
|
|
104045
|
+
async function extractArchivesIfNeeded(tmpDir, apps, deps) {
|
|
104046
|
+
const allPackages = { ...apps, ...deps };
|
|
104047
|
+
await asyncForEach(Object.values(allPackages), async (packageInfo) => {
|
|
104048
|
+
if (!packageInfo.bin?.length)
|
|
104049
|
+
return;
|
|
104050
|
+
const extractDir = resolve9(tmpDir, randomUUID2());
|
|
104051
|
+
await mkdir2(extractDir, { recursive: true });
|
|
104052
|
+
let anySucceeded = false;
|
|
104053
|
+
const failedBinPaths = [];
|
|
104054
|
+
for (const binPath of packageInfo.bin) {
|
|
104055
|
+
try {
|
|
104056
|
+
const zip = new import_adm_zip2.default(binPath);
|
|
104057
|
+
zip.extractAllTo(extractDir, true);
|
|
104058
|
+
anySucceeded = true;
|
|
104059
|
+
} catch (error) {
|
|
104060
|
+
failedBinPaths.push(binPath);
|
|
104061
|
+
}
|
|
104062
|
+
}
|
|
104063
|
+
if (anySucceeded) {
|
|
104064
|
+
packageInfo.bin = [extractDir, ...failedBinPaths];
|
|
104065
|
+
}
|
|
104066
|
+
}, 8);
|
|
104067
|
+
}
|
|
104103
104068
|
|
|
104104
104069
|
// dist/whole-program-code-aware-vulnerability-scanner/js/js-code-aware-vulnerability-scanner.js
|
|
104105
104070
|
import { mkdtempSync } from "fs";
|
|
@@ -110222,14 +110187,13 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110222
110187
|
const appDependencies = {};
|
|
110223
110188
|
if (dependencyTree.dependenciesWithAliases) {
|
|
110224
110189
|
for (const [depId, names] of Object.entries(dependencyTree.dependenciesWithAliases)) {
|
|
110225
|
-
appDependencies[depId] =
|
|
110190
|
+
appDependencies[depId] = names;
|
|
110226
110191
|
}
|
|
110227
110192
|
}
|
|
110228
110193
|
const apps = {
|
|
110229
110194
|
"<app>": {
|
|
110230
110195
|
src: dependencyTree.src,
|
|
110231
|
-
|
|
110232
|
-
type: "RUST",
|
|
110196
|
+
packageInfo: {
|
|
110233
110197
|
crate: dependencyTree.packageName.replaceAll("-", "_"),
|
|
110234
110198
|
dependencies: appDependencies
|
|
110235
110199
|
}
|
|
@@ -110242,13 +110206,12 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110242
110206
|
const dependencies = {};
|
|
110243
110207
|
if (dep.dependenciesWithAliases) {
|
|
110244
110208
|
for (const [transDepId, names] of Object.entries(dep.dependenciesWithAliases)) {
|
|
110245
|
-
dependencies[transDepId] =
|
|
110209
|
+
dependencies[transDepId] = names;
|
|
110246
110210
|
}
|
|
110247
110211
|
}
|
|
110248
110212
|
deps[depId] = {
|
|
110249
110213
|
src: dep.src,
|
|
110250
|
-
|
|
110251
|
-
type: "RUST",
|
|
110214
|
+
packageInfo: {
|
|
110252
110215
|
crate: dep.packageName.replaceAll("-", "_"),
|
|
110253
110216
|
dependencies
|
|
110254
110217
|
}
|
|
@@ -110287,7 +110250,7 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110287
110250
|
for (const artifact of directDepArtifacts) {
|
|
110288
110251
|
const names = artifact.name ? cargoTomlDeps.get(artifact.name) ?? [artifact.name] : [];
|
|
110289
110252
|
if (names.length > 0) {
|
|
110290
|
-
dependencies[artifact.id] =
|
|
110253
|
+
dependencies[artifact.id] = names;
|
|
110291
110254
|
}
|
|
110292
110255
|
}
|
|
110293
110256
|
} else {
|
|
@@ -110296,15 +110259,14 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110296
110259
|
const directDepArtifacts = cargoTomlToArtifacts.get(cargoTomlRelativePath) ?? [];
|
|
110297
110260
|
for (const artifact of directDepArtifacts) {
|
|
110298
110261
|
if (artifact.name) {
|
|
110299
|
-
dependencies[artifact.id] =
|
|
110262
|
+
dependencies[artifact.id] = [artifact.name];
|
|
110300
110263
|
}
|
|
110301
110264
|
}
|
|
110302
110265
|
}
|
|
110303
110266
|
const apps = {
|
|
110304
110267
|
"<app>": {
|
|
110305
110268
|
src: appSrc,
|
|
110306
|
-
|
|
110307
|
-
type: "RUST",
|
|
110269
|
+
packageInfo: {
|
|
110308
110270
|
crate: appCrateName,
|
|
110309
110271
|
dependencies
|
|
110310
110272
|
}
|
|
@@ -110351,14 +110313,13 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110351
110313
|
for (const [packageName, names] of cargoTomlDeps.entries()) {
|
|
110352
110314
|
const depId = packageNameToId.get(packageName);
|
|
110353
110315
|
if (depId) {
|
|
110354
|
-
dependencies[depId] =
|
|
110316
|
+
dependencies[depId] = names;
|
|
110355
110317
|
}
|
|
110356
110318
|
}
|
|
110357
110319
|
const packageId = packageNameToId.get(crateInfo.name);
|
|
110358
110320
|
const packageInfo = {
|
|
110359
110321
|
src: isApp ? i([crateInfo.lib, ...crateInfo.examples ?? [], ...crateInfo.tests ?? []]) : [crateInfo.lib],
|
|
110360
|
-
|
|
110361
|
-
type: "RUST",
|
|
110322
|
+
packageInfo: {
|
|
110362
110323
|
crate: crateInfo.name.replaceAll("-", "_"),
|
|
110363
110324
|
dependencies
|
|
110364
110325
|
}
|
|
@@ -110397,7 +110358,7 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110397
110358
|
for (const [packageName, names] of cargoTomlDeps.entries()) {
|
|
110398
110359
|
const depId = packageNameToId.get(packageName);
|
|
110399
110360
|
if (depId) {
|
|
110400
|
-
appDependencies[depId] =
|
|
110361
|
+
appDependencies[depId] = names;
|
|
110401
110362
|
}
|
|
110402
110363
|
}
|
|
110403
110364
|
}
|
|
@@ -110405,8 +110366,7 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110405
110366
|
const apps = {
|
|
110406
110367
|
"<app>": {
|
|
110407
110368
|
src: rustDependencyChain[0].src,
|
|
110408
|
-
|
|
110409
|
-
type: "RUST",
|
|
110369
|
+
packageInfo: {
|
|
110410
110370
|
crate: rustDependencyChain[0].packageName.replaceAll("-", "_"),
|
|
110411
110371
|
dependencies: appDependencies
|
|
110412
110372
|
}
|
|
@@ -110425,15 +110385,14 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110425
110385
|
for (const [packageName, names] of cargoTomlDeps.entries()) {
|
|
110426
110386
|
const transDepId = packageNameToId.get(packageName);
|
|
110427
110387
|
if (transDepId) {
|
|
110428
|
-
dependencies[transDepId] =
|
|
110388
|
+
dependencies[transDepId] = names;
|
|
110429
110389
|
}
|
|
110430
110390
|
}
|
|
110431
110391
|
}
|
|
110432
110392
|
}
|
|
110433
110393
|
deps[packageId] = {
|
|
110434
110394
|
src: dep.src,
|
|
110435
|
-
|
|
110436
|
-
type: "RUST",
|
|
110395
|
+
packageInfo: {
|
|
110437
110396
|
crate: dep.packageName.replaceAll("-", "_"),
|
|
110438
110397
|
dependencies
|
|
110439
110398
|
}
|
|
@@ -110529,9 +110488,9 @@ var RustCodeAwareVulnerabilityScanner = class _RustCodeAwareVulnerabilityScanner
|
|
|
110529
110488
|
if (!vulnerablePathsForClass)
|
|
110530
110489
|
continue;
|
|
110531
110490
|
classStacks.push(...vulnerablePathsForClass.map((vulnPath) => {
|
|
110532
|
-
return vulnPath.map(({
|
|
110491
|
+
return vulnPath.map(({ displayName, confidence, packageId }) => ({
|
|
110533
110492
|
package: depIdToPurl.has(packageId) ? prettyPrintCargoPurl(depIdToPurl.get(packageId)) : "<app>",
|
|
110534
|
-
class:
|
|
110493
|
+
class: displayName,
|
|
110535
110494
|
confidence
|
|
110536
110495
|
}));
|
|
110537
110496
|
}));
|
|
@@ -110682,14 +110641,13 @@ async function convertSocketArtifacts3(artifacts, tmpDir, artifactNameToId) {
|
|
|
110682
110641
|
for (const [packageName, names] of cargoTomlDeps.entries()) {
|
|
110683
110642
|
const depArtifactId = artifactNameToId.get(packageName);
|
|
110684
110643
|
if (depArtifactId) {
|
|
110685
|
-
dependencies[depArtifactId] =
|
|
110644
|
+
dependencies[depArtifactId] = names;
|
|
110686
110645
|
}
|
|
110687
110646
|
}
|
|
110688
110647
|
}
|
|
110689
110648
|
}
|
|
110690
110649
|
deps[artifact.id] = {
|
|
110691
|
-
|
|
110692
|
-
type: "RUST",
|
|
110650
|
+
packageInfo: {
|
|
110693
110651
|
crate: artifact.name?.replaceAll("-", "_") ?? "",
|
|
110694
110652
|
dependencies
|
|
110695
110653
|
},
|
|
@@ -110714,8 +110672,8 @@ async function extractDependenciesFromCargoToml(cargoTomlPath) {
|
|
|
110714
110672
|
actualPackageName = key;
|
|
110715
110673
|
} else if (dep instanceof TOMLTable) {
|
|
110716
110674
|
const packageNameValue = dep.package;
|
|
110717
|
-
if (packageNameValue instanceof TOMLScalar) {
|
|
110718
|
-
actualPackageName =
|
|
110675
|
+
if (packageNameValue instanceof TOMLScalar && typeof packageNameValue[value] === "string") {
|
|
110676
|
+
actualPackageName = packageNameValue[value];
|
|
110719
110677
|
} else {
|
|
110720
110678
|
actualPackageName = key;
|
|
110721
110679
|
}
|
|
@@ -110757,19 +110715,19 @@ async function getCrateInfo(cargoTomlPath) {
|
|
|
110757
110715
|
const packageSection = getNestedValue(parsed, "package");
|
|
110758
110716
|
if (packageSection instanceof TOMLTable) {
|
|
110759
110717
|
const packageName = packageSection.name;
|
|
110760
|
-
if (packageName instanceof TOMLScalar) {
|
|
110761
|
-
name2 =
|
|
110718
|
+
if (packageName instanceof TOMLScalar && typeof packageName[value] === "string") {
|
|
110719
|
+
name2 = packageName[value];
|
|
110762
110720
|
}
|
|
110763
110721
|
const packageVersion = packageSection.version;
|
|
110764
|
-
if (packageVersion instanceof TOMLScalar) {
|
|
110765
|
-
version3 =
|
|
110722
|
+
if (packageVersion instanceof TOMLScalar && typeof packageVersion[value] === "string") {
|
|
110723
|
+
version3 = packageVersion[value];
|
|
110766
110724
|
}
|
|
110767
110725
|
}
|
|
110768
110726
|
const libSection = parsed.lib;
|
|
110769
110727
|
if (libSection instanceof TOMLTable) {
|
|
110770
110728
|
const libPath = libSection.path;
|
|
110771
|
-
if (libPath instanceof TOMLScalar) {
|
|
110772
|
-
lib = dirname13(resolve15(cargoTomlDir,
|
|
110729
|
+
if (libPath instanceof TOMLScalar && typeof libPath[value] === "string") {
|
|
110730
|
+
lib = dirname13(resolve15(cargoTomlDir, libPath[value]));
|
|
110773
110731
|
}
|
|
110774
110732
|
}
|
|
110775
110733
|
const exampleSection = parsed.example;
|
|
@@ -110778,8 +110736,8 @@ async function getCrateInfo(cargoTomlPath) {
|
|
|
110778
110736
|
exampleSection.forEach((example) => {
|
|
110779
110737
|
if (example instanceof TOMLTable) {
|
|
110780
110738
|
const examplePath = example.path;
|
|
110781
|
-
if (examplePath instanceof TOMLScalar) {
|
|
110782
|
-
examples?.push(dirname13(resolve15(cargoTomlDir,
|
|
110739
|
+
if (examplePath instanceof TOMLScalar && typeof examplePath[value] === "string") {
|
|
110740
|
+
examples?.push(dirname13(resolve15(cargoTomlDir, examplePath[value])));
|
|
110783
110741
|
}
|
|
110784
110742
|
}
|
|
110785
110743
|
});
|
|
@@ -110790,8 +110748,8 @@ async function getCrateInfo(cargoTomlPath) {
|
|
|
110790
110748
|
testSection.forEach((test3) => {
|
|
110791
110749
|
if (test3 instanceof TOMLTable) {
|
|
110792
110750
|
const testPath = test3.path;
|
|
110793
|
-
if (testPath instanceof TOMLScalar) {
|
|
110794
|
-
tests?.push(dirname13(resolve15(cargoTomlDir,
|
|
110751
|
+
if (testPath instanceof TOMLScalar && typeof testPath[value] === "string") {
|
|
110752
|
+
tests?.push(dirname13(resolve15(cargoTomlDir, testPath[value])));
|
|
110795
110753
|
}
|
|
110796
110754
|
}
|
|
110797
110755
|
});
|
|
@@ -112031,13 +111989,13 @@ var MavenAnalyzer = class {
|
|
|
112031
111989
|
}
|
|
112032
111990
|
async runPhantomDependencyAnalysis() {
|
|
112033
111991
|
return withTmpDirectory("maven-phantom-dependency-analysis", async (tmpDir) => {
|
|
112034
|
-
const scanner = this.state.workspaceData.type === "coana" ? JavaCodeAwareVulnerabilityScanner.initFromDependencyTree(this.state.workspaceData.data.dependencyTree) : await JavaCodeAwareVulnerabilityScanner.initFromSocketArtifacts(this.state.subprojectDir, this.state.workspaceData.data.artifacts, tmpDir);
|
|
111992
|
+
const scanner = this.state.workspaceData.type === "coana" ? await JavaCodeAwareVulnerabilityScanner.initFromDependencyTree(this.state.workspaceData.data.dependencyTree, tmpDir) : await JavaCodeAwareVulnerabilityScanner.initFromSocketArtifacts(this.state.subprojectDir, this.state.workspaceData.data.artifacts, tmpDir);
|
|
112035
111993
|
return scanner.runPhantomDependencyAnalysis();
|
|
112036
111994
|
});
|
|
112037
111995
|
}
|
|
112038
111996
|
async runReachabilityAnalysis(vulns, analysisMetadataCollector, statusUpdater) {
|
|
112039
111997
|
return withTmpDirectory("maven-reachability-analysis", async (tmpDir) => {
|
|
112040
|
-
const scanner = this.state.workspaceData.type === "coana" ? JavaCodeAwareVulnerabilityScanner.initFromDependencyTree(this.state.workspaceData.data.dependencyTree, this.state.reachabilityAnalysisOptions.timeoutInSeconds, statusUpdater) : await JavaCodeAwareVulnerabilityScanner.initFromSocketArtifacts(this.state.subprojectDir, this.state.workspaceData.data.artifacts, tmpDir, this.state.reachabilityAnalysisOptions.timeoutInSeconds, statusUpdater);
|
|
111998
|
+
const scanner = this.state.workspaceData.type === "coana" ? await JavaCodeAwareVulnerabilityScanner.initFromDependencyTree(this.state.workspaceData.data.dependencyTree, tmpDir, this.state.reachabilityAnalysisOptions.timeoutInSeconds, statusUpdater) : await JavaCodeAwareVulnerabilityScanner.initFromSocketArtifacts(this.state.subprojectDir, this.state.workspaceData.data.artifacts, tmpDir, this.state.reachabilityAnalysisOptions.timeoutInSeconds, statusUpdater);
|
|
112041
111999
|
const heuristicsInOrder = [AlucardHeuristics.ALL_PACKAGES];
|
|
112042
112000
|
return await analyzeWithHeuristics(this.state, vulns, heuristicsInOrder, false, scanner, analysisMetadataCollector, statusUpdater);
|
|
112043
112001
|
});
|