cognium-dev 3.166.0 → 3.167.0
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/dist/cli.js +93 -21
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -19132,6 +19132,9 @@ function classifyJsTsEntryPoint(method, enclosingType, ctx) {
|
|
|
19132
19132
|
if (methodIsRuntimeRegistrationHandler(method, ctx.runtimeRegistrations)) {
|
|
19133
19133
|
return "TIER_1_ENTRY_POINT";
|
|
19134
19134
|
}
|
|
19135
|
+
if (fileHasJsTsFrameworkRegistration(ctx.runtimeRegistrations) && (!enclosingType || looksLikeModuleType(enclosingType))) {
|
|
19136
|
+
return "TIER_1_ENTRY_POINT";
|
|
19137
|
+
}
|
|
19135
19138
|
if (JSTS_TIER_1_MODULE_EXPORTS.has(method.name) && (!enclosingType || looksLikeModuleType(enclosingType))) {
|
|
19136
19139
|
return "TIER_1_ENTRY_POINT";
|
|
19137
19140
|
}
|
|
@@ -19140,6 +19143,25 @@ function classifyJsTsEntryPoint(method, enclosingType, ctx) {
|
|
|
19140
19143
|
}
|
|
19141
19144
|
return "TIER_UNKNOWN";
|
|
19142
19145
|
}
|
|
19146
|
+
var JSTS_FILE_LEVEL_TIER_1_FRAMEWORKS = new Set([
|
|
19147
|
+
"express",
|
|
19148
|
+
"fastify",
|
|
19149
|
+
"koa",
|
|
19150
|
+
"nestjs"
|
|
19151
|
+
]);
|
|
19152
|
+
function fileHasJsTsFrameworkRegistration(regs) {
|
|
19153
|
+
if (!regs || regs.length === 0)
|
|
19154
|
+
return false;
|
|
19155
|
+
for (const reg of regs) {
|
|
19156
|
+
if (reg.kind !== "http_route" && reg.kind !== "middleware" && reg.kind !== "event_listener") {
|
|
19157
|
+
continue;
|
|
19158
|
+
}
|
|
19159
|
+
if (reg.framework && JSTS_FILE_LEVEL_TIER_1_FRAMEWORKS.has(reg.framework)) {
|
|
19160
|
+
return true;
|
|
19161
|
+
}
|
|
19162
|
+
}
|
|
19163
|
+
return false;
|
|
19164
|
+
}
|
|
19143
19165
|
var GO_HTTP_REGISTRAR_METHODS = new Set([
|
|
19144
19166
|
"HandleFunc",
|
|
19145
19167
|
"Handle",
|
|
@@ -19389,6 +19411,7 @@ var TAINT_FLOW_RULE_IDS = new Set([
|
|
|
19389
19411
|
"mybatis_mapper_call",
|
|
19390
19412
|
"external_taint_escape",
|
|
19391
19413
|
"template_injection",
|
|
19414
|
+
"xml_entity_expansion",
|
|
19392
19415
|
"sql-injection",
|
|
19393
19416
|
"nosql-injection",
|
|
19394
19417
|
"command-injection",
|
|
@@ -19401,7 +19424,8 @@ var TAINT_FLOW_RULE_IDS = new Set([
|
|
|
19401
19424
|
"format-string",
|
|
19402
19425
|
"mass-assignment",
|
|
19403
19426
|
"template-injection",
|
|
19404
|
-
"insecure-deserialization"
|
|
19427
|
+
"insecure-deserialization",
|
|
19428
|
+
"xml-entity-expansion"
|
|
19405
19429
|
]);
|
|
19406
19430
|
function applyRequireEntryPath(fileAnalyses, options = {}) {
|
|
19407
19431
|
const disabledSet = normalizeDisabled(options.disabledPasses);
|
|
@@ -19415,30 +19439,78 @@ function applyRequireEntryPath(fileAnalyses, options = {}) {
|
|
|
19415
19439
|
const entryPointKeysByLanguage = countEntryPointKeysByLanguage(graph, entryPointKeys);
|
|
19416
19440
|
const profileResolver = makeProfileResolver(options.projectProfile);
|
|
19417
19441
|
for (const fa of fileAnalyses) {
|
|
19442
|
+
const profile = profileResolver(fa.file);
|
|
19418
19443
|
const findings = fa.analysis.findings;
|
|
19419
|
-
if (
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19444
|
+
if (findings && findings.length > 0) {
|
|
19445
|
+
const kept = [];
|
|
19446
|
+
for (const finding of findings) {
|
|
19447
|
+
const decision = classifyFinding(finding, fa.analysis, graph, entryPointKeys, entryPointKeysByLanguage, profile);
|
|
19448
|
+
switch (decision.action) {
|
|
19449
|
+
case "keep":
|
|
19450
|
+
kept.push(finding);
|
|
19451
|
+
break;
|
|
19452
|
+
case "annotate":
|
|
19453
|
+
kept.push({
|
|
19454
|
+
...finding,
|
|
19455
|
+
entryPath: decision.entryPath,
|
|
19456
|
+
entryPathTier: decision.tier
|
|
19457
|
+
});
|
|
19458
|
+
break;
|
|
19459
|
+
case "drop":
|
|
19460
|
+
break;
|
|
19461
|
+
}
|
|
19437
19462
|
}
|
|
19463
|
+
fa.analysis.findings = kept.length > 0 ? kept : undefined;
|
|
19464
|
+
}
|
|
19465
|
+
const flows = fa.analysis.taint?.flows;
|
|
19466
|
+
if (flows && flows.length > 0) {
|
|
19467
|
+
const keptFlows = [];
|
|
19468
|
+
for (const flow of flows) {
|
|
19469
|
+
const pseudo = flowToPseudoFinding(fa.file, flow);
|
|
19470
|
+
if (!pseudo) {
|
|
19471
|
+
keptFlows.push(flow);
|
|
19472
|
+
continue;
|
|
19473
|
+
}
|
|
19474
|
+
const decision = classifyFinding(pseudo, fa.analysis, graph, entryPointKeys, entryPointKeysByLanguage, profile);
|
|
19475
|
+
if (decision.action !== "drop")
|
|
19476
|
+
keptFlows.push(flow);
|
|
19477
|
+
}
|
|
19478
|
+
fa.analysis.taint.flows = keptFlows;
|
|
19438
19479
|
}
|
|
19439
|
-
fa.analysis.findings = kept.length > 0 ? kept : undefined;
|
|
19440
19480
|
}
|
|
19441
19481
|
}
|
|
19482
|
+
var SINK_HC_SEVERITY = {
|
|
19483
|
+
sql_injection: "critical",
|
|
19484
|
+
nosql_injection: "high",
|
|
19485
|
+
command_injection: "critical",
|
|
19486
|
+
path_traversal: "high",
|
|
19487
|
+
xss: "high",
|
|
19488
|
+
xxe: "critical",
|
|
19489
|
+
deserialization: "critical",
|
|
19490
|
+
ldap_injection: "high",
|
|
19491
|
+
xpath_injection: "high",
|
|
19492
|
+
ssrf: "high",
|
|
19493
|
+
code_injection: "critical",
|
|
19494
|
+
format_string: "high",
|
|
19495
|
+
mass_assignment: "high"
|
|
19496
|
+
};
|
|
19497
|
+
function flowToPseudoFinding(file, flow) {
|
|
19498
|
+
const severity = SINK_HC_SEVERITY[flow.sink_type];
|
|
19499
|
+
if (!severity)
|
|
19500
|
+
return null;
|
|
19501
|
+
return {
|
|
19502
|
+
id: `taint-flow:${file}:${flow.sink_line}:${flow.sink_type}`,
|
|
19503
|
+
pass: "taint-propagation",
|
|
19504
|
+
category: "security",
|
|
19505
|
+
rule_id: flow.sink_type,
|
|
19506
|
+
cwe: "",
|
|
19507
|
+
severity,
|
|
19508
|
+
level: "error",
|
|
19509
|
+
message: `${flow.sink_type} at line ${flow.sink_line}`,
|
|
19510
|
+
file,
|
|
19511
|
+
line: flow.sink_line
|
|
19512
|
+
};
|
|
19513
|
+
}
|
|
19442
19514
|
function buildProjectMethodGraph(fileAnalyses) {
|
|
19443
19515
|
const methodsByKey = new Map;
|
|
19444
19516
|
const methodsByName = new Map;
|
|
@@ -44462,7 +44534,7 @@ var colors = {
|
|
|
44462
44534
|
};
|
|
44463
44535
|
|
|
44464
44536
|
// src/version.ts
|
|
44465
|
-
var version = "3.
|
|
44537
|
+
var version = "3.167.0";
|
|
44466
44538
|
|
|
44467
44539
|
// src/formatters.ts
|
|
44468
44540
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.167.0",
|
|
4
4
|
"description": "Static Application Security Testing CLI for detecting security vulnerabilities via taint tracking",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@cognium/project-profile-detect": "^1.1.0",
|
|
69
|
-
"circle-ir": "^3.
|
|
69
|
+
"circle-ir": "^3.167.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|