mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Python: rename concept
`NoSqlQuery` -> `NoSqlExecution`
This commit is contained in:
@@ -379,7 +379,7 @@ module SqlExecution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Provides a class for modeling NoSql execution APIs. */
|
/** Provides a class for modeling NoSql execution APIs. */
|
||||||
module NoSqlQuery {
|
module NoSqlExecution {
|
||||||
/**
|
/**
|
||||||
* A data-flow node that executes NoSQL queries.
|
* A data-flow node that executes NoSQL queries.
|
||||||
*
|
*
|
||||||
@@ -404,7 +404,7 @@ module NoSqlQuery {
|
|||||||
* Extend this class to refine existing API models. If you want to model new APIs,
|
* Extend this class to refine existing API models. If you want to model new APIs,
|
||||||
* extend `NoSQLQuery::Range` instead.
|
* extend `NoSQLQuery::Range` instead.
|
||||||
*/
|
*/
|
||||||
class NoSqlQuery extends DataFlow::Node instanceof NoSqlQuery::Range {
|
class NoSqlExecution extends DataFlow::Node instanceof NoSqlExecution::Range {
|
||||||
/** Gets the argument that specifies the NoSql query to be executed. */
|
/** Gets the argument that specifies the NoSql query to be executed. */
|
||||||
DataFlow::Node getQuery() { result = super.getQuery() }
|
DataFlow::Node getQuery() { result = super.getQuery() }
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ private module NoSql {
|
|||||||
*
|
*
|
||||||
* `mongo.db.user.find({'name': safe_search})` would be a collection method call.
|
* `mongo.db.user.find({'name': safe_search})` would be a collection method call.
|
||||||
*/
|
*/
|
||||||
private class MongoCollectionCall extends DataFlow::CallCfgNode, NoSqlQuery::Range {
|
private class MongoCollectionCall extends DataFlow::CallCfgNode, NoSqlExecution::Range {
|
||||||
MongoCollectionCall() {
|
MongoCollectionCall() {
|
||||||
this = mongoCollection().getMember(mongoCollectionMethodName()).getACall()
|
this = mongoCollection().getMember(mongoCollectionMethodName()).getACall()
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ private module NoSql {
|
|||||||
override predicate vulnerableToStrings() { none() }
|
override predicate vulnerableToStrings() { none() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MongoCollectionAggregation extends API::CallNode, NoSqlQuery::Range {
|
private class MongoCollectionAggregation extends API::CallNode, NoSqlExecution::Range {
|
||||||
MongoCollectionAggregation() { this = mongoCollection().getMember("aggregate").getACall() }
|
MongoCollectionAggregation() { this = mongoCollection().getMember("aggregate").getACall() }
|
||||||
|
|
||||||
override DataFlow::Node getQuery() { result = this.getParameter(0).getASubscript().asSink() }
|
override DataFlow::Node getQuery() { result = this.getParameter(0).getASubscript().asSink() }
|
||||||
@@ -132,7 +132,7 @@ private module NoSql {
|
|||||||
override predicate vulnerableToStrings() { none() }
|
override predicate vulnerableToStrings() { none() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MongoMapReduce extends API::CallNode, NoSqlQuery::Range {
|
private class MongoMapReduce extends API::CallNode, NoSqlExecution::Range {
|
||||||
MongoMapReduce() { this = mongoCollection().getMember("map_reduce").getACall() }
|
MongoMapReduce() { this = mongoCollection().getMember("map_reduce").getACall() }
|
||||||
|
|
||||||
override DataFlow::Node getQuery() { result in [this.getArg(0), this.getArg(1)] }
|
override DataFlow::Node getQuery() { result in [this.getArg(0), this.getArg(1)] }
|
||||||
@@ -142,7 +142,7 @@ private module NoSql {
|
|||||||
override predicate vulnerableToStrings() { any() }
|
override predicate vulnerableToStrings() { any() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MongoMapReduceQuery extends API::CallNode, NoSqlQuery::Range {
|
private class MongoMapReduceQuery extends API::CallNode, NoSqlExecution::Range {
|
||||||
MongoMapReduceQuery() { this = mongoCollection().getMember("map_reduce").getACall() }
|
MongoMapReduceQuery() { this = mongoCollection().getMember("map_reduce").getACall() }
|
||||||
|
|
||||||
override DataFlow::Node getQuery() { result in [this.getArgByName("query")] }
|
override DataFlow::Node getQuery() { result in [this.getArgByName("query")] }
|
||||||
@@ -248,7 +248,7 @@ private module NoSql {
|
|||||||
*
|
*
|
||||||
* `Movie.objects(__raw__=json_search)` would be the result.
|
* `Movie.objects(__raw__=json_search)` would be the result.
|
||||||
*/
|
*/
|
||||||
private class MongoEngineObjectsCall extends DataFlow::CallCfgNode, NoSqlQuery::Range {
|
private class MongoEngineObjectsCall extends DataFlow::CallCfgNode, NoSqlExecution::Range {
|
||||||
MongoEngineObjectsCall() {
|
MongoEngineObjectsCall() {
|
||||||
this =
|
this =
|
||||||
[mongoEngine(), flask_MongoEngine()]
|
[mongoEngine(), flask_MongoEngine()]
|
||||||
|
|||||||
@@ -60,17 +60,17 @@ module NoSqlInjection {
|
|||||||
class RemoteFlowSourceAsStringSource extends RemoteFlowSource, StringSource { }
|
class RemoteFlowSourceAsStringSource extends RemoteFlowSource, StringSource { }
|
||||||
|
|
||||||
/** A NoSQL query that is vulnerable to user controlled strings. */
|
/** A NoSQL query that is vulnerable to user controlled strings. */
|
||||||
class NoSqlQueryAsStringSink extends StringSink {
|
class NoSqlExecutionAsStringSink extends StringSink {
|
||||||
NoSqlQueryAsStringSink() {
|
NoSqlExecutionAsStringSink() {
|
||||||
exists(NoSqlQuery noSqlQuery | this = noSqlQuery.getQuery() |
|
exists(NoSqlExecution noSqlExecution | this = noSqlExecution.getQuery() |
|
||||||
noSqlQuery.vulnerableToStrings()
|
noSqlExecution.vulnerableToStrings()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A NoSQL query that is vulnerable to user controlled dictionaries. */
|
/** A NoSQL query that is vulnerable to user controlled dictionaries. */
|
||||||
class NoSqlQueryAsDictSink extends DictSink {
|
class NoSqlExecutionAsDictSink extends DictSink {
|
||||||
NoSqlQueryAsDictSink() { this = any(NoSqlQuery noSqlQuery).getQuery() }
|
NoSqlExecutionAsDictSink() { this = any(NoSqlExecution noSqlExecution).getQuery() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A JSON decoding converts a string to a dictionary. */
|
/** A JSON decoding converts a string to a dictionary. */
|
||||||
|
|||||||
Reference in New Issue
Block a user