Inline two single-use predicates.

This fixes a TODO.
This commit is contained in:
Max Schaefer
2020-05-13 15:40:36 +01:00
parent 6e58524b78
commit 41b5fc17ab

View File

@@ -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"
)
}