circle-ir 3.97.0 → 3.99.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.
@@ -12615,6 +12615,25 @@ function isSafeGoJsonUnmarshalCall(call, pattern, language, sourceLines) {
12615
12615
  }
12616
12616
  return false;
12617
12617
  }
12618
+ var TEMPLATE_LITERAL_RECEIVER_RE = /^Template\(\s*(?:"[^"\\]*"|'[^'\\]*')\s*\)$/;
12619
+ function isSafeJinjaRenderCall(call, pattern, language) {
12620
+ if (language !== "python") return false;
12621
+ if (pattern.type !== "xss" && pattern.type !== "code_injection") return false;
12622
+ const method = call.method_name;
12623
+ if (method === "render_template_string") {
12624
+ const arg0 = call.arguments.find((a) => a.position === 0);
12625
+ return typeof arg0?.literal === "string";
12626
+ }
12627
+ if (method === "Template" || method === "from_string") {
12628
+ const arg0 = call.arguments.find((a) => a.position === 0);
12629
+ return typeof arg0?.literal === "string";
12630
+ }
12631
+ if (method === "render") {
12632
+ const receiver = (call.receiver ?? "").trim();
12633
+ return TEMPLATE_LITERAL_RECEIVER_RE.test(receiver);
12634
+ }
12635
+ return false;
12636
+ }
12618
12637
  function findSinks(calls, patterns, typeHierarchy, language, sourceLines) {
12619
12638
  const sinkMap = /* @__PURE__ */ new Map();
12620
12639
  for (const call of calls) {
@@ -12656,6 +12675,9 @@ function findSinks(calls, patterns, typeHierarchy, language, sourceLines) {
12656
12675
  if (isSafeGoJsonUnmarshalCall(call, pattern, language, sourceLines)) {
12657
12676
  continue;
12658
12677
  }
12678
+ if (isSafeJinjaRenderCall(call, pattern, language)) {
12679
+ continue;
12680
+ }
12659
12681
  const location = formatCallLocation(call);
12660
12682
  const key = `${location}:${call.location.line}:${pattern.cwe}`;
12661
12683
  const confidence = calculateSinkConfidence(call, pattern);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circle-ir",
3
- "version": "3.97.0",
3
+ "version": "3.99.0",
4
4
  "description": "High-performance Static Application Security Testing (SAST) library for detecting security vulnerabilities through taint analysis",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",