mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Inline two single-use predicates.
This fixes a TODO.
This commit is contained in:
@@ -18,11 +18,6 @@ module NoSQL {
|
||||
NoSQLQueryString() { this = self }
|
||||
}
|
||||
|
||||
//TODO : Replace the following two predicate definitions with a simple call to package()
|
||||
private string mongoDb() { result = "go.mongodb.org/mongo-driver/mongo" }
|
||||
|
||||
private string mongoBsonPrimitive() { result = "go.mongodb.org/mongo-driver/bson/primitive" }
|
||||
|
||||
/** Provides classes for working with SQL query strings. */
|
||||
module NoSQLQueryString {
|
||||
/**
|
||||
@@ -89,7 +84,7 @@ module NoSQL {
|
||||
MongoDbCollectionQueryString() {
|
||||
exists(Method meth, string methodName, int n |
|
||||
collectionMethods(methodName, n) and
|
||||
meth.hasQualifiedName(mongoDb(), "Collection", methodName) and
|
||||
meth.hasQualifiedName("go.mongodb.org/mongo-driver/mongo", "Collection", methodName) and
|
||||
this = meth.getACall().getArgument(n)
|
||||
)
|
||||
}
|
||||
@@ -103,7 +98,7 @@ module NoSQL {
|
||||
// Taint an entry if the `Value` is tainted
|
||||
exists(Write w, DataFlow::Node base, Field f | w.writesField(base, f, pred) |
|
||||
base = succ.getASuccessor*() and
|
||||
base.getType().hasQualifiedName(mongoBsonPrimitive(), "E") and
|
||||
base.getType().hasQualifiedName("go.mongodb.org/mongo-driver/bson/primitive", "E") and
|
||||
f.getName() = "Value"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user