cognium-dev 3.180.0 → 3.181.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 +38 -11
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -10634,6 +10634,16 @@ var DEFAULT_SOURCES = [
10634
10634
  { method: "get", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10635
10635
  { method: "hget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10636
10636
  { method: "mget", class: "Jedis", type: "db_input", severity: "medium", return_tainted: true, languages: ["java"] },
10637
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10638
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10639
+ { property: "multiValueQueryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10640
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10641
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10642
+ { property: "multiValueHeaders", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["javascript", "typescript"] },
10643
+ { property: "body", object: "event", type: "http_body", severity: "high", property_tainted: true, languages: ["python"] },
10644
+ { property: "queryStringParameters", object: "event", type: "http_query", severity: "high", property_tainted: true, languages: ["python"] },
10645
+ { property: "pathParameters", object: "event", type: "http_path", severity: "high", property_tainted: true, languages: ["python"] },
10646
+ { property: "headers", object: "event", type: "http_header", severity: "high", property_tainted: true, languages: ["python"] },
10637
10647
  { method: "decode", class: "jwt", type: "http_header", severity: "high", return_tainted: true, languages: ["python"] },
10638
10648
  { method: "get_unverified_claims", class: "jwt", type: "http_header", severity: "high", return_tainted: true, languages: ["python"] },
10639
10649
  { method: "get_unverified_header", class: "jwt", type: "http_header", severity: "high", return_tainted: true, languages: ["python"] },
@@ -24564,7 +24574,13 @@ var JS_TAINTED_PATTERNS = [
24564
24574
  { pattern: /\bdocument\.title\b/, type: "dom_input" },
24565
24575
  { pattern: /\bhistory\.state\b/, type: "dom_input" },
24566
24576
  { pattern: /\blocalStorage\.getItem\b/, type: "dom_input" },
24567
- { pattern: /\bsessionStorage\.getItem\b/, type: "dom_input" }
24577
+ { pattern: /\bsessionStorage\.getItem\b/, type: "dom_input" },
24578
+ { pattern: /\bevent\.body\b/, type: "http_body" },
24579
+ { pattern: /\bevent\.queryStringParameters\b/, type: "http_param" },
24580
+ { pattern: /\bevent\.multiValueQueryStringParameters\b/, type: "http_param" },
24581
+ { pattern: /\bevent\.pathParameters\b/, type: "http_path" },
24582
+ { pattern: /\bevent\.headers\b/, type: "http_header" },
24583
+ { pattern: /\bevent\.multiValueHeaders\b/, type: "http_header" }
24568
24584
  ];
24569
24585
  var PYTHON_TAINTED_PATTERNS2 = [
24570
24586
  { pattern: /\brequest\.args\b/, type: "http_param" },
@@ -29469,7 +29485,7 @@ function findPythonTaintedFormatStringFindings(code, file) {
29469
29485
  if (taintedVars.size === 0)
29470
29486
  return findings;
29471
29487
  const percentRe = /\b(\w+)\s*%\s*[\(\[\{"'\w]/;
29472
- const dotFormatRe = /\b(\w+)\s*\.\s*format\s*\(/;
29488
+ const dotFormatRe = /\b(\w+)\s*\.\s*(?:format|format_map)\s*\(/;
29473
29489
  const seen = new Set;
29474
29490
  for (let i2 = 0;i2 < lines.length; i2++) {
29475
29491
  const line = lines[i2];
@@ -39789,30 +39805,41 @@ class PythonReceiverTaintFormatPass {
39789
39805
  if (ctx.language !== "python") {
39790
39806
  return { findingsEmitted: 0 };
39791
39807
  }
39792
- const { calls, meta } = ctx.graph.ir;
39793
- const constProp = ctx.getResult("constant-propagation");
39794
- const tainted = constProp.tainted;
39808
+ const { calls, meta, taint } = ctx.graph.ir;
39809
+ const taintedVarNames = new Set;
39810
+ for (const s of taint.sources) {
39811
+ if (typeof s.variable === "string" && s.variable.length > 0) {
39812
+ taintedVarNames.add(s.variable);
39813
+ }
39814
+ }
39815
+ if (taintedVarNames.size === 0) {
39816
+ return { findingsEmitted: 0 };
39817
+ }
39818
+ const seen = new Set;
39795
39819
  let count = 0;
39796
39820
  for (const call of calls) {
39797
- if (call.method_name !== "format")
39821
+ if (call.method_name !== "format" && call.method_name !== "format_map")
39798
39822
  continue;
39799
39823
  const receiver = call.receiver;
39800
39824
  if (!receiver)
39801
39825
  continue;
39802
39826
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(receiver))
39803
39827
  continue;
39804
- const scopedName = call.in_method ? `${call.in_method}:${receiver}` : receiver;
39805
- if (!tainted.has(receiver) && !tainted.has(scopedName))
39828
+ if (!taintedVarNames.has(receiver))
39829
+ continue;
39830
+ const seenKey = `${call.location.line}:${receiver}`;
39831
+ if (seen.has(seenKey))
39806
39832
  continue;
39833
+ seen.add(seenKey);
39807
39834
  ctx.addFinding({
39808
- id: `format_string-${meta.file}-${call.location.line}-${receiver}`,
39835
+ id: `format_string-${meta.file}-${call.location.line}-${receiver}-${call.method_name}`,
39809
39836
  pass: this.name,
39810
39837
  category: "security",
39811
39838
  rule_id: "format_string",
39812
39839
  cwe: "CWE-134",
39813
39840
  severity: "medium",
39814
39841
  level: "warning",
39815
- message: `Format-string vulnerability: the format template \`${receiver}\` ` + `is tainted (traces back to a taint source). Attacker can leak ` + `object attributes via \`{obj.__class__.__mro__[…]}\` chains or ` + `crash the process via unbounded specifiers. Use a literal ` + `format string and pass user input as an argument instead.`,
39842
+ message: `Format-string vulnerability: the format template \`${receiver}\` ` + `is tainted (traces back to a taint source) and used as the ` + `receiver of \`${call.method_name}(...)\`. Attacker can leak ` + `object attributes via \`{obj.__class__.__mro__[…]}\` chains or ` + `crash the process via unbounded specifiers. Use a literal ` + `format string and pass user input as an argument instead.`,
39816
39843
  file: meta.file,
39817
39844
  line: call.location.line
39818
39845
  });
@@ -45424,7 +45451,7 @@ var colors = {
45424
45451
  };
45425
45452
 
45426
45453
  // src/version.ts
45427
- var version = "3.180.0";
45454
+ var version = "3.181.0";
45428
45455
 
45429
45456
  // src/formatters.ts
45430
45457
  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.180.0",
3
+ "version": "3.181.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.180.0"
69
+ "circle-ir": "^3.181.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",