cognium-dev 3.213.0 → 3.215.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 +44 -28
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -11220,8 +11220,8 @@ var DEFAULT_SINKS = [
11220
11220
  { method: "addAttribute", class: "Model", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [1] },
11221
11221
  { method: "addAttribute", class: "ModelMap", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [1] },
11222
11222
  { method: "addObject", class: "ModelAndView", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [1] },
11223
- { method: "println", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
11224
- { method: "print", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
11223
+ { method: "println", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0], languages: ["java"] },
11224
+ { method: "print", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0], languages: ["java"] },
11225
11225
  { method: "handleHyperlinks", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
11226
11226
  { method: "handleDiv", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
11227
11227
  { method: "handleImage", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
@@ -12752,31 +12752,33 @@ function findSources(calls, types, patterns, sourceLines, language) {
12752
12752
  }
12753
12753
  }
12754
12754
  const RUST_EXTRACTOR_KIND = /(?:^|::)(Json|Form|Query|Path|Extension|Multipart|Body|Bytes)(?:<|$)/;
12755
- for (const type of types) {
12756
- for (const method of type.methods) {
12757
- for (const param of method.parameters) {
12758
- if (!param.type)
12759
- continue;
12760
- const kindMatch = RUST_EXTRACTOR_KIND.exec(param.type);
12761
- if (!kindMatch)
12762
- continue;
12763
- const kind = kindMatch[1];
12764
- if (kind === "Extension")
12765
- continue;
12766
- const sourceType = kind === "Form" || kind === "Query" || kind === "Path" ? "http_param" : "http_body";
12767
- const paramLine = param.line ?? method.start_line;
12768
- const alreadyExists = sources.some((s) => s.line === paramLine && s.variable === param.name);
12769
- if (alreadyExists)
12770
- continue;
12771
- sources.push({
12772
- type: sourceType,
12773
- location: `${param.type} ${param.name} in ${method.name}`,
12774
- severity: "high",
12775
- line: paramLine,
12776
- confidence: 1,
12777
- variable: param.name,
12778
- in_method: method.name
12779
- });
12755
+ if (language === "rust") {
12756
+ for (const type of types) {
12757
+ for (const method of type.methods) {
12758
+ for (const param of method.parameters) {
12759
+ if (!param.type)
12760
+ continue;
12761
+ const kindMatch = RUST_EXTRACTOR_KIND.exec(param.type);
12762
+ if (!kindMatch)
12763
+ continue;
12764
+ const kind = kindMatch[1];
12765
+ if (kind === "Extension")
12766
+ continue;
12767
+ const sourceType = kind === "Form" || kind === "Query" || kind === "Path" ? "http_param" : "http_body";
12768
+ const paramLine = param.line ?? method.start_line;
12769
+ const alreadyExists = sources.some((s) => s.line === paramLine && s.variable === param.name);
12770
+ if (alreadyExists)
12771
+ continue;
12772
+ sources.push({
12773
+ type: sourceType,
12774
+ location: `${param.type} ${param.name} in ${method.name}`,
12775
+ severity: "high",
12776
+ line: paramLine,
12777
+ confidence: 1,
12778
+ variable: param.name,
12779
+ in_method: method.name
12780
+ });
12781
+ }
12780
12782
  }
12781
12783
  }
12782
12784
  }
@@ -31853,6 +31855,8 @@ var SQL_EXEC_METHODS = new Set([
31853
31855
  var JAVA_SQL_ASSIGN_RE_TEMPLATE = "\\b(?:String|CharSequence|final\\s+String|var)\\s+SQLVAR\\b\\s*=\\s*(.+?);";
31854
31856
  var REPLACE_ALL_TO_PLACEHOLDER_RE = /\.replaceAll\s*\([\s\S]*?,\s*"[\s,?]*\?[\s,?]*"\s*\)/;
31855
31857
  var HTML_CONTENT_TYPE_RE = /text\/html|TEXT_HTML/;
31858
+ var FETCH_GLOBAL_RECEIVER_RE = /(?:^|[^.\w])(?:window|globalThis|self|global)\s*\.\s*fetch\s*\(/;
31859
+ var FETCH_MEMBER_RECEIVER_RE = /[\w$)\]]\s*\.\s*fetch\s*\(/;
31856
31860
  function javaTraversalRejectGuardedLines(code) {
31857
31861
  const covered = new Set;
31858
31862
  const lines = code.split(`
@@ -32686,6 +32690,18 @@ class SinkFilterPass {
32686
32690
  }
32687
32691
  if (["javascript", "typescript"].includes(language)) {
32688
32692
  const sourceLines = ctx.code.split(`
32693
+ `);
32694
+ filtered = filtered.filter((sink) => {
32695
+ if (sink.type !== "ssrf" || sink.method !== "fetch")
32696
+ return true;
32697
+ const sinkLineText = sourceLines[sink.line - 1] ?? "";
32698
+ if (FETCH_GLOBAL_RECEIVER_RE.test(sinkLineText))
32699
+ return true;
32700
+ return !FETCH_MEMBER_RECEIVER_RE.test(sinkLineText);
32701
+ });
32702
+ }
32703
+ if (["javascript", "typescript"].includes(language)) {
32704
+ const sourceLines = ctx.code.split(`
32689
32705
  `);
32690
32706
  filtered = filtered.filter((sink) => {
32691
32707
  if (sink.type !== "log_injection")
@@ -47136,7 +47152,7 @@ var colors = {
47136
47152
  };
47137
47153
 
47138
47154
  // src/version.ts
47139
- var version = "3.213.0";
47155
+ var version = "3.215.0";
47140
47156
 
47141
47157
  // src/formatters.ts
47142
47158
  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.213.0",
3
+ "version": "3.215.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.213.0"
69
+ "circle-ir": "^3.215.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",