@coana-tech/cli 14.12.199 → 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 +57 -38
- 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
|
@@ -25038,15 +25038,15 @@ var require_file = __commonJS({
|
|
|
25038
25038
|
_incFile(callback) {
|
|
25039
25039
|
debug("_incFile", this.filename);
|
|
25040
25040
|
const ext2 = path9.extname(this._basename);
|
|
25041
|
-
const
|
|
25041
|
+
const basename13 = path9.basename(this._basename, ext2);
|
|
25042
25042
|
const tasks = [];
|
|
25043
25043
|
if (this.zippedArchive) {
|
|
25044
25044
|
tasks.push(
|
|
25045
25045
|
function(cb) {
|
|
25046
25046
|
const num = this._created > 0 && !this.tailable ? this._created : "";
|
|
25047
25047
|
this._compressFile(
|
|
25048
|
-
path9.join(this.dirname, `${
|
|
25049
|
-
path9.join(this.dirname, `${
|
|
25048
|
+
path9.join(this.dirname, `${basename13}${num}${ext2}`),
|
|
25049
|
+
path9.join(this.dirname, `${basename13}${num}${ext2}.gz`),
|
|
25050
25050
|
cb
|
|
25051
25051
|
);
|
|
25052
25052
|
}.bind(this)
|
|
@@ -25056,9 +25056,9 @@ var require_file = __commonJS({
|
|
|
25056
25056
|
function(cb) {
|
|
25057
25057
|
if (!this.tailable) {
|
|
25058
25058
|
this._created += 1;
|
|
25059
|
-
this._checkMaxFilesIncrementing(ext2,
|
|
25059
|
+
this._checkMaxFilesIncrementing(ext2, basename13, cb);
|
|
25060
25060
|
} else {
|
|
25061
|
-
this._checkMaxFilesTailable(ext2,
|
|
25061
|
+
this._checkMaxFilesTailable(ext2, basename13, cb);
|
|
25062
25062
|
}
|
|
25063
25063
|
}.bind(this)
|
|
25064
25064
|
);
|
|
@@ -25072,9 +25072,9 @@ var require_file = __commonJS({
|
|
|
25072
25072
|
*/
|
|
25073
25073
|
_getFile() {
|
|
25074
25074
|
const ext2 = path9.extname(this._basename);
|
|
25075
|
-
const
|
|
25075
|
+
const basename13 = path9.basename(this._basename, ext2);
|
|
25076
25076
|
const isRotation = this.rotationFormat ? this.rotationFormat() : this._created;
|
|
25077
|
-
return !this.tailable && this._created ? `${
|
|
25077
|
+
return !this.tailable && this._created ? `${basename13}${isRotation}${ext2}` : `${basename13}${ext2}`;
|
|
25078
25078
|
}
|
|
25079
25079
|
/**
|
|
25080
25080
|
* Increment the number of files created or checked by this instance.
|
|
@@ -25084,14 +25084,14 @@ var require_file = __commonJS({
|
|
|
25084
25084
|
* @returns {undefined}
|
|
25085
25085
|
* @private
|
|
25086
25086
|
*/
|
|
25087
|
-
_checkMaxFilesIncrementing(ext2,
|
|
25087
|
+
_checkMaxFilesIncrementing(ext2, basename13, callback) {
|
|
25088
25088
|
if (!this.maxFiles || this._created < this.maxFiles) {
|
|
25089
25089
|
return setImmediate(callback);
|
|
25090
25090
|
}
|
|
25091
25091
|
const oldest = this._created - this.maxFiles;
|
|
25092
25092
|
const isOldest = oldest !== 0 ? oldest : "";
|
|
25093
25093
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
25094
|
-
const filePath = `${
|
|
25094
|
+
const filePath = `${basename13}${isOldest}${ext2}${isZipped}`;
|
|
25095
25095
|
const target = path9.join(this.dirname, filePath);
|
|
25096
25096
|
fs11.unlink(target, callback);
|
|
25097
25097
|
}
|
|
@@ -25106,7 +25106,7 @@ var require_file = __commonJS({
|
|
|
25106
25106
|
* @returns {undefined}
|
|
25107
25107
|
* @private
|
|
25108
25108
|
*/
|
|
25109
|
-
_checkMaxFilesTailable(ext2,
|
|
25109
|
+
_checkMaxFilesTailable(ext2, basename13, callback) {
|
|
25110
25110
|
const tasks = [];
|
|
25111
25111
|
if (!this.maxFiles) {
|
|
25112
25112
|
return;
|
|
@@ -25114,21 +25114,21 @@ var require_file = __commonJS({
|
|
|
25114
25114
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
25115
25115
|
for (let x2 = this.maxFiles - 1; x2 > 1; x2--) {
|
|
25116
25116
|
tasks.push(function(i7, cb) {
|
|
25117
|
-
let fileName3 = `${
|
|
25117
|
+
let fileName3 = `${basename13}${i7 - 1}${ext2}${isZipped}`;
|
|
25118
25118
|
const tmppath = path9.join(this.dirname, fileName3);
|
|
25119
25119
|
fs11.exists(tmppath, (exists2) => {
|
|
25120
25120
|
if (!exists2) {
|
|
25121
25121
|
return cb(null);
|
|
25122
25122
|
}
|
|
25123
|
-
fileName3 = `${
|
|
25123
|
+
fileName3 = `${basename13}${i7}${ext2}${isZipped}`;
|
|
25124
25124
|
fs11.rename(tmppath, path9.join(this.dirname, fileName3), cb);
|
|
25125
25125
|
});
|
|
25126
25126
|
}.bind(this, x2));
|
|
25127
25127
|
}
|
|
25128
25128
|
asyncSeries(tasks, () => {
|
|
25129
25129
|
fs11.rename(
|
|
25130
|
-
path9.join(this.dirname, `${
|
|
25131
|
-
path9.join(this.dirname, `${
|
|
25130
|
+
path9.join(this.dirname, `${basename13}${ext2}${isZipped}`),
|
|
25131
|
+
path9.join(this.dirname, `${basename13}1${ext2}${isZipped}`),
|
|
25132
25132
|
callback
|
|
25133
25133
|
);
|
|
25134
25134
|
});
|
|
@@ -102682,7 +102682,7 @@ var require_parseParams = __commonJS({
|
|
|
102682
102682
|
var require_basename = __commonJS({
|
|
102683
102683
|
"../../node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js"(exports2, module2) {
|
|
102684
102684
|
"use strict";
|
|
102685
|
-
module2.exports = function
|
|
102685
|
+
module2.exports = function basename13(path9) {
|
|
102686
102686
|
if (typeof path9 !== "string") {
|
|
102687
102687
|
return "";
|
|
102688
102688
|
}
|
|
@@ -102709,7 +102709,7 @@ var require_multipart = __commonJS({
|
|
|
102709
102709
|
var Dicer = require_Dicer();
|
|
102710
102710
|
var parseParams = require_parseParams();
|
|
102711
102711
|
var decodeText = require_decodeText();
|
|
102712
|
-
var
|
|
102712
|
+
var basename13 = require_basename();
|
|
102713
102713
|
var getLimit2 = require_getLimit();
|
|
102714
102714
|
var RE_BOUNDARY = /^boundary$/i;
|
|
102715
102715
|
var RE_FIELD = /^form-data$/i;
|
|
@@ -102826,7 +102826,7 @@ var require_multipart = __commonJS({
|
|
|
102826
102826
|
} else if (RE_FILENAME.test(parsed[i7][0])) {
|
|
102827
102827
|
filename = parsed[i7][1];
|
|
102828
102828
|
if (!preservePath) {
|
|
102829
|
-
filename =
|
|
102829
|
+
filename = basename13(filename);
|
|
102830
102830
|
}
|
|
102831
102831
|
}
|
|
102832
102832
|
}
|
|
@@ -121662,8 +121662,8 @@ var require_tmp = __commonJS({
|
|
|
121662
121662
|
if (option === "name") {
|
|
121663
121663
|
if (path9.isAbsolute(name2))
|
|
121664
121664
|
throw new Error(`${option} option must not contain an absolute path, found "${name2}".`);
|
|
121665
|
-
let
|
|
121666
|
-
if (
|
|
121665
|
+
let basename13 = path9.basename(name2);
|
|
121666
|
+
if (basename13 === ".." || basename13 === "." || basename13 !== name2)
|
|
121667
121667
|
throw new Error(`${option} option must not contain a path, found "${name2}".`);
|
|
121668
121668
|
} else {
|
|
121669
121669
|
if (path9.isAbsolute(name2) && !name2.startsWith(tmpDir)) {
|
|
@@ -155347,8 +155347,8 @@ var require_pattern = __commonJS({
|
|
|
155347
155347
|
}
|
|
155348
155348
|
exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
155349
155349
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
155350
|
-
const
|
|
155351
|
-
return endsWithSlashGlobStar(pattern) || isStaticPattern(
|
|
155350
|
+
const basename13 = path9.basename(pattern);
|
|
155351
|
+
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename13);
|
|
155352
155352
|
}
|
|
155353
155353
|
exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
155354
155354
|
function expandPatternsWithBraceExpansion(patterns) {
|
|
@@ -234280,6 +234280,28 @@ function assertDefined(value2) {
|
|
|
234280
234280
|
}
|
|
234281
234281
|
|
|
234282
234282
|
// dist/internal/validate-external-dependencies.js
|
|
234283
|
+
import { basename as basename10 } from "path";
|
|
234284
|
+
function getEcosystemsFromManifestFileNames(fileNames) {
|
|
234285
|
+
const ecosystems = /* @__PURE__ */ new Set();
|
|
234286
|
+
for (const f6 of fileNames) {
|
|
234287
|
+
const base = basename10(f6);
|
|
234288
|
+
if (/^package(-lock)?\.json$|pnpm-lock\.yaml|yarn\.lock|rush\.json/.test(base))
|
|
234289
|
+
ecosystems.add("NPM");
|
|
234290
|
+
if (/^pom\.xml$|^gradlew$|^build\.sbt$/.test(base))
|
|
234291
|
+
ecosystems.add("MAVEN");
|
|
234292
|
+
if (/^go\.(mod|work)$/.test(base))
|
|
234293
|
+
ecosystems.add("GO");
|
|
234294
|
+
if (/\.(sln|csproj|vbproj|fsproj)$/.test(base))
|
|
234295
|
+
ecosystems.add("NUGET");
|
|
234296
|
+
if (/^[Cc]argo\.(toml|lock)$/.test(base))
|
|
234297
|
+
ecosystems.add("RUST");
|
|
234298
|
+
if (/^([Gg]emfile(\.lock)?|gems\.rb|[^/\\]+\.gemspec)$/.test(base))
|
|
234299
|
+
ecosystems.add("RUBYGEMS");
|
|
234300
|
+
if (/^(pyproject\.toml|setup\.py|poetry\.lock|Pipfile\.lock|uv\.lock|requirements.*\.txt)$/.test(base))
|
|
234301
|
+
ecosystems.add("PIP");
|
|
234302
|
+
}
|
|
234303
|
+
return [...ecosystems];
|
|
234304
|
+
}
|
|
234283
234305
|
async function validateExternalDependencies(ecosystems, command, manifestFileNames) {
|
|
234284
234306
|
const checks = [];
|
|
234285
234307
|
const ecosystemSet = new Set(ecosystems);
|
|
@@ -235554,7 +235576,7 @@ var DEFAULT_REPORT_FILENAME_BASE = "coana-report";
|
|
|
235554
235576
|
// dist/internal/exclude-dirs-from-configuration-files.js
|
|
235555
235577
|
import { existsSync as existsSync25 } from "fs";
|
|
235556
235578
|
import { readFile as readFile35 } from "fs/promises";
|
|
235557
|
-
import { basename as
|
|
235579
|
+
import { basename as basename11, resolve as resolve41 } from "path";
|
|
235558
235580
|
var import_yaml2 = __toESM(require_dist11(), 1);
|
|
235559
235581
|
async function inferExcludeDirsFromConfigurationFiles(rootWorkingDir) {
|
|
235560
235582
|
const socketYmlConfigFile = resolve41(rootWorkingDir, "socket.yml");
|
|
@@ -235574,7 +235596,7 @@ async function inferExcludeDirsFromSocketConfig(socketConfigFile) {
|
|
|
235574
235596
|
return void 0;
|
|
235575
235597
|
if (ignorePaths.some((ignorePath) => ignorePath.includes("!")))
|
|
235576
235598
|
return void 0;
|
|
235577
|
-
logger.info(`Inferring paths to exclude based on Socket config file: ${
|
|
235599
|
+
logger.info(`Inferring paths to exclude based on Socket config file: ${basename11(socketConfigFile)}`);
|
|
235578
235600
|
return config3.projectIgnorePaths;
|
|
235579
235601
|
} catch (e) {
|
|
235580
235602
|
return void 0;
|
|
@@ -235784,7 +235806,7 @@ function transformToVulnChainNode(dependencyTree) {
|
|
|
235784
235806
|
}
|
|
235785
235807
|
|
|
235786
235808
|
// dist/internal/socket-mode-helpers-socket-dependency-trees.js
|
|
235787
|
-
import { basename as
|
|
235809
|
+
import { basename as basename12, dirname as dirname25, join as join32, sep as sep5 } from "path";
|
|
235788
235810
|
var REQUIREMENTS_FILES_SEARCH_DEPTH2 = 3;
|
|
235789
235811
|
var venvExcludes = [
|
|
235790
235812
|
"venv",
|
|
@@ -235812,7 +235834,7 @@ var venvExcludes = [
|
|
|
235812
235834
|
function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonProjects) {
|
|
235813
235835
|
switch (ecosystem) {
|
|
235814
235836
|
case "NPM": {
|
|
235815
|
-
const base =
|
|
235837
|
+
const base = basename12(manifestPath);
|
|
235816
235838
|
const dir = dirname25(manifestPath);
|
|
235817
235839
|
return base === "package.json" ? dir || "." : void 0;
|
|
235818
235840
|
}
|
|
@@ -235823,7 +235845,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
235823
235845
|
if (venvExcludes.some((exclude) => manifestPath.startsWith(`${exclude}/`) || manifestPath.includes(`/${exclude}/`))) {
|
|
235824
235846
|
return void 0;
|
|
235825
235847
|
}
|
|
235826
|
-
const base =
|
|
235848
|
+
const base = basename12(manifestPath);
|
|
235827
235849
|
const dir = dirname25(manifestPath);
|
|
235828
235850
|
const workspaceDir = dir === "" ? "." : dir;
|
|
235829
235851
|
if (properPythonProjects.includes(workspaceDir)) {
|
|
@@ -235850,7 +235872,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
235850
235872
|
return dirname25(manifestPath) || ".";
|
|
235851
235873
|
}
|
|
235852
235874
|
case "GO": {
|
|
235853
|
-
const base =
|
|
235875
|
+
const base = basename12(manifestPath);
|
|
235854
235876
|
const dir = dirname25(manifestPath);
|
|
235855
235877
|
return base === "go.mod" ? dir || "." : void 0;
|
|
235856
235878
|
}
|
|
@@ -235865,7 +235887,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
235865
235887
|
function inferProjectFromManifestPath(ecosystem, manifestPath) {
|
|
235866
235888
|
switch (ecosystem) {
|
|
235867
235889
|
case "NPM": {
|
|
235868
|
-
const filename =
|
|
235890
|
+
const filename = basename12(manifestPath);
|
|
235869
235891
|
if (["package-lock.json", "pnpm-lock.yaml", "pnpm-lock.yml", "yarn.lock"].includes(filename)) {
|
|
235870
235892
|
return dirname25(manifestPath) || ".";
|
|
235871
235893
|
}
|
|
@@ -235907,7 +235929,7 @@ async function fetchArtifactsFromSocket(rootWorkingDirectory, manifestsTarHash,
|
|
|
235907
235929
|
}
|
|
235908
235930
|
const allFiles = await getFilesRelative(rootWorkingDirectory, venvExcludes);
|
|
235909
235931
|
for (const file of allFiles) {
|
|
235910
|
-
const base =
|
|
235932
|
+
const base = basename12(file);
|
|
235911
235933
|
const workspaceDir = dirname25(file) || ".";
|
|
235912
235934
|
if (base === "pyproject.toml" || base === "setup.py" && await isSetupPySetuptools(join32(rootWorkingDirectory, file))) {
|
|
235913
235935
|
if (!properPythonProjects.includes(workspaceDir)) {
|
|
@@ -251655,7 +251677,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
251655
251677
|
}
|
|
251656
251678
|
|
|
251657
251679
|
// dist/version.js
|
|
251658
|
-
var version3 = "14.12.
|
|
251680
|
+
var version3 = "14.12.201";
|
|
251659
251681
|
|
|
251660
251682
|
// dist/cli-core.js
|
|
251661
251683
|
var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
|
|
@@ -251861,13 +251883,14 @@ var CliCore = class {
|
|
|
251861
251883
|
}
|
|
251862
251884
|
async computeAndOutputReportSocketMode(otherModulesCommunicator) {
|
|
251863
251885
|
logger.info("Fetching artifacts from Socket backend");
|
|
251886
|
+
if (!this.options.disableExternalToolChecks) {
|
|
251887
|
+
const manifestFiles = await fetchManifestFilesFromManifestsTarHash(this.options.manifestsTarHash);
|
|
251888
|
+
const ecosystems = getEcosystemsFromManifestFileNames(manifestFiles);
|
|
251889
|
+
await validateExternalDependencies(ecosystems, "run", manifestFiles);
|
|
251890
|
+
}
|
|
251864
251891
|
this.sendProgress("SCAN_FOR_VULNERABILITIES", true, ".", ".");
|
|
251865
251892
|
const { artifacts, ecosystemToWorkspaceToAnalysisData, ecosystemToWorkspaceToVulnerabilities } = await fetchArtifactsFromSocket(this.rootWorkingDirectory, this.options.manifestsTarHash, "reachability", this.options.useUnreachableFromPrecomputation, this.options.useOnlyPregeneratedSboms);
|
|
251866
251893
|
this.sendProgress("SCAN_FOR_VULNERABILITIES", false, ".", ".");
|
|
251867
|
-
const detectedEcosystemsSocket = Object.keys(ecosystemToWorkspaceToAnalysisData);
|
|
251868
|
-
if (!this.options.disableExternalToolChecks) {
|
|
251869
|
-
await validateExternalDependencies(detectedEcosystemsSocket, "run");
|
|
251870
|
-
}
|
|
251871
251894
|
const subProjects = Object.entries(ecosystemToWorkspaceToAnalysisData).flatMap(([ecosystem, workspaceToAnalysisData]) => {
|
|
251872
251895
|
return Object.entries(workspaceToAnalysisData).map(([workspace, analysisData]) => {
|
|
251873
251896
|
return {
|
|
@@ -252009,10 +252032,6 @@ var CliCore = class {
|
|
|
252009
252032
|
const manager = await ProjectManager.create(this.rootWorkingDirectory, otherModulesCommunicator, this.options.ecosystems, this.options.includeDirs, this.options.excludeDirs, this.options.changedFiles);
|
|
252010
252033
|
this.sendProgress("CREATE_PROJECT_MANAGER", false);
|
|
252011
252034
|
const { reachabilitySupport, traditionalScaSupport, noSupport } = manager.getSubprojectsWithWorkspacePaths();
|
|
252012
|
-
const detectedEcosystemsSbom = [...new Set([...reachabilitySupport, ...traditionalScaSupport].map((s6) => s6.ecosystem))];
|
|
252013
|
-
if (!this.options.disableExternalToolChecks) {
|
|
252014
|
-
await validateExternalDependencies(detectedEcosystemsSbom, "run");
|
|
252015
|
-
}
|
|
252016
252035
|
await this.dashboardAPI.registerSubprojects([...reachabilitySupport, ...traditionalScaSupport, ...noSupport].map((sp) => ({
|
|
252017
252036
|
...sp,
|
|
252018
252037
|
subprojectPath: relative22(this.rootWorkingDirectory, sp.subprojectPath) || "."
|
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
|