circle-ir 4.18.1 → 4.20.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.
- package/dist/analysis/advisories.d.ts +21 -3
- package/dist/analysis/advisories.d.ts.map +1 -1
- package/dist/analysis/advisories.js +26 -8
- package/dist/analysis/advisories.js.map +1 -1
- package/dist/analysis/arg-executing-programs.d.ts +16 -0
- package/dist/analysis/arg-executing-programs.d.ts.map +1 -0
- package/dist/analysis/arg-executing-programs.js +24 -0
- package/dist/analysis/arg-executing-programs.js.map +1 -0
- package/dist/analysis/config-loader.d.ts.map +1 -1
- package/dist/analysis/config-loader.js +32 -23
- package/dist/analysis/config-loader.js.map +1 -1
- package/dist/analysis/constant-caller-gate.d.ts +3 -1
- package/dist/analysis/constant-caller-gate.d.ts.map +1 -1
- package/dist/analysis/constant-caller-gate.js +108 -1
- package/dist/analysis/constant-caller-gate.js.map +1 -1
- package/dist/analysis/constant-propagation/index.d.ts.map +1 -1
- package/dist/analysis/constant-propagation/index.js +1 -1
- package/dist/analysis/constant-propagation/index.js.map +1 -1
- package/dist/analysis/constant-propagation/patterns.d.ts.map +1 -1
- package/dist/analysis/constant-propagation/patterns.js +5 -0
- package/dist/analysis/constant-propagation/patterns.js.map +1 -1
- package/dist/analysis/constant-propagation/propagator.d.ts +1 -1
- package/dist/analysis/constant-propagation/propagator.d.ts.map +1 -1
- package/dist/analysis/constant-propagation/propagator.js +15 -1
- package/dist/analysis/constant-propagation/propagator.js.map +1 -1
- package/dist/analysis/constant-propagation/types.d.ts +2 -0
- package/dist/analysis/constant-propagation/types.d.ts.map +1 -1
- package/dist/analysis/dependency-versions.d.ts +33 -0
- package/dist/analysis/dependency-versions.d.ts.map +1 -1
- package/dist/analysis/dependency-versions.js +70 -0
- package/dist/analysis/dependency-versions.js.map +1 -1
- package/dist/analysis/interprocedural.d.ts +6 -0
- package/dist/analysis/interprocedural.d.ts.map +1 -1
- package/dist/analysis/interprocedural.js +53 -6
- package/dist/analysis/interprocedural.js.map +1 -1
- package/dist/analysis/js-helper-return.d.ts +12 -0
- package/dist/analysis/js-helper-return.d.ts.map +1 -0
- package/dist/analysis/js-helper-return.js +64 -0
- package/dist/analysis/js-helper-return.js.map +1 -0
- package/dist/analysis/passes/constant-propagation-pass.d.ts.map +1 -1
- package/dist/analysis/passes/constant-propagation-pass.js +1 -0
- package/dist/analysis/passes/constant-propagation-pass.js.map +1 -1
- package/dist/analysis/passes/cross-file-pass.d.ts.map +1 -1
- package/dist/analysis/passes/cross-file-pass.js +61 -0
- package/dist/analysis/passes/cross-file-pass.js.map +1 -1
- package/dist/analysis/passes/csharp-sanitizer-credit.d.ts.map +1 -1
- package/dist/analysis/passes/csharp-sanitizer-credit.js +60 -3
- package/dist/analysis/passes/csharp-sanitizer-credit.js.map +1 -1
- package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts +15 -0
- package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/deserialization-safety-gate-pass.js +60 -1
- package/dist/analysis/passes/deserialization-safety-gate-pass.js.map +1 -1
- package/dist/analysis/passes/interprocedural-pass.d.ts +23 -1
- package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
- package/dist/analysis/passes/interprocedural-pass.js +148 -6
- package/dist/analysis/passes/interprocedural-pass.js.map +1 -1
- package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
- package/dist/analysis/passes/language-sources-pass.js +150 -7
- package/dist/analysis/passes/language-sources-pass.js.map +1 -1
- package/dist/analysis/passes/resource-leak-pass.d.ts.map +1 -1
- package/dist/analysis/passes/resource-leak-pass.js +20 -4
- package/dist/analysis/passes/resource-leak-pass.js.map +1 -1
- package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
- package/dist/analysis/passes/sink-filter-pass.js +229 -8
- package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
- package/dist/analysis/passes/taint-propagation-pass.d.ts +7 -3
- package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
- package/dist/analysis/passes/taint-propagation-pass.js +176 -15
- package/dist/analysis/passes/taint-propagation-pass.js.map +1 -1
- package/dist/analysis/passes/xml-entity-expansion-pass.d.ts.map +1 -1
- package/dist/analysis/passes/xml-entity-expansion-pass.js +50 -6
- package/dist/analysis/passes/xml-entity-expansion-pass.js.map +1 -1
- package/dist/analysis/pep440-version.d.ts +40 -0
- package/dist/analysis/pep440-version.d.ts.map +1 -0
- package/dist/analysis/pep440-version.js +149 -0
- package/dist/analysis/pep440-version.js.map +1 -0
- package/dist/analysis/rules.d.ts.map +1 -1
- package/dist/analysis/rules.js +6 -0
- package/dist/analysis/rules.js.map +1 -1
- package/dist/analysis/sbom.d.ts +43 -4
- package/dist/analysis/sbom.d.ts.map +1 -1
- package/dist/analysis/sbom.js +265 -33
- package/dist/analysis/sbom.js.map +1 -1
- package/dist/analysis/taint-matcher.d.ts.map +1 -1
- package/dist/analysis/taint-matcher.js +107 -5
- package/dist/analysis/taint-matcher.js.map +1 -1
- package/dist/analyzer.d.ts +6 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +27 -1
- package/dist/analyzer.js.map +1 -1
- package/dist/browser/circle-ir.js +3379 -101
- package/dist/core/circle-ir-core.cjs +218 -35
- package/dist/core/circle-ir-core.js +218 -35
- package/dist/core/extractors/dfg.js +46 -7
- package/dist/core/extractors/dfg.js.map +1 -1
- package/dist/core/extractors/ts-declaration-detail.d.ts +8 -0
- package/dist/core/extractors/ts-declaration-detail.d.ts.map +1 -1
- package/dist/core/extractors/ts-declaration-detail.js +22 -0
- package/dist/core/extractors/ts-declaration-detail.js.map +1 -1
- package/dist/facts/arrow.d.ts +106 -0
- package/dist/facts/arrow.d.ts.map +1 -0
- package/dist/facts/arrow.js +196 -0
- package/dist/facts/arrow.js.map +1 -0
- package/dist/facts/facts2.d.ts +59 -0
- package/dist/facts/facts2.d.ts.map +1 -0
- package/dist/facts/facts2.js +362 -0
- package/dist/facts/facts2.js.map +1 -0
- package/dist/facts/index.d.ts +20 -0
- package/dist/facts/index.d.ts.map +1 -0
- package/dist/facts/index.js +14 -0
- package/dist/facts/index.js.map +1 -0
- package/dist/facts/java-facts.d.ts +56 -0
- package/dist/facts/java-facts.d.ts.map +1 -0
- package/dist/facts/java-facts.js +250 -0
- package/dist/facts/java-facts.js.map +1 -0
- package/dist/facts/order.d.ts +39 -0
- package/dist/facts/order.d.ts.map +1 -0
- package/dist/facts/order.js +120 -0
- package/dist/facts/order.js.map +1 -0
- package/dist/facts/schema.d.ts +60 -0
- package/dist/facts/schema.d.ts.map +1 -0
- package/dist/facts/schema.js +126 -0
- package/dist/facts/schema.js.map +1 -0
- package/dist/facts/schema2.d.ts +47 -0
- package/dist/facts/schema2.d.ts.map +1 -0
- package/dist/facts/schema2.js +194 -0
- package/dist/facts/schema2.js.map +1 -0
- package/dist/facts/table.d.ts +80 -0
- package/dist/facts/table.d.ts.map +1 -0
- package/dist/facts/table.js +548 -0
- package/dist/facts/table.js.map +1 -0
- package/dist/graph-facts/dead-code.d.ts +2 -0
- package/dist/graph-facts/dead-code.d.ts.map +1 -1
- package/dist/graph-facts/dead-code.js +1 -1
- package/dist/graph-facts/dead-code.js.map +1 -1
- package/dist/graph-facts/reach.d.ts +24 -6
- package/dist/graph-facts/reach.d.ts.map +1 -1
- package/dist/graph-facts/reach.js +52 -12
- package/dist/graph-facts/reach.js.map +1 -1
- package/dist/graph-facts/removal-reach.d.ts +2 -0
- package/dist/graph-facts/removal-reach.d.ts.map +1 -1
- package/dist/graph-facts/removal-reach.js +1 -1
- package/dist/graph-facts/removal-reach.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/navigation/java-graph.d.ts +23 -0
- package/dist/navigation/java-graph.d.ts.map +1 -1
- package/dist/navigation/java-graph.js +222 -8
- package/dist/navigation/java-graph.js.map +1 -1
- package/dist/navigation/navigation-index.d.ts +9 -0
- package/dist/navigation/navigation-index.d.ts.map +1 -1
- package/dist/navigation/navigation-index.js +25 -0
- package/dist/navigation/navigation-index.js.map +1 -1
- package/dist/navigation/ts-call-edges.d.ts +9 -0
- package/dist/navigation/ts-call-edges.d.ts.map +1 -1
- package/dist/navigation/ts-call-edges.js.map +1 -1
- package/dist/resolution/cross-file.d.ts +46 -0
- package/dist/resolution/cross-file.d.ts.map +1 -1
- package/dist/resolution/cross-file.js +281 -13
- package/dist/resolution/cross-file.js.map +1 -1
- package/dist/stable-ids/files.d.ts +22 -0
- package/dist/stable-ids/files.d.ts.map +1 -0
- package/dist/stable-ids/files.js +28 -0
- package/dist/stable-ids/files.js.map +1 -0
- package/dist/stable-ids/hash.d.ts +16 -4
- package/dist/stable-ids/hash.d.ts.map +1 -1
- package/dist/stable-ids/hash.js +266 -80
- package/dist/stable-ids/hash.js.map +1 -1
- package/dist/stable-ids/index.d.ts +3 -2
- package/dist/stable-ids/index.d.ts.map +1 -1
- package/dist/stable-ids/index.js +3 -2
- package/dist/stable-ids/index.js.map +1 -1
- package/dist/stable-ids/nodes.d.ts +45 -1
- package/dist/stable-ids/nodes.d.ts.map +1 -1
- package/dist/stable-ids/nodes.js +118 -15
- package/dist/stable-ids/nodes.js.map +1 -1
- package/dist/stable-ids/ts-parse-errors.d.ts +5 -1
- package/dist/stable-ids/ts-parse-errors.d.ts.map +1 -1
- package/dist/stable-ids/ts-parse-errors.js +35 -2
- package/dist/stable-ids/ts-parse-errors.js.map +1 -1
- package/package.json +8 -4
- package/schemas/facts@1.json +134 -0
- package/schemas/facts@2.json +216 -0
|
@@ -10459,9 +10459,46 @@ function processStatement2(stmt, startDefId, startUseId, scopeStack, isJavaScrip
|
|
|
10459
10459
|
case "try_statement":
|
|
10460
10460
|
case "try_with_resources_statement": {
|
|
10461
10461
|
if (isJavaScript) {
|
|
10462
|
-
const
|
|
10463
|
-
|
|
10464
|
-
|
|
10462
|
+
const tryBody = stmt.childForFieldName("body");
|
|
10463
|
+
if (tryBody) {
|
|
10464
|
+
const r = processStatement2(tryBody, defId, useId, scopeStack, isJavaScript);
|
|
10465
|
+
defs.push(...r.defs);
|
|
10466
|
+
uses.push(...r.uses);
|
|
10467
|
+
defId = r.nextDefId;
|
|
10468
|
+
useId = r.nextUseId;
|
|
10469
|
+
}
|
|
10470
|
+
const handler = stmt.childForFieldName("handler");
|
|
10471
|
+
if (handler) {
|
|
10472
|
+
scopeStack.push(/* @__PURE__ */ new Map());
|
|
10473
|
+
const param = handler.childForFieldName("parameter");
|
|
10474
|
+
if (param) {
|
|
10475
|
+
const paramDefs = param.type === "identifier" ? [{ id: defId, variable: getNodeText(param), line: param.startPosition.row + 1, column: param.startPosition.column, kind: "local" }] : extractDestructuringDefs(param, defId);
|
|
10476
|
+
for (const def of paramDefs) {
|
|
10477
|
+
defs.push(def);
|
|
10478
|
+
currentScope(scopeStack).set(def.variable, def.id);
|
|
10479
|
+
markDeclared(currentScope(scopeStack), def.variable);
|
|
10480
|
+
defId++;
|
|
10481
|
+
}
|
|
10482
|
+
}
|
|
10483
|
+
const handlerBody = handler.childForFieldName("body");
|
|
10484
|
+
if (handlerBody) {
|
|
10485
|
+
const r = processStatement2(handlerBody, defId, useId, scopeStack, isJavaScript);
|
|
10486
|
+
defs.push(...r.defs);
|
|
10487
|
+
uses.push(...r.uses);
|
|
10488
|
+
defId = r.nextDefId;
|
|
10489
|
+
useId = r.nextUseId;
|
|
10490
|
+
}
|
|
10491
|
+
carryBranchDefsOut(scopeStack.pop(), scopeStack, false);
|
|
10492
|
+
}
|
|
10493
|
+
const finalizer6 = stmt.childForFieldName("finalizer");
|
|
10494
|
+
const finallyBody = finalizer6?.childForFieldName("body");
|
|
10495
|
+
if (finallyBody) {
|
|
10496
|
+
const r = processStatement2(finallyBody, defId, useId, scopeStack, isJavaScript);
|
|
10497
|
+
defs.push(...r.defs);
|
|
10498
|
+
uses.push(...r.uses);
|
|
10499
|
+
defId = r.nextDefId;
|
|
10500
|
+
useId = r.nextUseId;
|
|
10501
|
+
}
|
|
10465
10502
|
break;
|
|
10466
10503
|
}
|
|
10467
10504
|
scopeStack.push(/* @__PURE__ */ new Map());
|
|
@@ -11862,6 +11899,77 @@ function extractGoAddressableVarName(node) {
|
|
|
11862
11899
|
return null;
|
|
11863
11900
|
}
|
|
11864
11901
|
|
|
11902
|
+
// src/analysis/arg-executing-programs.ts
|
|
11903
|
+
var ARG_EXECUTING_PROGRAMS = /* @__PURE__ */ new Set([
|
|
11904
|
+
"ssh",
|
|
11905
|
+
"sudo",
|
|
11906
|
+
"doas",
|
|
11907
|
+
"su",
|
|
11908
|
+
"runuser",
|
|
11909
|
+
"pkexec",
|
|
11910
|
+
"docker",
|
|
11911
|
+
"podman",
|
|
11912
|
+
"nerdctl",
|
|
11913
|
+
"kubectl",
|
|
11914
|
+
"oc",
|
|
11915
|
+
"xargs",
|
|
11916
|
+
"parallel",
|
|
11917
|
+
"env",
|
|
11918
|
+
"nohup",
|
|
11919
|
+
"timeout",
|
|
11920
|
+
"nice",
|
|
11921
|
+
"ionice",
|
|
11922
|
+
"stdbuf",
|
|
11923
|
+
"setsid",
|
|
11924
|
+
"chroot",
|
|
11925
|
+
"flock",
|
|
11926
|
+
"watch"
|
|
11927
|
+
]);
|
|
11928
|
+
function runsArgvAsCommand(program) {
|
|
11929
|
+
const base = (program.split(/[\\/]/).pop() ?? program).toLowerCase().replace(/\.exe$/, "");
|
|
11930
|
+
return ARG_EXECUTING_PROGRAMS.has(base);
|
|
11931
|
+
}
|
|
11932
|
+
|
|
11933
|
+
// src/analysis/js-helper-return.ts
|
|
11934
|
+
function jsHelperReturnsNoParam(sourceCode, rawName) {
|
|
11935
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(rawName)) return false;
|
|
11936
|
+
const name2 = rawName.replace(/\$/g, "\\$");
|
|
11937
|
+
const decls = [...sourceCode.matchAll(new RegExp(`\\bfunction\\s+${name2}\\s*\\(([^)]*)\\)\\s*\\{`, "g"))];
|
|
11938
|
+
if (decls.length !== 1) return false;
|
|
11939
|
+
if (new RegExp(`(?:const|let|var)\\s+${name2}\\s*=`).test(sourceCode)) return false;
|
|
11940
|
+
const open = (decls[0].index ?? 0) + decls[0][0].length - 1;
|
|
11941
|
+
let depth = 0;
|
|
11942
|
+
let close = -1;
|
|
11943
|
+
for (let i2 = open; i2 < sourceCode.length; i2++) {
|
|
11944
|
+
const ch = sourceCode[i2];
|
|
11945
|
+
if (ch === "{") depth++;
|
|
11946
|
+
else if (ch === "}" && --depth === 0) {
|
|
11947
|
+
close = i2;
|
|
11948
|
+
break;
|
|
11949
|
+
}
|
|
11950
|
+
}
|
|
11951
|
+
if (close < 0) return false;
|
|
11952
|
+
const body2 = sourceCode.slice(open + 1, close).replace(/\/\/.*$/gm, "");
|
|
11953
|
+
if (/\bfunction\b|=>/.test(body2)) return false;
|
|
11954
|
+
const literal = /^(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d+(?:\.\d+)?|true|false|null)$/;
|
|
11955
|
+
const returns = [...body2.matchAll(/\breturn\b\s*([^;]*);?/g)].map((m) => m[1].trim());
|
|
11956
|
+
if (returns.length === 0) return false;
|
|
11957
|
+
for (const expr of returns) {
|
|
11958
|
+
if (literal.test(expr)) continue;
|
|
11959
|
+
const slot = /^([A-Za-z_$][\w$]*)\s*\[\s*(\d+)\s*\]$/.exec(expr);
|
|
11960
|
+
if (!slot) return false;
|
|
11961
|
+
const arr = slot[1].replace(/\$/g, "\\$");
|
|
11962
|
+
const declRe = new RegExp(`(?:const|let|var)\\s+${arr}\\s*=\\s*\\[([^\\]]*)\\]\\s*;?`);
|
|
11963
|
+
const d = declRe.exec(body2);
|
|
11964
|
+
if (!d) return false;
|
|
11965
|
+
if (new RegExp(`\\b${arr}\\s*(?:\\[[^\\]]*\\]\\s*=(?!=)|\\.\\s*(?:push|unshift|splice|shift|pop|reverse|sort|fill|copyWithin)\\s*\\()`).test(body2)) return false;
|
|
11966
|
+
const elems = d[1].split(",").map((e) => e.trim());
|
|
11967
|
+
const el = elems[Number(slot[2])];
|
|
11968
|
+
if (el === void 0 || !literal.test(el)) return false;
|
|
11969
|
+
}
|
|
11970
|
+
return true;
|
|
11971
|
+
}
|
|
11972
|
+
|
|
11865
11973
|
// src/analysis/literal-expression.ts
|
|
11866
11974
|
function isProvablyLiteralExpression(expr) {
|
|
11867
11975
|
let e = (expr ?? "").trim();
|
|
@@ -12356,6 +12464,11 @@ var DEFAULT_SOURCES = [
|
|
|
12356
12464
|
{ method: "getMethod", class: "HttpServletRequest", type: "http_header", severity: "low", return_tainted: true },
|
|
12357
12465
|
{ method: "getContentType", class: "HttpServletRequest", type: "http_header", severity: "medium", return_tainted: true },
|
|
12358
12466
|
{ method: "getCharacterEncoding", class: "HttpServletRequest", type: "http_header", severity: "low", return_tainted: true },
|
|
12467
|
+
// OWASP Benchmark helpers — wrap HttpServletRequest accessors (configs/sources/http_sources.yaml).
|
|
12468
|
+
// Omit getTheValue: OWASP returns a constant (#914 S4); interprocedural gates handle it.
|
|
12469
|
+
{ method: "getTheParameter", class: "SeparateClassRequest", type: "http_param", severity: "high", return_tainted: true, languages: ["java"] },
|
|
12470
|
+
{ method: "getTheHeaders", class: "SeparateClassRequest", type: "http_header", severity: "high", return_tainted: true, languages: ["java"] },
|
|
12471
|
+
{ method: "getTheCookies", class: "SeparateClassRequest", type: "http_cookie", severity: "high", return_tainted: true, languages: ["java"] },
|
|
12359
12472
|
// Enumeration/Iterator sources (from request.getHeaders(), etc.)
|
|
12360
12473
|
{ method: "nextElement", class: "Enumeration", type: "http_header", severity: "high", return_tainted: true },
|
|
12361
12474
|
{ method: "nextElement", type: "http_header", severity: "high", return_tainted: true },
|
|
@@ -12710,7 +12823,7 @@ var DEFAULT_SOURCES = [
|
|
|
12710
12823
|
{ method: "getenv", class: "os", type: "env_input", severity: "medium", return_tainted: true },
|
|
12711
12824
|
{ method: "get", class: "environ", type: "env_input", severity: "medium", return_tainted: true },
|
|
12712
12825
|
{ method: "input", type: "io_input", severity: "high", return_tainted: true },
|
|
12713
|
-
{ method: "read", type: "file_input", severity: "medium", return_tainted: true },
|
|
12826
|
+
{ method: "read", type: "file_input", severity: "medium", return_tainted: true, languages: ["python"] },
|
|
12714
12827
|
{ method: "readline", type: "file_input", severity: "medium", return_tainted: true },
|
|
12715
12828
|
{ method: "readlines", type: "file_input", severity: "medium", return_tainted: true },
|
|
12716
12829
|
// Python database sources
|
|
@@ -13627,7 +13740,7 @@ var DEFAULT_SINKS = [
|
|
|
13627
13740
|
{ method: "renderHTML", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13628
13741
|
{ method: "parseHTML", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13629
13742
|
// HTML sanitizer/validator sinks (AntiSamy, OWASP HTML Sanitizer, etc.)
|
|
13630
|
-
{ method: "scan", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13743
|
+
{ method: "scan", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
|
|
13631
13744
|
{ method: "isValid", class: "SafeHtmlValidator", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13632
13745
|
{ method: "sanitize", class: "PolicyFactory", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13633
13746
|
{ method: "validate", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
|
|
@@ -13643,8 +13756,8 @@ var DEFAULT_SINKS = [
|
|
|
13643
13756
|
{ method: "writeAttribute", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0, 1] },
|
|
13644
13757
|
// AntiSamy specific (SAX filters)
|
|
13645
13758
|
{ method: "startElement", class: "MagicSAXFilter", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0, 1, 2] },
|
|
13646
|
-
{ method: "scan", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13647
|
-
{ method: "scan", class: "AntiSamySAXScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13759
|
+
{ method: "scan", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
|
|
13760
|
+
{ method: "scan", class: "AntiSamySAXScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
|
|
13648
13761
|
// Hibernate Validator
|
|
13649
13762
|
{ method: "getFragmentAsDocument", class: "SafeHtmlValidator", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13650
13763
|
// JSPWiki specific
|
|
@@ -13694,15 +13807,15 @@ var DEFAULT_SINKS = [
|
|
|
13694
13807
|
{ method: "getValidListItem", class: "DefaultValidator", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0, 1] },
|
|
13695
13808
|
{ method: "isValidURI", class: "DefaultValidator", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0, 1] },
|
|
13696
13809
|
// AntiSamy test/processing methods
|
|
13697
|
-
{ method: "scriptAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13698
|
-
{ method: "imgAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13699
|
-
{ method: "hrefAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13700
|
-
{ method: "cssAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13701
|
-
{ method: "IllegalXML", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13702
|
-
{ method: "testIssue2", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13703
|
-
{ method: "issue41", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13704
|
-
{ method: "testGithubIssue151", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
13705
|
-
{ method: "processStyleTag", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13810
|
+
{ method: "scriptAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13811
|
+
{ method: "imgAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13812
|
+
{ method: "hrefAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13813
|
+
{ method: "cssAttacks", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13814
|
+
{ method: "IllegalXML", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13815
|
+
{ method: "testIssue2", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13816
|
+
{ method: "issue41", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13817
|
+
{ method: "testGithubIssue151", class: "AntiSamyTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [], languages: ["java"] },
|
|
13818
|
+
{ method: "processStyleTag", class: "AntiSamyDOMScanner", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0], languages: ["java"] },
|
|
13706
13819
|
// JSON Sanitizer
|
|
13707
13820
|
{ method: "sanitizeString", class: "JsonSanitizer", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
13708
13821
|
{ method: "testIssue13", class: "JsonSanitizerTest", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [] },
|
|
@@ -14229,6 +14342,10 @@ var DEFAULT_SINKS = [
|
|
|
14229
14342
|
// not reach it.
|
|
14230
14343
|
{ method: "run", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api", "duckdb", "duckdb-async"] },
|
|
14231
14344
|
{ method: "prepare", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api", "duckdb", "duckdb-async", "react-native-duckdb"] },
|
|
14345
|
+
// #1073 — better-sqlite3 / sqlite3: `db.prepare(sql)` takes the SQL text (arg 0); the statement's
|
|
14346
|
+
// `get` / `all` / `run` take bound parameters (sink-filter Stage 15f3). Without this row a tainted
|
|
14347
|
+
// query built into `prepare` was no sink in either library.
|
|
14348
|
+
{ method: "prepare", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["better-sqlite3", "sqlite3"] },
|
|
14232
14349
|
{ method: "stream", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api", "duckdb", "duckdb-async", "react-native-duckdb"] },
|
|
14233
14350
|
{ method: "runAndRead", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
|
|
14234
14351
|
{ method: "runAndReadAll", type: "sql_injection", cwe: "CWE-89", severity: "critical", arg_positions: [0], languages: ["javascript", "typescript"], requires_import: ["@duckdb/node-api"] },
|
|
@@ -14528,16 +14645,16 @@ var DEFAULT_SINKS = [
|
|
|
14528
14645
|
{ method: "parse", class: "sax", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
|
|
14529
14646
|
{ method: "XMLParser", class: "lxml", type: "xxe", cwe: "CWE-611", severity: "high", arg_positions: [0] },
|
|
14530
14647
|
// Python LDAP Injection
|
|
14531
|
-
{ method: "search", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
|
|
14532
|
-
{ method: "search_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
|
|
14533
|
-
{ method: "search_ext", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
|
|
14534
|
-
{ method: "search_ext_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2] },
|
|
14648
|
+
{ method: "search", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
|
|
14649
|
+
{ method: "search_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
|
|
14650
|
+
{ method: "search_ext", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
|
|
14651
|
+
{ method: "search_ext_s", class: "ldap", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 2], languages: ["python"] },
|
|
14535
14652
|
// ldap3 library (different API from python-ldap)
|
|
14536
|
-
{ method: "search", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 1] },
|
|
14537
|
-
{ method: "extend", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
|
|
14538
|
-
{ method: "modify", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
|
|
14539
|
-
{ method: "add", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
|
|
14540
|
-
{ method: "delete", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0] },
|
|
14653
|
+
{ method: "search", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0, 1], languages: ["python"] },
|
|
14654
|
+
{ method: "extend", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
|
|
14655
|
+
{ method: "modify", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
|
|
14656
|
+
{ method: "add", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
|
|
14657
|
+
{ method: "delete", class: "Connection", type: "ldap_injection", cwe: "CWE-90", severity: "high", arg_positions: [0], languages: ["python"] },
|
|
14541
14658
|
// Python Trust Boundary (CWE-501)
|
|
14542
14659
|
// The vulnerability is storing untrusted data in session that gets trusted later
|
|
14543
14660
|
{ method: "__setitem__", class: "session", type: "trust_boundary", cwe: "CWE-501", severity: "medium", arg_positions: [1] },
|
|
@@ -14628,7 +14745,7 @@ var DEFAULT_SINKS = [
|
|
|
14628
14745
|
{ method: "put", class: "VelocityContext", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [1] },
|
|
14629
14746
|
{ method: "setVariable", class: "Context", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [1] },
|
|
14630
14747
|
// HTML sanitizer bypass markers (known CVE patterns)
|
|
14631
|
-
{ method: "clean", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
|
|
14748
|
+
{ method: "clean", class: "AntiSamy", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0], languages: ["java"] },
|
|
14632
14749
|
{ method: "getValidSafeHTML", class: "ESAPI", type: "xss", cwe: "CWE-79", severity: "medium", arg_positions: [0] },
|
|
14633
14750
|
// NOTE (cognium-dev#270): `HttpServletRequest`/`HttpSession.getAttribute()`
|
|
14634
14751
|
// were registered here as xss sinks to model "attribute reflection XSS", but
|
|
@@ -15951,6 +16068,11 @@ var TAINT_PATTERNS = [
|
|
|
15951
16068
|
".getParameterMap(",
|
|
15952
16069
|
".getHeader(",
|
|
15953
16070
|
".getHeaders(",
|
|
16071
|
+
// OWASP Benchmark SeparateClassRequest wrappers (cognium-dev #1107).
|
|
16072
|
+
// Do not add getTheValue — its body is a constant return (#914 S4).
|
|
16073
|
+
".getTheParameter(",
|
|
16074
|
+
".getTheHeaders(",
|
|
16075
|
+
".getTheCookies(",
|
|
15954
16076
|
".getValue(",
|
|
15955
16077
|
// Cookie.getValue()
|
|
15956
16078
|
".getCookies(",
|
|
@@ -16455,7 +16577,9 @@ function findSources(calls, types, patterns, sourceLines, language, imports) {
|
|
|
16455
16577
|
(p) => !p.languages || p.languages.length === 0 || p.languages.includes(language)
|
|
16456
16578
|
);
|
|
16457
16579
|
for (const call of calls) {
|
|
16580
|
+
const inMemoryMapGet = call.method_name === "get" && (language === "javascript" || language === "typescript") && isInMemoryMapGetReceiver(call.receiver, sourceLines);
|
|
16458
16581
|
for (const pattern of patternsForLanguage) {
|
|
16582
|
+
if (inMemoryMapGet && pattern.type === "db_input") continue;
|
|
16459
16583
|
if (matchesSourcePattern(call, pattern, language, types, imports)) {
|
|
16460
16584
|
sources.push({
|
|
16461
16585
|
type: pattern.type,
|
|
@@ -16576,7 +16700,14 @@ function findSources(calls, types, patterns, sourceLines, language, imports) {
|
|
|
16576
16700
|
}
|
|
16577
16701
|
const propertyPatterns = patterns.filter((p) => p.property && p.object && p.property_tainted);
|
|
16578
16702
|
const hasPropertyPatterns = propertyPatterns.length > 0;
|
|
16703
|
+
const jsCode = (language === "javascript" || language === "typescript") && sourceLines ? sourceLines.join("\n") : void 0;
|
|
16704
|
+
const noParamHelper = /* @__PURE__ */ new Map();
|
|
16579
16705
|
for (const call of calls) {
|
|
16706
|
+
if (jsCode !== void 0 && !call.receiver) {
|
|
16707
|
+
let drop = noParamHelper.get(call.method_name);
|
|
16708
|
+
if (drop === void 0) noParamHelper.set(call.method_name, drop = jsHelperReturnsNoParam(jsCode, call.method_name));
|
|
16709
|
+
if (drop) continue;
|
|
16710
|
+
}
|
|
16580
16711
|
for (const arg of call.arguments) {
|
|
16581
16712
|
if (arg.expression) {
|
|
16582
16713
|
const taintCheck = isJavaScriptTaintedArgument(arg.expression, hasPropertyPatterns ? patterns : void 0);
|
|
@@ -16856,8 +16987,16 @@ function isSafePythonSubprocessCall(call, pattern, language) {
|
|
|
16856
16987
|
const e = (a.expression ?? "").trim();
|
|
16857
16988
|
if (/^shell\s*=\s*True\b/.test(e)) return false;
|
|
16858
16989
|
}
|
|
16990
|
+
const first = /^\[\s*(?:[rbuRBU]{0,2})(['"])([^'"]*)\1\s*(?:,|\])/.exec(expr0);
|
|
16991
|
+
if (first) {
|
|
16992
|
+
const program = (first[2].split(/[\\/]/).pop() ?? first[2]).toLowerCase().replace(/\.exe$/, "");
|
|
16993
|
+
if (PYTHON_LIST_SHELLS.has(program) || runsArgvAsCommand(program)) return false;
|
|
16994
|
+
if (PYTHON_LIST_INTERPRETERS.test(program) && /,\s*(?:[rbuRBU]{0,2})(['"])-(?:c|e|-eval|-command)\1/.test(expr0)) return false;
|
|
16995
|
+
}
|
|
16859
16996
|
return true;
|
|
16860
16997
|
}
|
|
16998
|
+
var PYTHON_LIST_SHELLS = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash", "ash", "ksh", "csh", "tcsh", "fish", "cmd", "powershell", "pwsh"]);
|
|
16999
|
+
var PYTHON_LIST_INTERPRETERS = /^(?:python[\d.]*|pypy[\d.]*|perl|ruby|node|nodejs|php|lua|osascript)$/;
|
|
16861
17000
|
function isSafeGoExecCommandCall(call, pattern, language) {
|
|
16862
17001
|
if (language !== "go") return false;
|
|
16863
17002
|
if (pattern.type !== "command_injection") return false;
|
|
@@ -16892,6 +17031,7 @@ function isSafeGoExecCommandCall(call, pattern, language) {
|
|
|
16892
17031
|
"pwsh.exe"
|
|
16893
17032
|
]);
|
|
16894
17033
|
if (SHELL_PROGRAMS.has(program)) return false;
|
|
17034
|
+
if (runsArgvAsCommand(program)) return false;
|
|
16895
17035
|
const PACKAGE_MANAGER_EXEC_SUBCOMMANDS = {
|
|
16896
17036
|
go: /* @__PURE__ */ new Set(["install", "run", "get"]),
|
|
16897
17037
|
npm: /* @__PURE__ */ new Set(["install", "i", "exec"]),
|
|
@@ -16982,6 +17122,7 @@ function isSafeJSChildProcessCall(call, pattern, language) {
|
|
|
16982
17122
|
"pwsh.exe"
|
|
16983
17123
|
]);
|
|
16984
17124
|
if (SHELL_PROGRAMS.has(program)) return false;
|
|
17125
|
+
if (runsArgvAsCommand(program)) return false;
|
|
16985
17126
|
return true;
|
|
16986
17127
|
}
|
|
16987
17128
|
var CSHARP_SHELL_PROGRAMS = /* @__PURE__ */ new Set([
|
|
@@ -17000,7 +17141,7 @@ function isConstNonShellExe(raw) {
|
|
|
17000
17141
|
const t = raw.trim();
|
|
17001
17142
|
if (!/^@?"[^"]*"$/.test(t)) return false;
|
|
17002
17143
|
const program = (t.replace(/^@?"|"$/g, "").split(/[\\/]/).pop() ?? "").toLowerCase().replace(/\.exe$/, "");
|
|
17003
|
-
return !CSHARP_SHELL_PROGRAMS.has(program);
|
|
17144
|
+
return !CSHARP_SHELL_PROGRAMS.has(program) && !runsArgvAsCommand(program);
|
|
17004
17145
|
}
|
|
17005
17146
|
var PSI_CTOR_EXE_RE = /\bnew\s+ProcessStartInfo\s*(?:<[^>]*>)?\s*\(\s*(@?"[^"]*")/;
|
|
17006
17147
|
function processStartInfoExe(expr, sourceLines) {
|
|
@@ -17263,13 +17404,13 @@ function isSafeRustCommandCall(call, pattern, language) {
|
|
|
17263
17404
|
const stripped = expr.slice(1, -1);
|
|
17264
17405
|
program = stripped.split("/").pop() ?? stripped;
|
|
17265
17406
|
}
|
|
17266
|
-
return !SHELL_PROGRAMS.has(program);
|
|
17407
|
+
return !SHELL_PROGRAMS.has(program) && !runsArgvAsCommand(program);
|
|
17267
17408
|
}
|
|
17268
17409
|
if (pattern.method === "arg" || pattern.method === "args" || pattern.method === "spawn" || pattern.method === "output") {
|
|
17269
17410
|
const receiverText = call.receiver ?? "";
|
|
17270
17411
|
const program = extractProgram(receiverText);
|
|
17271
17412
|
if (program === null) return false;
|
|
17272
|
-
return !SHELL_PROGRAMS.has(program);
|
|
17413
|
+
return !SHELL_PROGRAMS.has(program) && !runsArgvAsCommand(program);
|
|
17273
17414
|
}
|
|
17274
17415
|
return false;
|
|
17275
17416
|
}
|
|
@@ -17347,8 +17488,29 @@ function isRegexReceiver(receiver, sourceLines) {
|
|
|
17347
17488
|
if (r.startsWith("/") && /\/[a-z]*$/.test(r)) return true;
|
|
17348
17489
|
if (/^(?:new\s+)?RegExp\s*\(/.test(r)) return true;
|
|
17349
17490
|
if (!/^[A-Za-z_$][\w$]*$/.test(r) || !sourceLines) return false;
|
|
17350
|
-
const
|
|
17351
|
-
|
|
17491
|
+
const n = escapeRe(r);
|
|
17492
|
+
const decl = new RegExp(`(?:const|let|var)\\s+${n}\\s*(?::\\s*RegExp\\s*)?=\\s*(?:/|(?:new\\s+)?RegExp\\s*\\()`);
|
|
17493
|
+
if (sourceLines.some((l) => decl.test(l))) return true;
|
|
17494
|
+
const wrapped = new RegExp(`(?:const|let|var)\\s+${n}\\s*(?::\\s*RegExp\\s*)?=\\s*$`);
|
|
17495
|
+
const typed = new RegExp(`\\b${n}\\s*[?!]?\\s*:\\s*RegExp\\b`);
|
|
17496
|
+
return sourceLines.some((l, i2) => typed.test(l) || wrapped.test(l) && /^\s*(?:\/|(?:new\s+)?RegExp\s*\()/.test(sourceLines[i2 + 1] ?? ""));
|
|
17497
|
+
}
|
|
17498
|
+
var DB_TYPE_NAME = /(?:connection|database|\bdb\b|db$|^db|pool|client|knex|sql|statement|prisma|sequelize|repository|transaction|query|store)/i;
|
|
17499
|
+
function isTypedNonDbReceiver(receiver, sourceLines) {
|
|
17500
|
+
const raw = (receiver ?? "").trim();
|
|
17501
|
+
if (!raw || !sourceLines) return false;
|
|
17502
|
+
const lastDot = raw.lastIndexOf(".");
|
|
17503
|
+
const name2 = (lastDot >= 0 ? raw.slice(lastDot + 1) : raw).trim();
|
|
17504
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(name2) || DB_TYPE_NAME.test(name2)) return false;
|
|
17505
|
+
const decl = raw.startsWith("this.") ? new RegExp(`^\\s*(?:(?:private|protected|public|readonly|static|declare)\\s+)+${escapeRe(name2)}\\s*[?!]?\\s*:\\s*([A-Za-z_$][\\w$]*)\\s*[;=]`) : new RegExp(`\\b${escapeRe(name2)}\\s*\\??\\s*:\\s*([A-Za-z_$][\\w$]*)\\s*[;,)=]`);
|
|
17506
|
+
let typed;
|
|
17507
|
+
for (const l of sourceLines) {
|
|
17508
|
+
const m = decl.exec(l);
|
|
17509
|
+
if (!m) continue;
|
|
17510
|
+
if (typed !== void 0 && typed !== m[1]) return false;
|
|
17511
|
+
typed = m[1];
|
|
17512
|
+
}
|
|
17513
|
+
return typed !== void 0 && !DB_TYPE_NAME.test(typed) && !/^(?:any|unknown|object)$/.test(typed);
|
|
17352
17514
|
}
|
|
17353
17515
|
function isNavigationReceiverName(receiver) {
|
|
17354
17516
|
const r = (receiver ?? "").trim();
|
|
@@ -17385,7 +17547,10 @@ function isDeclaredFunctionReference(arg, sourceLines) {
|
|
|
17385
17547
|
// const connect = () => / function / async () =>
|
|
17386
17548
|
new RegExp(
|
|
17387
17549
|
`\\b(?:const|let|var)\\s+${n}\\s*=\\s*(?:async\\s+)?(?:function\\b|\\(|[A-Za-z_$][\\w$]*\\s*=>)`
|
|
17388
|
-
)
|
|
17550
|
+
),
|
|
17551
|
+
// A Promise executor's resolve / reject: `new Promise((r) => setTimeout(r, ms))`,
|
|
17552
|
+
// the sleep idiom (dogfood 2026-10-31, controldeck harness).
|
|
17553
|
+
new RegExp(`\\bnew\\s+Promise\\s*(?:<[^>]*>)?\\s*\\(\\s*(?:async\\s+)?(?:\\(\\s*(?:[A-Za-z_$][\\w$]*\\s*,\\s*)?${n}\\s*[,)]|${n}\\s*=>|function\\s*\\(\\s*(?:[A-Za-z_$][\\w$]*\\s*,\\s*)?${n}\\s*[,)])`)
|
|
17389
17554
|
];
|
|
17390
17555
|
return sourceLines.some((l) => decls.some((re) => re.test(l)));
|
|
17391
17556
|
}
|
|
@@ -17646,7 +17811,10 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines, types)
|
|
|
17646
17811
|
if ((pattern.type === "command_injection" || pattern.type === "sql_injection") && call.method_name === "exec" && (language === "javascript" || language === "typescript") && isRegexReceiver(call.receiver, sourceLines)) {
|
|
17647
17812
|
continue;
|
|
17648
17813
|
}
|
|
17649
|
-
if (pattern.type === "sql_injection" && call.method_name === "get" && pattern.class === "Connection" && (language === "javascript" || language === "typescript") && isInMemoryMapGetReceiver(call.receiver, sourceLines)) {
|
|
17814
|
+
if (pattern.type === "sql_injection" && call.method_name === "get" && pattern.class === "Connection" && (language === "javascript" || language === "typescript") && (isInMemoryMapGetReceiver(call.receiver, sourceLines) || isTypedNonDbReceiver(call.receiver, sourceLines))) {
|
|
17815
|
+
continue;
|
|
17816
|
+
}
|
|
17817
|
+
if (call.method_name === "get" && (language === "javascript" || language === "typescript") && isInMemoryMapGetReceiver(call.receiver, sourceLines)) {
|
|
17650
17818
|
continue;
|
|
17651
17819
|
}
|
|
17652
17820
|
if (pattern.type === "code_injection" && language === "python" && call.method_name === "compile" && call.receiver && call.receiver !== "builtins") {
|
|
@@ -17701,6 +17869,7 @@ function matchesSourcePattern(call, pattern, language, types, imports) {
|
|
|
17701
17869
|
}
|
|
17702
17870
|
if (pattern.class && pattern.class !== "constructor") {
|
|
17703
17871
|
if (call.receiver_type && call.receiver_type === pattern.class) {
|
|
17872
|
+
} else if (call.receiver_type && call.receiver_type.includes(".") && call.receiver_type.endsWith("." + pattern.class)) {
|
|
17704
17873
|
} else if (call.receiver_type_fqn && call.receiver_type_fqn.endsWith("." + pattern.class)) {
|
|
17705
17874
|
} else if (!call.receiver) {
|
|
17706
17875
|
const target = call.resolution?.target;
|
|
@@ -20226,10 +20395,11 @@ var ConstantPropagator = class _ConstantPropagator {
|
|
|
20226
20395
|
/**
|
|
20227
20396
|
* Analyze source code and build constant propagation state.
|
|
20228
20397
|
*/
|
|
20229
|
-
analyze(tree, sourceCode, additionalTaintPatterns = [], sanitizerMethods = [], taintedParameters = []) {
|
|
20398
|
+
analyze(tree, sourceCode, additionalTaintPatterns = [], sanitizerMethods = [], taintedParameters = [], language) {
|
|
20230
20399
|
this.source = sourceCode;
|
|
20231
20400
|
this.additionalTaintPatterns = additionalTaintPatterns;
|
|
20232
20401
|
this.taintedParametersList = taintedParameters;
|
|
20402
|
+
const omitJavaUnscopedTaintAliases = language === "java";
|
|
20233
20403
|
this.symbols.clear();
|
|
20234
20404
|
this.tainted.clear();
|
|
20235
20405
|
this.unreachableLines.clear();
|
|
@@ -20288,10 +20458,22 @@ var ConstantPropagator = class _ConstantPropagator {
|
|
|
20288
20458
|
if (/^[^:]+:b\d+:/.test(name2)) {
|
|
20289
20459
|
continue;
|
|
20290
20460
|
}
|
|
20461
|
+
if (omitJavaUnscopedTaintAliases) {
|
|
20462
|
+
continue;
|
|
20463
|
+
}
|
|
20291
20464
|
const unscoped = name2.substring(name2.indexOf(":") + 1);
|
|
20292
20465
|
resultTainted.add(unscoped);
|
|
20293
20466
|
}
|
|
20294
20467
|
}
|
|
20468
|
+
if (omitJavaUnscopedTaintAliases) {
|
|
20469
|
+
for (const name2 of this.tainted) {
|
|
20470
|
+
if (!name2.includes(":") || /^[^:]+:b\d+:/.test(name2)) continue;
|
|
20471
|
+
const local = name2.substring(name2.indexOf(":") + 1);
|
|
20472
|
+
if (this.classFields.has(local)) {
|
|
20473
|
+
resultTainted.add(local);
|
|
20474
|
+
}
|
|
20475
|
+
}
|
|
20476
|
+
}
|
|
20295
20477
|
const resultScopes = new Map(this.sanitizedVarUncovered);
|
|
20296
20478
|
for (const name2 of this.sanitizedVars) {
|
|
20297
20479
|
if (name2.includes(":")) {
|
|
@@ -22743,7 +22925,8 @@ function analyzeConstantPropagation(tree, sourceCode, options = {}) {
|
|
|
22743
22925
|
sourceCode,
|
|
22744
22926
|
options.additionalTaintPatterns ?? [],
|
|
22745
22927
|
options.sanitizerMethods ?? [],
|
|
22746
|
-
options.taintedParameters ?? []
|
|
22928
|
+
options.taintedParameters ?? [],
|
|
22929
|
+
options.language
|
|
22747
22930
|
);
|
|
22748
22931
|
}
|
|
22749
22932
|
function isFalsePositive(result, sinkLine, taintedVar) {
|