cognium-dev 3.166.1 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +90 -20
  2. 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",
@@ -19417,30 +19439,78 @@ function applyRequireEntryPath(fileAnalyses, options = {}) {
19417
19439
  const entryPointKeysByLanguage = countEntryPointKeysByLanguage(graph, entryPointKeys);
19418
19440
  const profileResolver = makeProfileResolver(options.projectProfile);
19419
19441
  for (const fa of fileAnalyses) {
19442
+ const profile = profileResolver(fa.file);
19420
19443
  const findings = fa.analysis.findings;
19421
- if (!findings || findings.length === 0)
19422
- continue;
19423
- const kept = [];
19424
- for (const finding of findings) {
19425
- const decision = classifyFinding(finding, fa.analysis, graph, entryPointKeys, entryPointKeysByLanguage, profileResolver(fa.file));
19426
- switch (decision.action) {
19427
- case "keep":
19428
- kept.push(finding);
19429
- break;
19430
- case "annotate":
19431
- kept.push({
19432
- ...finding,
19433
- entryPath: decision.entryPath,
19434
- entryPathTier: decision.tier
19435
- });
19436
- break;
19437
- case "drop":
19438
- break;
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
+ }
19439
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;
19440
19479
  }
19441
- fa.analysis.findings = kept.length > 0 ? kept : undefined;
19442
19480
  }
19443
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
+ }
19444
19514
  function buildProjectMethodGraph(fileAnalyses) {
19445
19515
  const methodsByKey = new Map;
19446
19516
  const methodsByName = new Map;
@@ -44464,7 +44534,7 @@ var colors = {
44464
44534
  };
44465
44535
 
44466
44536
  // src/version.ts
44467
- var version = "3.166.1";
44537
+ var version = "3.167.0";
44468
44538
 
44469
44539
  // src/formatters.ts
44470
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.166.1",
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.166.1"
69
+ "circle-ir": "^3.167.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",