cognium-dev 3.167.0 → 3.168.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 +63 -2
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -13624,6 +13624,66 @@ function formatCallCode(call) {
13624
13624
  }
13625
13625
  return `${call.method_name}(${args2})`;
13626
13626
  }
13627
+ // ../circle-ir/dist/analysis/non-executable-lines.js
13628
+ function isNonExecutableSourceLine(sourceCode, line, language) {
13629
+ if (!sourceCode || line < 1)
13630
+ return false;
13631
+ const lines = sourceCode.split(`
13632
+ `);
13633
+ if (line > lines.length)
13634
+ return false;
13635
+ const raw = lines[line - 1] ?? "";
13636
+ const trimmed = raw.trim();
13637
+ if (trimmed === "")
13638
+ return true;
13639
+ const lang = language.toLowerCase();
13640
+ if (trimmed.startsWith("//") || trimmed.startsWith("/*") || trimmed.startsWith("*/") || trimmed.startsWith("*") || trimmed === "/**") {
13641
+ return true;
13642
+ }
13643
+ switch (lang) {
13644
+ case "java":
13645
+ case "javascript":
13646
+ case "typescript":
13647
+ case "go":
13648
+ case "rust":
13649
+ return isNonExecutableCurly(trimmed);
13650
+ case "python":
13651
+ return isNonExecutablePython(trimmed);
13652
+ default:
13653
+ return false;
13654
+ }
13655
+ }
13656
+ function isNonExecutableCurly(trimmed) {
13657
+ if (/^(import|package|use|from)\s/.test(trimmed))
13658
+ return true;
13659
+ if (/^@[A-Za-z_][\w.]*(?:\s*\([^)]*\))?\s*$/.test(trimmed))
13660
+ return true;
13661
+ if (/^(?:(?:public|private|protected|internal)\s+)?(?:static\s+)?(?:final\s+|readonly\s+|const\s+)(?:[A-Za-z_][\w<>.\[\]]*\s+)?[A-Za-z_]\w*(?:\s*:\s*[^=]+)?\s*=\s*(?:["'`][^"'`]*["'`]|-?\d+(?:\.\d+)?)\s*;?\s*$/.test(trimmed)) {
13662
+ return true;
13663
+ }
13664
+ if (/^(?:const|let|var|static)\s+[A-Za-z_]\w*(?:\s*:\s*[^=]+)?\s*=\s*(?:["'`][^"'`]*["'`]|-?\d+(?:\.\d+)?)\s*;?\s*$/.test(trimmed)) {
13665
+ return true;
13666
+ }
13667
+ if (/^(?:(?:public|private|protected)\s+)?(?:static\s+)?(?:final\s+)[A-Za-z_][\w<>.\[\]]*\s+[A-Za-z_]\w*\s*;\s*$/.test(trimmed)) {
13668
+ return true;
13669
+ }
13670
+ return false;
13671
+ }
13672
+ function isNonExecutablePython(trimmed) {
13673
+ if (/^(import|from)\s/.test(trimmed))
13674
+ return true;
13675
+ if (trimmed.startsWith("#"))
13676
+ return true;
13677
+ if (trimmed === '"""' || trimmed === "'''")
13678
+ return true;
13679
+ if (/^@[A-Za-z_][\w.]*(?:\s*\([^)]*\))?\s*$/.test(trimmed))
13680
+ return true;
13681
+ if (/^[A-Z_][A-Z0-9_]*\s*(?::\s*[^=]+)?\s*=\s*(?:["'][^"']*["']|-?\d+(?:\.\d+)?)\s*$/.test(trimmed)) {
13682
+ return true;
13683
+ }
13684
+ return false;
13685
+ }
13686
+
13627
13687
  // ../circle-ir/dist/analysis/findings.js
13628
13688
  function canSourceReachSink(sourceType, sinkType) {
13629
13689
  const sourceToSinkMapping = {
@@ -30930,7 +30990,8 @@ class SinkFilterPass {
30930
30990
  const taintMatcher = ctx.getResult("taint-matcher");
30931
30991
  const constProp = ctx.getResult("constant-propagation");
30932
30992
  const langSources = ctx.getResult("language-sources");
30933
- const sources = [...taintMatcher.sources, ...langSources.additionalSources];
30993
+ const mergedSources = [...taintMatcher.sources, ...langSources.additionalSources];
30994
+ const sources = ctx.code && ctx.language ? mergedSources.filter((s) => !isNonExecutableSourceLine(ctx.code, s.line, ctx.language)) : mergedSources;
30934
30995
  const sinks = [...taintMatcher.sinks];
30935
30996
  for (const s of langSources.additionalSinks) {
30936
30997
  if (!sinks.some((x) => x.line === s.line && x.cwe === s.cwe && x.type === s.type)) {
@@ -44534,7 +44595,7 @@ var colors = {
44534
44595
  };
44535
44596
 
44536
44597
  // src/version.ts
44537
- var version = "3.167.0";
44598
+ var version = "3.168.0";
44538
44599
 
44539
44600
  // src/formatters.ts
44540
44601
  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.167.0",
3
+ "version": "3.168.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.167.0"
69
+ "circle-ir": "^3.168.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",