From e1708054a46c460bc45a98e856c7ad654ca39ee4 Mon Sep 17 00:00:00 2001 From: Rasmus Lerchedahl Petersen Date: Fri, 29 Sep 2023 12:06:51 +0200 Subject: [PATCH] Python: fix QL alert --- python/ql/lib/semmle/python/frameworks/PyMongo.qll | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/ql/lib/semmle/python/frameworks/PyMongo.qll b/python/ql/lib/semmle/python/frameworks/PyMongo.qll index 27c40f1e1c6..148cb074a10 100644 --- a/python/ql/lib/semmle/python/frameworks/PyMongo.qll +++ b/python/ql/lib/semmle/python/frameworks/PyMongo.qll @@ -153,14 +153,15 @@ private module PyMongo { /** The `$where` query operator executes a string as JavaScript. */ private class WhereQueryOperator extends DataFlow::Node, Decoding::Range { - API::Node dictionary; DataFlow::Node query; WhereQueryOperator() { - dictionary = - mongoCollection().getMember(mongoCollectionMethodName()).getACall().getParameter(0) and - query = dictionary.getSubscript("$where").asSink() and - this = dictionary.getAValueReachingSink() + exists(API::Node dictionary | + dictionary = + mongoCollection().getMember(mongoCollectionMethodName()).getACall().getParameter(0) and + query = dictionary.getSubscript("$where").asSink() and + this = dictionary.getAValueReachingSink() + ) } override DataFlow::Node getAnInput() { result = query }