cognium-dev 3.36.0 → 3.37.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 +32 -3
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -19451,6 +19451,15 @@ function buildPythonTaintedVars(sourceCode) {
19451
19451
  containerTainted.set(`${obj}['${section}']['${key}']`, i2 + 1);
19452
19452
  continue;
19453
19453
  }
19454
+ const containerAppendMatch = line.match(/^\s*(\w+)\.(append|extend|insert|add|push|put|appendleft)\s*\(\s*(.+?)\s*\)\s*$/);
19455
+ if (containerAppendMatch) {
19456
+ const [, receiver, , argExpr] = containerAppendMatch;
19457
+ const argIsTainted = [...tainted.keys()].some((v) => new RegExp(`\\b${v}\\b`).test(argExpr));
19458
+ const argIsDirectSource = PYTHON_TAINTED_PATTERNS2.some((p) => p.pattern.test(argExpr));
19459
+ if (argIsTainted || argIsDirectSource)
19460
+ tainted.set(receiver, tainted.get(receiver) ?? i2 + 1);
19461
+ continue;
19462
+ }
19454
19463
  const augAssign = line.match(/^\s*(\w+)\s*\+=\s*(.+)$/);
19455
19464
  if (augAssign) {
19456
19465
  const [, augLhs, augRhs] = augAssign;
@@ -20513,7 +20522,7 @@ class TaintPropagationPass {
20513
20522
  flows.push(f);
20514
20523
  }
20515
20524
  }
20516
- const exprScanFlows = detectExpressionScanFlows(calls, sources, sinks, constProp.unreachableLines) ?? [];
20525
+ const exprScanFlows = detectExpressionScanFlows(calls, sources, sinks, constProp.unreachableLines, ctx.code, ctx.language) ?? [];
20517
20526
  for (const f of exprScanFlows) {
20518
20527
  if (flows.some((x) => x.source_line === f.source_line && x.sink_line === f.sink_line && x.sink_type === f.sink_type))
20519
20528
  continue;
@@ -20731,11 +20740,31 @@ function detectParameterSinkFlows(types, calls, sources, sinks, unreachableLines
20731
20740
  }
20732
20741
  return flows;
20733
20742
  }
20734
- function detectExpressionScanFlows(calls, sources, sinks, unreachableLines) {
20743
+ function detectExpressionScanFlows(calls, sources, sinks, unreachableLines, code, language) {
20735
20744
  const flows = [];
20736
20745
  const sourcesWithVar = sources.filter((s) => typeof s.variable === "string" && s.variable.length > 0);
20737
20746
  if (sourcesWithVar.length === 0)
20738
20747
  return flows;
20748
+ if (language === "python" && typeof code === "string") {
20749
+ const derived = buildPythonTaintedVars(code);
20750
+ if (derived.size > 0) {
20751
+ let anchor = sourcesWithVar[0];
20752
+ for (const s of sourcesWithVar) {
20753
+ if (s.line < anchor.line)
20754
+ anchor = s;
20755
+ }
20756
+ const existingVars = new Set(sourcesWithVar.map((s) => s.variable));
20757
+ for (const [varName] of derived) {
20758
+ if (!varName || existingVars.has(varName))
20759
+ continue;
20760
+ sourcesWithVar.push({
20761
+ ...anchor,
20762
+ variable: varName
20763
+ });
20764
+ existingVars.add(varName);
20765
+ }
20766
+ }
20767
+ }
20739
20768
  const reCache = new Map;
20740
20769
  for (const s of sourcesWithVar) {
20741
20770
  if (reCache.has(s.variable))
@@ -26954,7 +26983,7 @@ var colors = {
26954
26983
  };
26955
26984
 
26956
26985
  // src/version.ts
26957
- var version = "3.36.0";
26986
+ var version = "3.37.0";
26958
26987
 
26959
26988
  // src/formatters.ts
26960
26989
  var SINK_SEVERITY = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cognium-dev",
3
- "version": "3.36.0",
3
+ "version": "3.37.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",
@@ -65,7 +65,7 @@
65
65
  "registry": "https://registry.npmjs.org/"
66
66
  },
67
67
  "dependencies": {
68
- "circle-ir": "^3.36.0"
68
+ "circle-ir": "^3.37.0"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/node": "^25.5.0",