Skip to content

Commit 01ad25f

Browse files
committed
Apply .getALocalSource() and fix xmltodict's vulnerable predicate
1 parent 7c4a6a1 commit 01ad25f

File tree

1 file changed

+8
-4
lines changed
  • python/ql/src/experimental/semmle/python/frameworks

1 file changed

+8
-4
lines changed

python/ql/src/experimental/semmle/python/frameworks/Xml.qll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,16 @@ private module Xml {
163163
override DataFlow::Node getAnInput() { none() }
164164

165165
override predicate vulnerable(string kind) {
166-
kind = "XXE" and not this.getArgByName("resolve_entities").asExpr() = any(False f)
166+
kind = "XXE" and
167+
not (
168+
exists(this.getArgByName("resolve_entities")) or
169+
this.getArgByName("resolve_entities").getALocalSource().asExpr() = any(False f)
170+
)
167171
or
168172
kind = ["Billion Laughs", "Quadratic Blowup"] and
169173
(
170-
this.getArgByName("huge_tree").asExpr() = any(True t) and
171-
not this.getArgByName("resolve_entities").asExpr() = any(False f)
174+
this.getArgByName("huge_tree").getALocalSource().asExpr() = any(True t) and
175+
not this.getArgByName("resolve_entities").getALocalSource().asExpr() = any(False f)
172176
)
173177
}
174178
}
@@ -231,7 +235,7 @@ private module Xml {
231235

232236
override predicate vulnerable(string kind) {
233237
kind = ["Billion Laughs", "Quadratic Blowup"] and
234-
this.getAMethodCall("disable_entities").asExpr() = any(False f)
238+
this.getArgByName("disable_entities").getALocalSource().asExpr() = any(False f)
235239
}
236240
}
237241

0 commit comments

Comments
 (0)