Python: inline mongoCollectionMethod

This commit is contained in:
Rasmus Lerchedahl Petersen
2022-09-28 11:40:06 +02:00
parent 70d47f313e
commit 63ee51a4e2

View File

@@ -101,21 +101,6 @@ private module NoSql {
}
}
/**
* Gets a reference to a `Mongo` collection method.
*
* ```py
* from flask_pymongo import PyMongo
* mongo = PyMongo(app)
* mongo.db.user.find({'name': safe_search})
* ```
*
* `mongo.db.user.find` would be a collection method.
*/
private API::Node mongoCollectionMethod() {
result = mongoCollection().getMember(any(MongoCollectionMethodNames m))
}
/**
* Gets a reference to a `Mongo` collection method call
*
@@ -125,10 +110,12 @@ private module NoSql {
* mongo.db.user.find({'name': safe_search})
* ```
*
* `mongo.db.user.find({'name': safe_search})` would be a collection method call, and so the result.
* `mongo.db.user.find({'name': safe_search})` would be a collection method call.
*/
private class MongoCollectionCall extends DataFlow::CallCfgNode, NoSqlQuery::Range {
MongoCollectionCall() { this = mongoCollectionMethod().getACall() }
MongoCollectionCall() {
this = mongoCollection().getMember(any(MongoCollectionMethodNames m)).getACall()
}
override DataFlow::Node getQuery() { result = this.getArg(0) }
}