@coana-tech/cli 15.2.1 → 15.2.2
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 +186 -319
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +51 -51
- 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/package.json
CHANGED
|
@@ -35347,8 +35347,8 @@ var require_follow_redirects = __commonJS({
|
|
|
35347
35347
|
}
|
|
35348
35348
|
return parsed;
|
|
35349
35349
|
}
|
|
35350
|
-
function resolveUrl(
|
|
35351
|
-
return useNativeURL ? new URL3(
|
|
35350
|
+
function resolveUrl(relative15, base) {
|
|
35351
|
+
return useNativeURL ? new URL3(relative15, base) : parseUrl(url2.resolve(base, relative15));
|
|
35352
35352
|
}
|
|
35353
35353
|
function validateUrl(input) {
|
|
35354
35354
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -79848,7 +79848,7 @@ function deserializeRustDependencyChainNode(s2) {
|
|
|
79848
79848
|
|
|
79849
79849
|
// dist/main.js
|
|
79850
79850
|
var import_lodash25 = __toESM(require_lodash(), 1);
|
|
79851
|
-
import { relative as
|
|
79851
|
+
import { relative as relative14, resolve as resolve27 } from "path";
|
|
79852
79852
|
|
|
79853
79853
|
// ../utils/src/dashboard-api/coana-api.ts
|
|
79854
79854
|
import { writeFile } from "fs/promises";
|
|
@@ -86287,10 +86287,10 @@ var Ignore = class {
|
|
|
86287
86287
|
ignored(p) {
|
|
86288
86288
|
const fullpath = p.fullpath();
|
|
86289
86289
|
const fullpaths = `${fullpath}/`;
|
|
86290
|
-
const
|
|
86291
|
-
const relatives = `${
|
|
86290
|
+
const relative15 = p.relative() || ".";
|
|
86291
|
+
const relatives = `${relative15}/`;
|
|
86292
86292
|
for (const m of this.relative) {
|
|
86293
|
-
if (m.match(
|
|
86293
|
+
if (m.match(relative15) || m.match(relatives))
|
|
86294
86294
|
return true;
|
|
86295
86295
|
}
|
|
86296
86296
|
for (const m of this.absolute) {
|
|
@@ -86301,9 +86301,9 @@ var Ignore = class {
|
|
|
86301
86301
|
}
|
|
86302
86302
|
childrenIgnored(p) {
|
|
86303
86303
|
const fullpath = p.fullpath() + "/";
|
|
86304
|
-
const
|
|
86304
|
+
const relative15 = (p.relative() || ".") + "/";
|
|
86305
86305
|
for (const m of this.relativeChildren) {
|
|
86306
|
-
if (m.match(
|
|
86306
|
+
if (m.match(relative15))
|
|
86307
86307
|
return true;
|
|
86308
86308
|
}
|
|
86309
86309
|
for (const m of this.absoluteChildren) {
|
|
@@ -87126,7 +87126,7 @@ glob.glob = glob;
|
|
|
87126
87126
|
var import_lodash18 = __toESM(require_lodash(), 1);
|
|
87127
87127
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
87128
87128
|
import assert10 from "assert";
|
|
87129
|
-
import { relative as
|
|
87129
|
+
import { relative as relative10 } from "path";
|
|
87130
87130
|
|
|
87131
87131
|
// ../utils/src/telemetry/telemetry-options-factory.ts
|
|
87132
87132
|
function createTelemetryHandler(dashboardAPI4, analysisMetadataId) {
|
|
@@ -87300,7 +87300,7 @@ import { resolve as resolve21 } from "path";
|
|
|
87300
87300
|
// ../utils/src/pip-utils.ts
|
|
87301
87301
|
import { existsSync as existsSync3 } from "node:fs";
|
|
87302
87302
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
87303
|
-
import { dirname, resolve as resolve3 } from "node:path";
|
|
87303
|
+
import { dirname, resolve as resolve3, relative as relative2 } from "node:path";
|
|
87304
87304
|
import util4 from "node:util";
|
|
87305
87305
|
|
|
87306
87306
|
// ../utils/src/command-utils.ts
|
|
@@ -88475,10 +88475,10 @@ async function downloadFile(fileUrl, outputFile) {
|
|
|
88475
88475
|
// ../utils/src/file-tree-utils.ts
|
|
88476
88476
|
import { closeSync as closeSync2, lstatSync as lstatSync2, openSync as openSync2, readdirSync as readdirSync3, readSync as readSync2 } from "fs";
|
|
88477
88477
|
import { readdir as readdir3 } from "fs/promises";
|
|
88478
|
-
import { basename as basename3, join as join7, relative as
|
|
88478
|
+
import { basename as basename3, join as join7, relative as relative4, resolve as resolve5 } from "path";
|
|
88479
88479
|
|
|
88480
88480
|
// ../utils/src/package-utils.ts
|
|
88481
|
-
import { parse as parse2, join as join6, resolve as resolve4, normalize as normalize2, dirname as dirname3, basename as basename2, relative as
|
|
88481
|
+
import { parse as parse2, join as join6, resolve as resolve4, normalize as normalize2, dirname as dirname3, basename as basename2, relative as relative3 } from "path";
|
|
88482
88482
|
import { existsSync as existsSync5, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync, writeFileSync } from "fs";
|
|
88483
88483
|
function getPackageJsonObject(workspaceRoot) {
|
|
88484
88484
|
const packageJSONContent = getPackageJsonContent(workspaceRoot);
|
|
@@ -88510,7 +88510,7 @@ async function findFilesInPythonProjectMatching(projectDir, fileMatcher, maxDept
|
|
|
88510
88510
|
if (shouldIgnoreDir(fileOrDirectory.name, projectDir === path10)) continue;
|
|
88511
88511
|
directoriesToTraverse.push(fileOrDirectory.name);
|
|
88512
88512
|
} else if (fileOrDirectory.isFile()) {
|
|
88513
|
-
if (fileMatcher(fullPath)) files.push(
|
|
88513
|
+
if (fileMatcher(fullPath)) files.push(relative4(projectDir, fullPath));
|
|
88514
88514
|
}
|
|
88515
88515
|
}
|
|
88516
88516
|
if (depthLeft === 0) return;
|
|
@@ -88528,7 +88528,7 @@ async function findFilesInPythonProjectMatching(projectDir, fileMatcher, maxDept
|
|
|
88528
88528
|
// ../utils/src/tmp-file.ts
|
|
88529
88529
|
import { rm, mkdtemp, cp as cp2, lstat as lstat2 } from "fs/promises";
|
|
88530
88530
|
import { tmpdir as tmpdir2 } from "os";
|
|
88531
|
-
import { join as join8, relative as
|
|
88531
|
+
import { join as join8, relative as relative5, sep as sep2, extname } from "path";
|
|
88532
88532
|
async function createTmpDirectory(prefix) {
|
|
88533
88533
|
try {
|
|
88534
88534
|
const tmpDir = await mkdtemp(join8(tmpdir2(), prefix));
|
|
@@ -94158,7 +94158,7 @@ function getClassGraphAnalysisCliPath() {
|
|
|
94158
94158
|
// ../utils/src/nuget-project-utils.ts
|
|
94159
94159
|
var import_parse_xml2 = __toESM(require_dist(), 1);
|
|
94160
94160
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
94161
|
-
import { dirname as dirname9, join as join11, relative as
|
|
94161
|
+
import { dirname as dirname9, join as join11, relative as relative6, resolve as resolve8, basename as basename6, extname as extname2 } from "node:path";
|
|
94162
94162
|
|
|
94163
94163
|
// ../utils/src/xml-utils.ts
|
|
94164
94164
|
var import_parse_xml = __toESM(require_dist(), 1);
|
|
@@ -95845,7 +95845,7 @@ async function loadNuGetProjectOrTarget(rootDir, projectFile, mainProject, visit
|
|
|
95845
95845
|
});
|
|
95846
95846
|
currentProject.sourceFiles.push(...files);
|
|
95847
95847
|
} catch (err) {
|
|
95848
|
-
logger.debug(`Failed to glob default pattern for ${
|
|
95848
|
+
logger.debug(`Failed to glob default pattern for ${relative6(rootDir, validatedProjectPath)}: ${err}`);
|
|
95849
95849
|
}
|
|
95850
95850
|
}
|
|
95851
95851
|
mainProject ??= currentProject;
|
|
@@ -96068,11 +96068,11 @@ async function handleCompileItem(project, child) {
|
|
|
96068
96068
|
} catch (err) {
|
|
96069
96069
|
if (evaluatedExclude) {
|
|
96070
96070
|
logger.debug(
|
|
96071
|
-
`Failed to glob Compile Include ${includePatterns}, Exclude ${excludePatterns} in ${
|
|
96071
|
+
`Failed to glob Compile Include ${includePatterns}, Exclude ${excludePatterns} in ${relative6(project.rootDir, project.validatedProjectPath)}: ${err}`
|
|
96072
96072
|
);
|
|
96073
96073
|
} else {
|
|
96074
96074
|
logger.debug(
|
|
96075
|
-
`Failed to glob Compile Include ${includePatterns} in ${
|
|
96075
|
+
`Failed to glob Compile Include ${includePatterns} in ${relative6(project.rootDir, project.validatedProjectPath)}: ${err}`
|
|
96076
96076
|
);
|
|
96077
96077
|
}
|
|
96078
96078
|
}
|
|
@@ -96092,7 +96092,7 @@ async function handleCompileItem(project, child) {
|
|
|
96092
96092
|
project.sourceFiles = project.sourceFiles.filter((f2) => !removeSet.has(f2));
|
|
96093
96093
|
} catch (err) {
|
|
96094
96094
|
logger.debug(
|
|
96095
|
-
`Failed to glob Compile Remove pattern ${evaluatedRemove} in ${
|
|
96095
|
+
`Failed to glob Compile Remove pattern ${evaluatedRemove} in ${relative6(project.rootDir, project.validatedProjectPath)}: ${err}`
|
|
96096
96096
|
);
|
|
96097
96097
|
}
|
|
96098
96098
|
}
|
|
@@ -96102,7 +96102,7 @@ function handlePropertyGroupElement(project, propertyGroup) {
|
|
|
96102
96102
|
const condition = createAttributeMap(propertyGroup, project.sourceText).get("Condition");
|
|
96103
96103
|
if (condition) {
|
|
96104
96104
|
logger.debug(
|
|
96105
|
-
`Skipping conditional property group ${propertyGroup.name} (${propertyGroup.start}, ${propertyGroup.end}) with condition ${condition.text} in file ${
|
|
96105
|
+
`Skipping conditional property group ${propertyGroup.name} (${propertyGroup.start}, ${propertyGroup.end}) with condition ${condition.text} in file ${relative6(project.rootDir, project.validatedProjectPath)}`
|
|
96106
96106
|
);
|
|
96107
96107
|
return;
|
|
96108
96108
|
}
|
|
@@ -96112,7 +96112,7 @@ function handlePropertyGroupElement(project, propertyGroup) {
|
|
|
96112
96112
|
const condition2 = createAttributeMap(propertyElement, project.sourceText).get("Condition");
|
|
96113
96113
|
if (condition2) {
|
|
96114
96114
|
logger.debug(
|
|
96115
|
-
`Skipping conditional property ${propertyElement.name} (${propertyElement.start}, ${propertyElement.end}) with condition ${condition2.text} in file ${
|
|
96115
|
+
`Skipping conditional property ${propertyElement.name} (${propertyElement.start}, ${propertyElement.end}) with condition ${condition2.text} in file ${relative6(project.rootDir, project.validatedProjectPath)}`
|
|
96116
96116
|
);
|
|
96117
96117
|
continue;
|
|
96118
96118
|
}
|
|
@@ -96153,7 +96153,7 @@ function evaluate(expression, project) {
|
|
|
96153
96153
|
function evaluateWithContext(value2, depth) {
|
|
96154
96154
|
if (depth > 50) {
|
|
96155
96155
|
logger.warn(
|
|
96156
|
-
`Recursion limit hit while evaluating expression ${expression} in project ${
|
|
96156
|
+
`Recursion limit hit while evaluating expression ${expression} in project ${relative6(project.rootDir, project.validatedProjectPath)}`
|
|
96157
96157
|
);
|
|
96158
96158
|
isFullyEvaluated = false;
|
|
96159
96159
|
return value2;
|
|
@@ -96164,7 +96164,7 @@ function evaluate(expression, project) {
|
|
|
96164
96164
|
return evaluateWithContext(property.text, depth + 1);
|
|
96165
96165
|
} else {
|
|
96166
96166
|
logger.debug(
|
|
96167
|
-
`Unknown property ${propertyName} for project ${
|
|
96167
|
+
`Unknown property ${propertyName} for project ${relative6(project.rootDir, project.validatedProjectPath)}`
|
|
96168
96168
|
);
|
|
96169
96169
|
isFullyEvaluated = false;
|
|
96170
96170
|
return "";
|
|
@@ -98255,10 +98255,10 @@ function compareDocumentPosition(nodeA, nodeB) {
|
|
|
98255
98255
|
function uniqueSort(nodes) {
|
|
98256
98256
|
nodes = nodes.filter((node, i4, arr) => !arr.includes(node, i4 + 1));
|
|
98257
98257
|
nodes.sort((a2, b) => {
|
|
98258
|
-
const
|
|
98259
|
-
if (
|
|
98258
|
+
const relative15 = compareDocumentPosition(a2, b);
|
|
98259
|
+
if (relative15 & DocumentPosition.PRECEDING) {
|
|
98260
98260
|
return -1;
|
|
98261
|
-
} else if (
|
|
98261
|
+
} else if (relative15 & DocumentPosition.FOLLOWING) {
|
|
98262
98262
|
return 1;
|
|
98263
98263
|
}
|
|
98264
98264
|
return 0;
|
|
@@ -111052,11 +111052,11 @@ function computePackagesOnVulnPath(vulnerabilities, { includeLeafPackages = fals
|
|
|
111052
111052
|
var import_lodash10 = __toESM(require_lodash(), 1);
|
|
111053
111053
|
import assert4 from "assert";
|
|
111054
111054
|
import { readFile as readFile10, realpath as realpath2, rm as rm3, writeFile as writeFile7 } from "fs/promises";
|
|
111055
|
-
import { relative as
|
|
111055
|
+
import { relative as relative8, resolve as resolve14 } from "path";
|
|
111056
111056
|
|
|
111057
111057
|
// dist/whole-program-code-aware-vulnerability-scanner/js/js-analysis-engine.js
|
|
111058
111058
|
import { readFile as readFile9, rm as rm2 } from "fs/promises";
|
|
111059
|
-
import { relative as
|
|
111059
|
+
import { relative as relative7, resolve as resolve13 } from "path";
|
|
111060
111060
|
var JSAnalysisEngine = class {
|
|
111061
111061
|
/** Run import graph reachability analysis */
|
|
111062
111062
|
async runImportReachabilityAnalysis(mainProjectRoot, projectRoot, vulnerabilities, options, telemetryHandler, analyzerTelemetryHandler) {
|
|
@@ -111094,7 +111094,7 @@ var JSAnalysisEngine = class {
|
|
|
111094
111094
|
};
|
|
111095
111095
|
function getExcludes(mainProjectRoot, projectRoot, options) {
|
|
111096
111096
|
if (options.excludeDirs?.length) {
|
|
111097
|
-
const excludeDirsRelativeToProjectRoot = options.excludeDirs.map((d) =>
|
|
111097
|
+
const excludeDirsRelativeToProjectRoot = options.excludeDirs.map((d) => relative7(projectRoot, resolve13(mainProjectRoot, d)));
|
|
111098
111098
|
const excludeDirsRelativeToProjectRootWithWildcards = excludeDirsRelativeToProjectRoot.map((d) => `${d}/**`);
|
|
111099
111099
|
return ["--exclude-entries", ...excludeDirsRelativeToProjectRoot, ...excludeDirsRelativeToProjectRootWithWildcards];
|
|
111100
111100
|
}
|
|
@@ -111241,7 +111241,7 @@ function relativizeSourceLocations(projectDir, paths) {
|
|
|
111241
111241
|
...paths,
|
|
111242
111242
|
stacks: paths.stacks.map((stack) => stack.map((s2) => ({
|
|
111243
111243
|
...s2,
|
|
111244
|
-
sourceLocation: { ...s2.sourceLocation, filename:
|
|
111244
|
+
sourceLocation: { ...s2.sourceLocation, filename: relative8(projectDir, s2.sourceLocation.filename) }
|
|
111245
111245
|
})))
|
|
111246
111246
|
};
|
|
111247
111247
|
}
|
|
@@ -111260,7 +111260,7 @@ import zlib2 from "node:zlib";
|
|
|
111260
111260
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
111261
111261
|
import { createReadStream as createReadStream2, createWriteStream as createWriteStream4 } from "node:fs";
|
|
111262
111262
|
import { readFile as readFile11, realpath as realpath3, rm as rm4, writeFile as writeFile8 } from "node:fs/promises";
|
|
111263
|
-
import { dirname as dirname13, join as join14, relative as
|
|
111263
|
+
import { dirname as dirname13, join as join14, relative as relative9, resolve as resolve15 } from "node:path";
|
|
111264
111264
|
import assert6 from "assert";
|
|
111265
111265
|
var import_lodash11 = __toESM(require_lodash(), 1);
|
|
111266
111266
|
|
|
@@ -111975,7 +111975,7 @@ var SparJSAnalysisEngine = class extends JSAnalysisEngine {
|
|
|
111975
111975
|
package: s2.package,
|
|
111976
111976
|
sourceLocation: {
|
|
111977
111977
|
...pick(s2, "start", "end"),
|
|
111978
|
-
filename:
|
|
111978
|
+
filename: relative9(realProjectRoot, s2.file)
|
|
111979
111979
|
},
|
|
111980
111980
|
confidence: 0
|
|
111981
111981
|
}))));
|
|
@@ -113957,7 +113957,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
113957
113957
|
let analysisNumber = 0;
|
|
113958
113958
|
const newAnalysisRunListener = () => statusUpdater?.(`Static analysis run number ${++analysisNumber} in progress...`);
|
|
113959
113959
|
const ecosystem = vulnerabilities[0].ecosystem ?? "NPM";
|
|
113960
|
-
const expHeuristicName = process.env.ONLY_APPLICATION_SOURCE_FILES_FOR_KNOWN_LANGUAGES === "true" ? "ONLY_APPLICATION_SOURCE_FILES_FOR_KNOWN_LANGUAGES" : await getExperimentName(
|
|
113960
|
+
const expHeuristicName = process.env.ONLY_APPLICATION_SOURCE_FILES_FOR_KNOWN_LANGUAGES === "true" ? "ONLY_APPLICATION_SOURCE_FILES_FOR_KNOWN_LANGUAGES" : await getExperimentName(relative10(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, ecosystem, COANA_REPORT_ID, apiKey);
|
|
113961
113961
|
let bucketsToAnalyze = state.otherAnalysisOptions.lightweightReachability ? void 0 : await getBucketsBasedOnPreviousResults();
|
|
113962
113962
|
let useExperimentalHeuristic = Boolean(expHeuristicName && bucketsToAnalyze);
|
|
113963
113963
|
if (!bucketsToAnalyze)
|
|
@@ -113992,7 +113992,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
113992
113992
|
}
|
|
113993
113993
|
async function analyzeWithExperimentalHeuristic(buckets) {
|
|
113994
113994
|
try {
|
|
113995
|
-
const previousAnalysisResults = await getPreviousAnalysisResults(
|
|
113995
|
+
const previousAnalysisResults = await getPreviousAnalysisResults(relative10(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, COANA_REPORT_ID, apiKey);
|
|
113996
113996
|
if (!expHeuristicName || !previousAnalysisResults)
|
|
113997
113997
|
return;
|
|
113998
113998
|
const experimentalRes = await analyzeAndAugmentVulns(buckets, void 0, true, expHeuristicName);
|
|
@@ -114041,7 +114041,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
114041
114041
|
} catch (e) {
|
|
114042
114042
|
logger.warn("Error while running experimental heuristic - scan will continue in normal mode.", e);
|
|
114043
114043
|
sendWarningToDashboard("Error while running experimental heuristic", {
|
|
114044
|
-
subprojectPath:
|
|
114044
|
+
subprojectPath: relative10(state.rootWorkingDir, state.subprojectDir) || ".",
|
|
114045
114045
|
workspacePath: state.workspacePath,
|
|
114046
114046
|
errorMessage: e.message,
|
|
114047
114047
|
errorStack: e.stack
|
|
@@ -114052,7 +114052,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
114052
114052
|
async function getBucketsBasedOnPreviousResults() {
|
|
114053
114053
|
if (state.otherAnalysisOptions.skipCacheUsage || !SOCKET_MODE && (!COANA_REPORT_ID || apiKey.type === "missing"))
|
|
114054
114054
|
return void 0;
|
|
114055
|
-
const bucketsFromLastAnalysisAndCliVersion = await dashboardAPI.getBucketsForLastReport(
|
|
114055
|
+
const bucketsFromLastAnalysisAndCliVersion = await dashboardAPI.getBucketsForLastReport(relative10(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, vulnerabilities[0].ecosystem ?? "NPM", COANA_REPORT_ID, apiKey);
|
|
114056
114056
|
if (!bucketsFromLastAnalysisAndCliVersion)
|
|
114057
114057
|
return void 0;
|
|
114058
114058
|
const { cliVersion: cliVersion2, buckets: rawBucketsFromLastAnalysis } = bucketsFromLastAnalysisAndCliVersion;
|
|
@@ -114068,7 +114068,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
114068
114068
|
const duplicateUrls = findDuplicateVulnsInBuckets(bucketsFromLastAnalysis);
|
|
114069
114069
|
if (duplicateUrls.length > 0) {
|
|
114070
114070
|
sendWarningToDashboard(`Assertion error: Detected bucket(s) with non-unique vulnerability URLs. Non-unique URLs: ${duplicateUrls.join(" ")}.`, {
|
|
114071
|
-
subprojectPath:
|
|
114071
|
+
subprojectPath: relative10(state.rootWorkingDir, state.subprojectDir) || ".",
|
|
114072
114072
|
workspacePath: state.workspacePath
|
|
114073
114073
|
}, bucketsFromLastAnalysisAndCliVersion, COANA_REPORT_ID, apiKey);
|
|
114074
114074
|
return void 0;
|
|
@@ -114120,7 +114120,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
114120
114120
|
const vulnDepIdentifierToVulns = groupBy(bucket.vulnerabilities, getVulnDepIdentifier);
|
|
114121
114121
|
const vulnDepIdentifiers = Object.keys(vulnDepIdentifierToVulns);
|
|
114122
114122
|
const ghsaIds = extractGhsaIdsFromVulnUrls(vulnsForBucket.map((v) => v.url));
|
|
114123
|
-
const analysisMetadataId = COANA_REPORT_ID ? await dashboardAPI.createAnalysisMetadata(COANA_REPORT_ID,
|
|
114123
|
+
const analysisMetadataId = COANA_REPORT_ID ? await dashboardAPI.createAnalysisMetadata(COANA_REPORT_ID, relative10(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, ecosystem, ghsaIds, bucket.heuristic.name, experiment) : void 0;
|
|
114124
114124
|
try {
|
|
114125
114125
|
newAnalysisRunListener();
|
|
114126
114126
|
const initialBucketContainingAllVulns = buckets.length === 1 && buckets[0] === bucket;
|
|
@@ -114214,7 +114214,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
114214
114214
|
const oldMd = oldAnalysisMetadata.find((oldMd2) => newMd.vulnUrls.some((vulnUrl) => oldMd2.vulnUrls.includes(vulnUrl)));
|
|
114215
114215
|
if (!oldMd) {
|
|
114216
114216
|
await sendWarningToDashboard("Could not find corresponding analysis metadata to compare time regressions with", {
|
|
114217
|
-
subprojectPath:
|
|
114217
|
+
subprojectPath: relative10(state.rootWorkingDir, state.subprojectDir) || ".",
|
|
114218
114218
|
workspacePath: state.workspacePath
|
|
114219
114219
|
}, void 0, COANA_REPORT_ID, apiKey);
|
|
114220
114220
|
continue;
|
|
@@ -114240,7 +114240,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
114240
114240
|
}
|
|
114241
114241
|
if (regressions.length === 0)
|
|
114242
114242
|
return;
|
|
114243
|
-
await sendRegressionsToDashboard(regressions,
|
|
114243
|
+
await sendRegressionsToDashboard(regressions, relative10(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, COANA_REPORT_ID, apiKey);
|
|
114244
114244
|
}
|
|
114245
114245
|
async function sendReachabilityRegressionsToDashboard(heuristicName, experimentName, origRes, experimentRes, ignoredVulnerabilities) {
|
|
114246
114246
|
const regressions = Object.entries(origRes).filter(([vulnUrl]) => !ignoredVulnerabilities.has(vulnUrl)).filter(([vulnUrl, oRes]) => experimentRes[vulnUrl] && oRes.reachability !== experimentRes[vulnUrl].reachability).map(([vulnUrl, originalResult]) => ({
|
|
@@ -114252,7 +114252,7 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
|
|
|
114252
114252
|
originalResult,
|
|
114253
114253
|
experimentResult: experimentRes[vulnUrl]
|
|
114254
114254
|
}));
|
|
114255
|
-
await sendRegressionsToDashboard(regressions,
|
|
114255
|
+
await sendRegressionsToDashboard(regressions, relative10(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, COANA_REPORT_ID, apiKey);
|
|
114256
114256
|
}
|
|
114257
114257
|
}
|
|
114258
114258
|
function getHeuristicFromName(state, heuristicName, ecosystem) {
|
|
@@ -114445,7 +114445,7 @@ async function downloadAndExtractComposerPackage(namespace2, name2, version3, ve
|
|
|
114445
114445
|
// dist/whole-program-code-aware-vulnerability-scanner/php/spar-php-runner.js
|
|
114446
114446
|
import { createReadStream as createReadStream4, createWriteStream as createWriteStream6, existsSync as existsSync17 } from "fs";
|
|
114447
114447
|
import { readFile as readFile15, realpath as realpath4, rm as rm9, writeFile as writeFile12 } from "fs/promises";
|
|
114448
|
-
import { join as join20, relative as
|
|
114448
|
+
import { join as join20, relative as relative11 } from "path";
|
|
114449
114449
|
import { pipeline as pipeline4 } from "stream/promises";
|
|
114450
114450
|
import zlib4 from "zlib";
|
|
114451
114451
|
async function runSparPhpAnalysis(projectDir, vulns, includePackages, timeoutInSeconds, telemetryHandler, analyzerTelemetryHandler) {
|
|
@@ -114547,13 +114547,13 @@ ${stderr}`);
|
|
|
114547
114547
|
}
|
|
114548
114548
|
function normalizeFilename(file, pkg, realProjectRoot, realVendorRoot) {
|
|
114549
114549
|
if (pkg) {
|
|
114550
|
-
const relToVendor =
|
|
114550
|
+
const relToVendor = relative11(realVendorRoot, file);
|
|
114551
114551
|
const pkgPrefix = `${pkg}/`;
|
|
114552
114552
|
if (!relToVendor.startsWith("..") && relToVendor.startsWith(pkgPrefix)) {
|
|
114553
114553
|
return relToVendor.substring(pkgPrefix.length);
|
|
114554
114554
|
}
|
|
114555
114555
|
}
|
|
114556
|
-
return
|
|
114556
|
+
return relative11(realProjectRoot, file);
|
|
114557
114557
|
}
|
|
114558
114558
|
|
|
114559
114559
|
// dist/whole-program-code-aware-vulnerability-scanner/php/php-code-aware-vulnerability-scanner.js
|
|
@@ -114926,7 +114926,7 @@ var import_lodash22 = __toESM(require_lodash(), 1);
|
|
|
114926
114926
|
var import_picomatch4 = __toESM(require_picomatch2(), 1);
|
|
114927
114927
|
import { existsSync as existsSync20 } from "fs";
|
|
114928
114928
|
import { rm as rm11 } from "fs/promises";
|
|
114929
|
-
import { relative as
|
|
114929
|
+
import { relative as relative12, resolve as resolve25 } from "path";
|
|
114930
114930
|
|
|
114931
114931
|
// ../web-compat-utils/src/pluralize.ts
|
|
114932
114932
|
function pluralize(count, word) {
|
|
@@ -114990,7 +114990,7 @@ var NpmAnalyzer = class {
|
|
|
114990
114990
|
logger.info(`Running import reachability analysis for ${vulns.length} ${pluralize(vulns.length, "vulnerability")}`);
|
|
114991
114991
|
let reachable;
|
|
114992
114992
|
const ghsaIds = extractGhsaIdsFromVulnUrls(vulns.map((v) => v.url));
|
|
114993
|
-
const importAnalysisMetadataId = COANA_REPORT_ID ? await dashboardAPI2.createAnalysisMetadata(COANA_REPORT_ID,
|
|
114993
|
+
const importAnalysisMetadataId = COANA_REPORT_ID ? await dashboardAPI2.createAnalysisMetadata(COANA_REPORT_ID, relative12(this.state.rootWorkingDir, this.state.subprojectDir) || ".", this.state.workspacePath, "NPM", ghsaIds, heuristics.IMPORT_REACHABILITY.name) : void 0;
|
|
114994
114994
|
if (COANA_REPORT_ID && !importAnalysisMetadataId) {
|
|
114995
114995
|
logger.debug("Failed to create analysis metadata for import analysis");
|
|
114996
114996
|
}
|
|
@@ -115210,7 +115210,7 @@ import { resolve as resolve26 } from "path";
|
|
|
115210
115210
|
var import_lodash23 = __toESM(require_lodash(), 1);
|
|
115211
115211
|
import { createWriteStream as createWriteStream7, existsSync as existsSync21 } from "fs";
|
|
115212
115212
|
import { mkdir as mkdir11, readdir as readdir8, readFile as readFile16, rm as rm12 } from "fs/promises";
|
|
115213
|
-
import { join as join22, relative as
|
|
115213
|
+
import { join as join22, relative as relative13 } from "path";
|
|
115214
115214
|
import { pipeline as pipeline5 } from "stream/promises";
|
|
115215
115215
|
var PRINT_ANALYSIS_COMMAND = false;
|
|
115216
115216
|
var { uniqBy: uniqBy3, sortedUniq: sortedUniq2 } = import_lodash23.default;
|
|
@@ -115303,7 +115303,7 @@ var RubyCodeAwareVulnerabilityScanner = class {
|
|
|
115303
115303
|
telemetryHandler
|
|
115304
115304
|
});
|
|
115305
115305
|
const result = JSON.parse(await readFile16(vulnsOutputFile, "utf-8"));
|
|
115306
|
-
const relativeLoadPathsToPackageNames = new Map([...loadPathsToPackageNames.entries()].map(([k, v]) => [join22("vendor",
|
|
115306
|
+
const relativeLoadPathsToPackageNames = new Map([...loadPathsToPackageNames.entries()].map(([k, v]) => [join22("vendor", relative13(this.vendorDir, k)), v]));
|
|
115307
115307
|
const { timedOut, ...diagnostics } = JSON.parse(await readFile16(diagnosticsOutputFile, "utf-8"));
|
|
115308
115308
|
const reachedPackages = JSON.parse(await readFile16(reachedPackagesOutputFile, "utf-8"));
|
|
115309
115309
|
logger.debug("Reached packages: %O", reachedPackages);
|
|
@@ -115607,7 +115607,7 @@ var dashboardAPI3 = new DashboardAPI(process.env.SOCKET_MODE === "true", process
|
|
|
115607
115607
|
async function installDependenciesForAnalysis(state, preinstallDir) {
|
|
115608
115608
|
const projectDir = resolve27(state.subprojectDir, state.workspacePath);
|
|
115609
115609
|
const ecosystem = state.workspaceData.data.type;
|
|
115610
|
-
logger.info(`Pre-installing dependencies for project at "${
|
|
115610
|
+
logger.info(`Pre-installing dependencies for project at "${relative14(state.rootWorkingDir, projectDir) || "."}" (${ecosystem})`);
|
|
115611
115611
|
const constructor = ecosystemAnalyzer[ecosystem];
|
|
115612
115612
|
if (!constructor)
|
|
115613
115613
|
throw Error(`No analyzer associated with ecosystem ${ecosystem}`);
|
|
@@ -115618,14 +115618,14 @@ async function installDependenciesForAnalysis(state, preinstallDir) {
|
|
|
115618
115618
|
async function runReachabilityAnalysis(state) {
|
|
115619
115619
|
const projectDir = resolve27(state.subprojectDir, state.workspacePath);
|
|
115620
115620
|
const ecosystem = state.workspaceData.data.type;
|
|
115621
|
-
logger.info(`Preparing to run reachability analysis for project at "${
|
|
115621
|
+
logger.info(`Preparing to run reachability analysis for project at "${relative14(state.rootWorkingDir, projectDir) || "."}" (${ecosystem})`);
|
|
115622
115622
|
const constructor = ecosystemAnalyzer[ecosystem];
|
|
115623
115623
|
if (!constructor)
|
|
115624
115624
|
throw Error(`No analyzer associated with ecosystem ${ecosystem}`);
|
|
115625
115625
|
const analyzer = new constructor(state, projectDir);
|
|
115626
115626
|
const [vulnerabilitiesWithPrecomputedResults, vulnerabilitiesWithoutPrecomputedResults] = partition4(state.vulnerabilities, (v) => "results" in v);
|
|
115627
115627
|
const augmentedVulnerabilities = await runWholeProgramCodeAwareVulnerabilityScanner(analyzer, vulnerabilitiesWithoutPrecomputedResults, async (amd) => {
|
|
115628
|
-
await dashboardAPI3.registerAnalysisMetadata(
|
|
115628
|
+
await dashboardAPI3.registerAnalysisMetadata(relative14(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, state.workspaceData.data.type, amd, COANA_REPORT_ID, apiKey2);
|
|
115629
115629
|
});
|
|
115630
115630
|
const diagnostics = await analyzer.getWorkspaceDiagnostics();
|
|
115631
115631
|
return {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|