Skip to content

Commit e170805

Browse files
committed
Python: fix QL alert
1 parent 2d845e3 commit e170805

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

python/ql/lib/semmle/python/frameworks/PyMongo.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,15 @@ private module PyMongo {
153153

154154
/** The `$where` query operator executes a string as JavaScript. */
155155
private class WhereQueryOperator extends DataFlow::Node, Decoding::Range {
156-
API::Node dictionary;
157156
DataFlow::Node query;
158157

159158
WhereQueryOperator() {
160-
dictionary =
161-
mongoCollection().getMember(mongoCollectionMethodName()).getACall().getParameter(0) and
162-
query = dictionary.getSubscript("$where").asSink() and
163-
this = dictionary.getAValueReachingSink()
159+
exists(API::Node dictionary |
160+
dictionary =
161+
mongoCollection().getMember(mongoCollectionMethodName()).getACall().getParameter(0) and
162+
query = dictionary.getSubscript("$where").asSink() and
163+
this = dictionary.getAValueReachingSink()
164+
)
164165
}
165166

166167
override DataFlow::Node getAnInput() { result = query }

0 commit comments

Comments
 (0)