From 41b5fc17abd494b374a79119a76674f402e3757d Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Wed, 13 May 2020 15:40:36 +0100 Subject: [PATCH] Inline two single-use predicates. This fixes a TODO. --- ql/src/semmle/go/frameworks/NoSQL.qll | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ql/src/semmle/go/frameworks/NoSQL.qll b/ql/src/semmle/go/frameworks/NoSQL.qll index 46c73d6ad40..d80fe3f20b7 100644 --- a/ql/src/semmle/go/frameworks/NoSQL.qll +++ b/ql/src/semmle/go/frameworks/NoSQL.qll @@ -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" ) }