cognium-dev 3.157.0 → 3.158.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 +75 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -18898,6 +18898,42 @@ function shouldGateInterproceduralParam(sourceType, enclosingMethod, enclosingTy
18898
18898
  // ../circle-ir/dist/analysis/require-entry-path.js
18899
18899
  var RULE_ID_REQUIRE_ENTRY_PATH = "require-entry-path";
18900
18900
  var MAX_VISITED_METHODS = 2000;
18901
+ var TAINT_FLOW_RULE_IDS = new Set([
18902
+ "sql_injection",
18903
+ "nosql_injection",
18904
+ "command_injection",
18905
+ "path_traversal",
18906
+ "xss",
18907
+ "xxe",
18908
+ "deserialization",
18909
+ "insecure_deserialization",
18910
+ "ldap_injection",
18911
+ "xpath_injection",
18912
+ "ssrf",
18913
+ "open_redirect",
18914
+ "code_injection",
18915
+ "log_injection",
18916
+ "redos",
18917
+ "format_string",
18918
+ "crlf",
18919
+ "mass_assignment",
18920
+ "mybatis_mapper_call",
18921
+ "external_taint_escape",
18922
+ "template_injection",
18923
+ "sql-injection",
18924
+ "nosql-injection",
18925
+ "command-injection",
18926
+ "path-traversal",
18927
+ "ldap-injection",
18928
+ "xpath-injection",
18929
+ "open-redirect",
18930
+ "code-injection",
18931
+ "log-injection",
18932
+ "format-string",
18933
+ "mass-assignment",
18934
+ "template-injection",
18935
+ "insecure-deserialization"
18936
+ ]);
18901
18937
  function applyRequireEntryPath(fileAnalyses, options = {}) {
18902
18938
  const disabledSet = normalizeDisabled(options.disabledPasses);
18903
18939
  if (disabledSet.has(RULE_ID_REQUIRE_ENTRY_PATH))
@@ -19033,6 +19069,8 @@ function collectEntryPointKeys(graph) {
19033
19069
  function classifyFinding(finding, ir, graph, entryPointKeys, profile) {
19034
19070
  if (finding.category !== "security")
19035
19071
  return { action: "keep" };
19072
+ if (!TAINT_FLOW_RULE_IDS.has(finding.rule_id))
19073
+ return { action: "keep" };
19036
19074
  const isHighOrCritical = finding.severity === "high" || finding.severity === "critical";
19037
19075
  const language = (ir.meta.language ?? "").toLowerCase();
19038
19076
  if (language !== "java")
@@ -30415,6 +30453,30 @@ class SinkFilterPass {
30415
30453
  }
30416
30454
  if (language === "java") {
30417
30455
  const sourceLines = ctx.code.split(`
30456
+ `);
30457
+ filtered = filtered.filter((sink) => {
30458
+ if (sink.type !== "xss")
30459
+ return true;
30460
+ const sinkLineText = sourceLines[sink.line - 1] ?? "";
30461
+ const receiverMatch = sinkLineText.match(/\b(\w+)\s*\.\s*(\w+)\s*\(/);
30462
+ const receiver = receiverMatch?.[1];
30463
+ const method = sink.method ?? receiverMatch?.[2];
30464
+ if ((method === "render" || method === "process" || method === "merge" || method === "renderTo" || method === "apply") && receiver) {
30465
+ const recvType = resolveJavaReceiverType(receiver, sink.line, sourceLines);
30466
+ if (recvType && COMPILED_TEMPLATE_TYPES.has(recvType))
30467
+ return false;
30468
+ if (recvType && TEMPLATE_ENGINE_LITERAL_TARGETS.has(recvType)) {
30469
+ const args2 = extractJavaCallArgs(method, sinkLineText);
30470
+ if (args2 !== null && args2.length >= 1 && isJavaLiteralOrAnnotationAccessor(args2[0])) {
30471
+ return false;
30472
+ }
30473
+ }
30474
+ }
30475
+ return true;
30476
+ });
30477
+ }
30478
+ if (language === "java") {
30479
+ const sourceLines = ctx.code.split(`
30418
30480
  `);
30419
30481
  filtered = filtered.filter((sink) => {
30420
30482
  if (sink.type !== "command_injection")
@@ -38674,10 +38736,22 @@ var TEST_PATH_PATTERNS = [
38674
38736
  /\.spec\.(?:tsx?|jsx?|mjs|cjs)$/i,
38675
38737
  /\.test\.(?:java|kt)$/i
38676
38738
  ];
38739
+ var JVM_TEST_FILE_PATTERNS = [
38740
+ /(?:^|\/)[A-Za-z_]\w*(?:Test|Tests|Spec|IT|ITCase|TestCase)\.(?:java|kt|scala|groovy)$/,
38741
+ /(?:^|\/)[A-Za-z_]\w*\.(?:test|spec)\.(?:java|kt|scala|groovy)$/i
38742
+ ];
38743
+ var JVM_SOURCE_FILE_RE = /\.(?:java|kt|scala|groovy)$/i;
38677
38744
  function isTestPath(filepath) {
38678
38745
  if (!filepath)
38679
38746
  return false;
38680
38747
  const normalized = filepath.replace(/\\/g, "/");
38748
+ if (JVM_SOURCE_FILE_RE.test(normalized)) {
38749
+ for (const pattern of JVM_TEST_FILE_PATTERNS) {
38750
+ if (pattern.test(normalized))
38751
+ return true;
38752
+ }
38753
+ return false;
38754
+ }
38681
38755
  for (const pattern of TEST_PATH_PATTERNS) {
38682
38756
  if (pattern.test(normalized))
38683
38757
  return true;
@@ -43608,7 +43682,7 @@ var colors = {
43608
43682
  };
43609
43683
 
43610
43684
  // src/version.ts
43611
- var version = "3.157.0";
43685
+ var version = "3.158.0";
43612
43686
 
43613
43687
  // src/formatters.ts
43614
43688
  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.157.0",
3
+ "version": "3.158.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.157.0"
69
+ "circle-ir": "^3.158.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",