cognium-dev 3.114.0 → 3.115.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 +50 -2
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -11697,7 +11697,8 @@ function analyzeTaint(calls, types, config = getDefaultConfig(), typeHierarchy,
11697
11697
  const sourceLines = code !== undefined ? code.split(`
11698
11698
  `) : undefined;
11699
11699
  const sources = findSources(calls, types, config.sources, sourceLines, language);
11700
- const sinkPatterns = expandPromisifyAliases(config.sinks, sourceLines, language);
11700
+ let sinkPatterns = expandPromisifyAliases(config.sinks, sourceLines, language);
11701
+ sinkPatterns = expandIndirectEvalAliases(sinkPatterns, sourceLines, language);
11701
11702
  const sinks = findSinks(calls, sinkPatterns, typeHierarchy, language, sourceLines);
11702
11703
  const sanitizers = findSanitizers(calls, types, config.sanitizers, sourceLines);
11703
11704
  return { sources, sinks, sanitizers };
@@ -11752,6 +11753,53 @@ function expandPromisifyAliases(patterns, sourceLines, language) {
11752
11753
  }
11753
11754
  return aliasPatterns.length === 0 ? patterns : patterns.concat(aliasPatterns);
11754
11755
  }
11756
+ function expandIndirectEvalAliases(patterns, sourceLines, language) {
11757
+ if (!sourceLines || sourceLines.length === 0)
11758
+ return patterns;
11759
+ if (language !== "javascript" && language !== "typescript")
11760
+ return patterns;
11761
+ const INDIRECT_EVAL_RE = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::[^=]+)?=\s*(eval|Function)\b(?!\s*\()/;
11762
+ const innerToPattern = new Map;
11763
+ for (const p of patterns) {
11764
+ if (p.languages && !p.languages.includes(language))
11765
+ continue;
11766
+ if (p.class !== undefined)
11767
+ continue;
11768
+ if (p.method !== "eval" && p.method !== "Function")
11769
+ continue;
11770
+ if (!innerToPattern.has(p.method))
11771
+ innerToPattern.set(p.method, p);
11772
+ }
11773
+ if (innerToPattern.size === 0)
11774
+ return patterns;
11775
+ const aliasPatterns = [];
11776
+ const seenAliases = new Set;
11777
+ for (const line of sourceLines) {
11778
+ const m = INDIRECT_EVAL_RE.exec(line);
11779
+ if (!m)
11780
+ continue;
11781
+ const aliasName = m[1];
11782
+ const innerName = m[2];
11783
+ if (!aliasName || !innerName)
11784
+ continue;
11785
+ if (seenAliases.has(aliasName))
11786
+ continue;
11787
+ const template = innerToPattern.get(innerName);
11788
+ if (!template)
11789
+ continue;
11790
+ seenAliases.add(aliasName);
11791
+ aliasPatterns.push({
11792
+ method: aliasName,
11793
+ type: template.type,
11794
+ cwe: template.cwe,
11795
+ severity: template.severity,
11796
+ arg_positions: template.arg_positions,
11797
+ languages: [language],
11798
+ note: `indirect ${innerName} alias — cognium-dev #188`
11799
+ });
11800
+ }
11801
+ return aliasPatterns.length === 0 ? patterns : patterns.concat(aliasPatterns);
11802
+ }
11755
11803
  function attachSourceLineCode(sources, sinks, code) {
11756
11804
  const lines = code.split(`
11757
11805
  `);
@@ -36780,7 +36828,7 @@ var colors = {
36780
36828
  };
36781
36829
 
36782
36830
  // src/version.ts
36783
- var version = "3.114.0";
36831
+ var version = "3.115.0";
36784
36832
 
36785
36833
  // src/formatters.ts
36786
36834
  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.114.0",
3
+ "version": "3.115.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.114.0"
69
+ "circle-ir": "^3.115.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",