cognium-dev 3.147.0 → 3.148.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 +21 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -26043,6 +26043,18 @@ function findJavaResponseWriterXssFindings(code, file) {
26043
26043
  if (respNames.size === 0)
26044
26044
  return out2;
26045
26045
  const safeWrapRe = /\b(?:Encode\.(?:forHtml|forHtmlAttribute|forHtmlContent|forJavaScript)|StringEscapeUtils\.escape(?:Html3|Html4|EcmaScript|Xml)|HtmlUtils\.htmlEscape(?:Decimal|Hex)?|Escaper\.escapeHtml|HtmlEscapers\.(?:escapeHtml|htmlEscaper)|Encoder\.encodeForHTML(?:Attribute)?|Jsoup\.clean)\s*\(/;
26046
+ const sanitizedVars = new Set;
26047
+ const sanAssignRe = /(?:^|[\s;{},(])(?:final\s+)?(?:[A-Za-z_][\w.<>\[\]]*\s+)?([A-Za-z_]\w*)\s*=\s*[^=]/;
26048
+ for (const line of lines) {
26049
+ const t = line.trim();
26050
+ if (!t || t.startsWith("//") || t.startsWith("*"))
26051
+ continue;
26052
+ if (!safeWrapRe.test(t))
26053
+ continue;
26054
+ const am = t.match(sanAssignRe);
26055
+ if (am)
26056
+ sanitizedVars.add(am[1]);
26057
+ }
26046
26058
  for (let i2 = 0;i2 < lines.length; i2++) {
26047
26059
  const raw = lines[i2];
26048
26060
  const trimmed = raw.trim();
@@ -26063,6 +26075,14 @@ function findJavaResponseWriterXssFindings(code, file) {
26063
26075
  continue;
26064
26076
  if (!/[A-Za-z_]\w*/.test(argsTrim))
26065
26077
  continue;
26078
+ if (sanitizedVars.size > 0) {
26079
+ const stripped = argsTrim.replace(/"(?:\\.|[^"\\])*"/g, "");
26080
+ const idents = stripped.match(/\b[A-Za-z_]\w*\b/g) ?? [];
26081
+ const nonKeyword = idents.filter((x) => x !== "null" && x !== "true" && x !== "false");
26082
+ if (nonKeyword.length > 0 && nonKeyword.every((x) => sanitizedVars.has(x))) {
26083
+ continue;
26084
+ }
26085
+ }
26066
26086
  out2.push({
26067
26087
  id: `xss-${file}-${i2 + 1}`,
26068
26088
  pass: "language-sources",
@@ -42262,7 +42282,7 @@ var colors = {
42262
42282
  };
42263
42283
 
42264
42284
  // src/version.ts
42265
- var version = "3.147.0";
42285
+ var version = "3.148.0";
42266
42286
 
42267
42287
  // src/formatters.ts
42268
42288
  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.147.0",
3
+ "version": "3.148.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.147.0"
69
+ "circle-ir": "^3.148.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",