From db201192670a72fff2717bd75002a083dcb9dfb8 Mon Sep 17 00:00:00 2001 From: Sauyon Lee Date: Fri, 5 Mar 2021 03:41:09 -0800 Subject: [PATCH] Remove now-unnecessary bindingset annotations --- ql/src/semmle/go/frameworks/Beego.qll | 5 ----- ql/src/semmle/go/frameworks/BeegoOrm.qll | 1 - ql/src/semmle/go/frameworks/Chi.qll | 1 - ql/src/semmle/go/frameworks/Couchbase.qll | 1 - ql/src/semmle/go/frameworks/Echo.qll | 1 - ql/src/semmle/go/frameworks/ElazarlGoproxy.qll | 1 - ql/src/semmle/go/frameworks/Email.qll | 1 - ql/src/semmle/go/frameworks/Encoding.qll | 1 - ql/src/semmle/go/frameworks/EvanphxJsonPatch.qll | 1 - ql/src/semmle/go/frameworks/Gin.qll | 1 - ql/src/semmle/go/frameworks/GoKit.qll | 2 -- ql/src/semmle/go/frameworks/GoRestfulHttp.qll | 1 - ql/src/semmle/go/frameworks/K8sIoApiCoreV1.qll | 1 - ql/src/semmle/go/frameworks/K8sIoApimachineryPkgRuntime.qll | 1 - ql/src/semmle/go/frameworks/K8sIoClientGo.qll | 1 - ql/src/semmle/go/frameworks/Logrus.qll | 1 - ql/src/semmle/go/frameworks/Protobuf.qll | 4 ---- ql/src/semmle/go/frameworks/Revel.qll | 1 - ql/src/semmle/go/frameworks/SQL.qll | 3 --- ql/src/semmle/go/frameworks/Spew.qll | 1 - ql/src/semmle/go/frameworks/SystemCommandExecutors.qll | 1 - ql/src/semmle/go/frameworks/Testing.qll | 1 - ql/src/semmle/go/frameworks/WebSocket.qll | 4 ---- ql/src/semmle/go/frameworks/XNetHtml.qll | 1 - ql/src/semmle/go/frameworks/XPath.qll | 1 - ql/src/semmle/go/frameworks/Yaml.qll | 1 - ql/src/semmle/go/frameworks/Zap.qll | 1 - ql/src/semmle/go/frameworks/stdlib/Context.qll | 1 - ql/test/library-tests/semmle/go/Packages/main.go | 4 ++-- ql/test/library-tests/semmle/go/Packages/package.expected | 4 ++-- 30 files changed, 4 insertions(+), 45 deletions(-) diff --git a/ql/src/semmle/go/frameworks/Beego.qll b/ql/src/semmle/go/frameworks/Beego.qll index a893da684ed..1184938c347 100644 --- a/ql/src/semmle/go/frameworks/Beego.qll +++ b/ql/src/semmle/go/frameworks/Beego.qll @@ -9,23 +9,18 @@ private import semmle.go.security.SafeUrlFlowCustomizations module Beego { /** Gets the module path `github.com/astaxie/beego` or `github.com/beego/beego`. */ - bindingset[result] string modulePath() { result = ["github.com/astaxie/beego", "github.com/beego/beego"] } /** Gets the path for the root package of beego. */ - bindingset[result] string packagePath() { result = package(modulePath(), "") } /** Gets the path for the context package of beego. */ - bindingset[result] string contextPackagePath() { result = package(modulePath(), "context") } /** Gets the path for the logs package of beego. */ - bindingset[result] string logsPackagePath() { result = package(modulePath(), "logs") } /** Gets the path for the utils package of beego. */ - bindingset[result] string utilsPackagePath() { result = package(modulePath(), "utils") } /** diff --git a/ql/src/semmle/go/frameworks/BeegoOrm.qll b/ql/src/semmle/go/frameworks/BeegoOrm.qll index c6410bd117d..cec8783afa5 100644 --- a/ql/src/semmle/go/frameworks/BeegoOrm.qll +++ b/ql/src/semmle/go/frameworks/BeegoOrm.qll @@ -8,7 +8,6 @@ private import semmle.go.security.StoredXssCustomizations module BeegoOrm { /** Gets the package name `github.com/astaxie/beego/orm`. */ - bindingset[result] string packagePath() { result = package("github.com/astaxie/beego", "orm") } private class DbSink extends SQL::QueryString::Range { diff --git a/ql/src/semmle/go/frameworks/Chi.qll b/ql/src/semmle/go/frameworks/Chi.qll index c50a56641ce..89f1a41d350 100644 --- a/ql/src/semmle/go/frameworks/Chi.qll +++ b/ql/src/semmle/go/frameworks/Chi.qll @@ -6,7 +6,6 @@ import go private module Chi { /** Gets the package name `github.com/go-chi/chi`. */ - bindingset[result] string packagePath() { result = package("github.com/go-chi/chi", "") } /** diff --git a/ql/src/semmle/go/frameworks/Couchbase.qll b/ql/src/semmle/go/frameworks/Couchbase.qll index 7d339c197c7..983c445d710 100644 --- a/ql/src/semmle/go/frameworks/Couchbase.qll +++ b/ql/src/semmle/go/frameworks/Couchbase.qll @@ -14,7 +14,6 @@ module Couchbase { * Note that v1 and v2 have different APIs, but the names are disjoint so there is no need to * distinguish between them. */ - bindingset[result] string packagePath() { result = package([ diff --git a/ql/src/semmle/go/frameworks/Echo.qll b/ql/src/semmle/go/frameworks/Echo.qll index 330868f1d68..df58b492b87 100644 --- a/ql/src/semmle/go/frameworks/Echo.qll +++ b/ql/src/semmle/go/frameworks/Echo.qll @@ -7,7 +7,6 @@ import go private module Echo { /** Gets the package name `github.com/labstack/echo`. */ - bindingset[result] private string packagePath() { result = package("github.com/labstack/echo", "") } /** diff --git a/ql/src/semmle/go/frameworks/ElazarlGoproxy.qll b/ql/src/semmle/go/frameworks/ElazarlGoproxy.qll index f6023ba12c7..0ab4e48375b 100644 --- a/ql/src/semmle/go/frameworks/ElazarlGoproxy.qll +++ b/ql/src/semmle/go/frameworks/ElazarlGoproxy.qll @@ -9,7 +9,6 @@ import go */ module ElazarlGoproxy { /** Gets the package name. */ - bindingset[result] string packagePath() { result = package("github.com/elazarl/goproxy", "") } private class NewResponse extends HTTP::HeaderWrite::Range, DataFlow::CallNode { diff --git a/ql/src/semmle/go/frameworks/Email.qll b/ql/src/semmle/go/frameworks/Email.qll index c4234ae6e20..049af5f87bf 100644 --- a/ql/src/semmle/go/frameworks/Email.qll +++ b/ql/src/semmle/go/frameworks/Email.qll @@ -44,7 +44,6 @@ module EmailData { } /** Gets the package name `github.com/sendgrid/sendgrid-go/helpers/mail`. */ - bindingset[result] private string sendgridMail() { result = package("github.com/sendgrid/sendgrid-go", "helpers/mail") } diff --git a/ql/src/semmle/go/frameworks/Encoding.qll b/ql/src/semmle/go/frameworks/Encoding.qll index ad1fabf5522..a53f36bec48 100644 --- a/ql/src/semmle/go/frameworks/Encoding.qll +++ b/ql/src/semmle/go/frameworks/Encoding.qll @@ -5,7 +5,6 @@ import go /** Gets the package name `github.com/json-iterator/go`. */ -bindingset[result] private string packagePath() { result = package("github.com/json-iterator/go", "") } /** A model of json-iterator's `Unmarshal` function, propagating taint from the JSON input to the decoded object. */ diff --git a/ql/src/semmle/go/frameworks/EvanphxJsonPatch.qll b/ql/src/semmle/go/frameworks/EvanphxJsonPatch.qll index 7904fea7a03..6408b3d1d4c 100644 --- a/ql/src/semmle/go/frameworks/EvanphxJsonPatch.qll +++ b/ql/src/semmle/go/frameworks/EvanphxJsonPatch.qll @@ -6,7 +6,6 @@ import go private module EvanphxJsonPatch { /** Gets the package name `github.com/evanphx/json-patch`. */ - bindingset[result] private string packagePath() { result = package("github.com/evanphx/json-patch", "") } private class MergeMergePatches extends TaintTracking::FunctionModel { diff --git a/ql/src/semmle/go/frameworks/Gin.qll b/ql/src/semmle/go/frameworks/Gin.qll index 7007177d1fe..87212868ae3 100644 --- a/ql/src/semmle/go/frameworks/Gin.qll +++ b/ql/src/semmle/go/frameworks/Gin.qll @@ -6,7 +6,6 @@ import go private module Gin { /** Gets the package name `github.com/gin-gonic/gin`. */ - bindingset[result] string packagePath() { result = package("github.com/gin-gonic/gin", "") } /** diff --git a/ql/src/semmle/go/frameworks/GoKit.qll b/ql/src/semmle/go/frameworks/GoKit.qll index 2d19e06cdbc..c501858997c 100644 --- a/ql/src/semmle/go/frameworks/GoKit.qll +++ b/ql/src/semmle/go/frameworks/GoKit.qll @@ -12,7 +12,6 @@ import go */ module GoKit { /** Gets the package name. */ - bindingset[result] string packagePath() { result = package("github.com/go-kit/kit", "") } /** @@ -21,7 +20,6 @@ module GoKit { */ module Endpoint { /** Gets the package name. */ - bindingset[result] string endpointPackagePath() { result = package("github.com/go-kit/kit", "endpoint") } // gets a function that returns an endpoint diff --git a/ql/src/semmle/go/frameworks/GoRestfulHttp.qll b/ql/src/semmle/go/frameworks/GoRestfulHttp.qll index 05ad3095376..82163bce619 100644 --- a/ql/src/semmle/go/frameworks/GoRestfulHttp.qll +++ b/ql/src/semmle/go/frameworks/GoRestfulHttp.qll @@ -5,7 +5,6 @@ import go */ private module GoRestfulHttp { /** Gets the package name `github.com/emicklei/go-restful`. */ - bindingset[result] string packagePath() { result = package("github.com/emicklei/go-restful", "") } /** diff --git a/ql/src/semmle/go/frameworks/K8sIoApiCoreV1.qll b/ql/src/semmle/go/frameworks/K8sIoApiCoreV1.qll index 9b4bd97c37b..7752a95f400 100644 --- a/ql/src/semmle/go/frameworks/K8sIoApiCoreV1.qll +++ b/ql/src/semmle/go/frameworks/K8sIoApiCoreV1.qll @@ -7,7 +7,6 @@ import go */ module K8sIoApiCoreV1 { /** Gets the package name `k8s.io/api/core/v1`. */ - bindingset[result] string packagePath() { result = package("k8s.io/api", "core/v1") } private class SecretDeepCopy extends TaintTracking::FunctionModel, Method { diff --git a/ql/src/semmle/go/frameworks/K8sIoApimachineryPkgRuntime.qll b/ql/src/semmle/go/frameworks/K8sIoApimachineryPkgRuntime.qll index 774322c41e2..aecc2166ffe 100644 --- a/ql/src/semmle/go/frameworks/K8sIoApimachineryPkgRuntime.qll +++ b/ql/src/semmle/go/frameworks/K8sIoApimachineryPkgRuntime.qll @@ -7,7 +7,6 @@ import go */ module K8sIoApimachineryPkgRuntime { /** Gets the package name `k8s.io/apimachinery/pkg/runtime`. */ - bindingset[result] string packagePath() { result = package("k8s.io/apimachinery", "pkg/runtime") } private class ConvertTypeToType extends TaintTracking::FunctionModel { diff --git a/ql/src/semmle/go/frameworks/K8sIoClientGo.qll b/ql/src/semmle/go/frameworks/K8sIoClientGo.qll index c4c9ca34673..c087cc26ff8 100644 --- a/ql/src/semmle/go/frameworks/K8sIoClientGo.qll +++ b/ql/src/semmle/go/frameworks/K8sIoClientGo.qll @@ -8,7 +8,6 @@ import go */ module K8sIoClientGo { /** Gets the package name `k8s.io/client-go/kubernetes/typed/core/v1`. */ - bindingset[result] string packagePath() { result = package("k8s.io/client-go", "kubernetes/typed/core/v1") } /** diff --git a/ql/src/semmle/go/frameworks/Logrus.qll b/ql/src/semmle/go/frameworks/Logrus.qll index d89fc9db35f..1106cb57b06 100644 --- a/ql/src/semmle/go/frameworks/Logrus.qll +++ b/ql/src/semmle/go/frameworks/Logrus.qll @@ -5,7 +5,6 @@ import go /** Provides models of commonly used functions in the `github.com/sirupsen/logrus` package. */ module Logrus { /** Gets the package name `github.com/sirupsen/logrus`. */ - bindingset[result] string packagePath() { result = package(["github.com/sirupsen/logrus", "github.com/Sirupsen/logrus"], "") } diff --git a/ql/src/semmle/go/frameworks/Protobuf.qll b/ql/src/semmle/go/frameworks/Protobuf.qll index 2a0c3bf61b9..9603b015473 100644 --- a/ql/src/semmle/go/frameworks/Protobuf.qll +++ b/ql/src/semmle/go/frameworks/Protobuf.qll @@ -5,23 +5,19 @@ import go /** Provides models of commonly used functions and types in the protobuf packages. */ module Protobuf { /** Gets the name of the modern protobuf top-level implementation package. */ - bindingset[result] string modernProtobufPackage() { result = package("google.golang.org/protobuf", "proto") } /** Gets the name of the modern protobuf implementation's `protoiface` subpackage. */ - bindingset[result] string protobufIfacePackage() { result = package("google.golang.org/protobuf", "runtime/protoiface") } /** Gets the name of the modern protobuf implementation's `protoreflect` subpackage. */ - bindingset[result] string protobufReflectPackage() { result = package("google.golang.org/protobuf", "reflect/protoreflect") } /** Gets the name of a top-level protobuf implementation package. */ - bindingset[result] string protobufPackages() { result in [package("github.com/golang/protobuf", "proto"), modernProtobufPackage()] } diff --git a/ql/src/semmle/go/frameworks/Revel.qll b/ql/src/semmle/go/frameworks/Revel.qll index 5081eb92e2f..1058c54c713 100644 --- a/ql/src/semmle/go/frameworks/Revel.qll +++ b/ql/src/semmle/go/frameworks/Revel.qll @@ -8,7 +8,6 @@ private import semmle.go.security.OpenUrlRedirectCustomizations /** Provides classes and methods modelling the Revel web framework. */ module Revel { /** Gets the package name `github.com/revel/revel`. */ - bindingset[result] string packagePath() { result = package(["github.com/revel", "github.com/robfig"], "revel") } private class ControllerParams extends UntrustedFlowSource::Range, DataFlow::FieldReadNode { diff --git a/ql/src/semmle/go/frameworks/SQL.qll b/ql/src/semmle/go/frameworks/SQL.qll index 191f833d45d..71050478b42 100644 --- a/ql/src/semmle/go/frameworks/SQL.qll +++ b/ql/src/semmle/go/frameworks/SQL.qll @@ -101,11 +101,9 @@ module SQL { } /** A string that might identify package `go-pg/pg` or a specific version of it. */ - bindingset[result] private string gopg() { result = package("github.com/go-pg/pg", "") } /** A string that might identify package `go-pg/pg/orm` or a specific version of it. */ - bindingset[result] private string gopgorm() { result = package("github.com/go-pg/pg", "orm") } /** @@ -219,7 +217,6 @@ module SQL { module Gorm { /** Gets the package name for Gorm. */ - bindingset[result] string packagePath() { result = package(["github.com/jinzhu/gorm", "github.com/go-gorm/gorm", "gorm.io/gorm"], "") } diff --git a/ql/src/semmle/go/frameworks/Spew.qll b/ql/src/semmle/go/frameworks/Spew.qll index ff82bf6fc4d..30490ac6608 100644 --- a/ql/src/semmle/go/frameworks/Spew.qll +++ b/ql/src/semmle/go/frameworks/Spew.qll @@ -9,7 +9,6 @@ import go */ module Spew { /** Gets the package path `github.com/davecgh/go-spew/spew`. */ - bindingset[result] private string packagePath() { result = package("github.com/davecgh/go-spew", "spew") } private class SpewCall extends LoggerCall::Range, DataFlow::CallNode { diff --git a/ql/src/semmle/go/frameworks/SystemCommandExecutors.qll b/ql/src/semmle/go/frameworks/SystemCommandExecutors.qll index af121ae151d..9c16971a113 100644 --- a/ql/src/semmle/go/frameworks/SystemCommandExecutors.qll +++ b/ql/src/semmle/go/frameworks/SystemCommandExecutors.qll @@ -79,7 +79,6 @@ private class GoShCommandExecution extends SystemCommandExecution::Range, DataFl module CryptoSsh { /** Gets the package path `golang.org/x/crypto/ssh`. */ - bindingset[result] string packagePath() { result = package("golang.org/x/crypto", "ssh") } /** diff --git a/ql/src/semmle/go/frameworks/Testing.qll b/ql/src/semmle/go/frameworks/Testing.qll index 8dc8c8b484c..728e33f31ef 100644 --- a/ql/src/semmle/go/frameworks/Testing.qll +++ b/ql/src/semmle/go/frameworks/Testing.qll @@ -90,7 +90,6 @@ module TestFile { /** Provides classes modelling Ginkgo. */ module Ginkgo { /** Gets the package path `github.com/onsi/ginkgo`. */ - bindingset[result] string packagePath() { result = package("github.com/onsi/ginkgo", "") } /** The Ginkgo `Fail` function, which always panics. */ diff --git a/ql/src/semmle/go/frameworks/WebSocket.qll b/ql/src/semmle/go/frameworks/WebSocket.qll index 02ab3940210..96e9d52e30e 100644 --- a/ql/src/semmle/go/frameworks/WebSocket.qll +++ b/ql/src/semmle/go/frameworks/WebSocket.qll @@ -300,24 +300,20 @@ module WebSocketReader { module GorillaWebsocket { /** Gets the package name `github.com/gorilla/websocket`. */ - bindingset[result] string packagePath() { result = package("github.com/gorilla", "websocket") } } module GolangOrgXNetWebsocket { /** Gets the package name `golang.org/x/net/websocket`. */ - bindingset[result] string packagePath() { result = package("golang.org/x/net", "websocket") } } module NhooyrWebSocket { /** Gets the package name `nhooyr.io/websocket/`. */ - bindingset[result] string packagePath() { result = package("nhooyr.io/websocket", "") } } module GobwasWs { /** Gets the package name `github.com/gobwas/ws`. */ - bindingset[result] string packagePath() { result = package("github.com/gobwas/ws", "") } } diff --git a/ql/src/semmle/go/frameworks/XNetHtml.qll b/ql/src/semmle/go/frameworks/XNetHtml.qll index 50a7d008344..6a7c56713d6 100644 --- a/ql/src/semmle/go/frameworks/XNetHtml.qll +++ b/ql/src/semmle/go/frameworks/XNetHtml.qll @@ -12,7 +12,6 @@ import go /** Provides models of commonly used functions in the `golang.org/x/net/html` subpackage. */ module XNetHtml { /** Gets the package name `golang.org/x/net/html`. */ - bindingset[result] string packagePath() { result = package("golang.org/x/net", "html") } private class EscapeString extends HtmlEscapeFunction, TaintTracking::FunctionModel { diff --git a/ql/src/semmle/go/frameworks/XPath.qll b/ql/src/semmle/go/frameworks/XPath.qll index 70651c9ae75..f024569fb75 100644 --- a/ql/src/semmle/go/frameworks/XPath.qll +++ b/ql/src/semmle/go/frameworks/XPath.qll @@ -191,7 +191,6 @@ module XPath { module XmlPath { /** Gets the package name `github.com/go-xmlpath/xmlpath` or `gopkg.in/xmlpath`. */ - bindingset[result] string packagePath() { result = package(["github.com/go-xmlpath/xmlpath", "gopkg.in/xmlpath"], "") } diff --git a/ql/src/semmle/go/frameworks/Yaml.qll b/ql/src/semmle/go/frameworks/Yaml.qll index b661021f573..583591c5e65 100644 --- a/ql/src/semmle/go/frameworks/Yaml.qll +++ b/ql/src/semmle/go/frameworks/Yaml.qll @@ -9,7 +9,6 @@ import go */ module Yaml { /** Gets a package path for the Yaml package. */ - bindingset[result] string packagePath() { result = package("gopkg.in/yaml", "") } private class MarshalFunction extends TaintTracking::FunctionModel, MarshalingFunction::Range { diff --git a/ql/src/semmle/go/frameworks/Zap.qll b/ql/src/semmle/go/frameworks/Zap.qll index 8a368fe64f6..27c4b6d2235 100644 --- a/ql/src/semmle/go/frameworks/Zap.qll +++ b/ql/src/semmle/go/frameworks/Zap.qll @@ -9,7 +9,6 @@ import go */ module Zap { /** Gets the package path `go.uber.org/zap`. */ - bindingset[result] private string packagePath() { result = package("go.uber.org/zap", "") } /** Gets a suffix for a method on `zap.SugaredLogger`. */ diff --git a/ql/src/semmle/go/frameworks/stdlib/Context.qll b/ql/src/semmle/go/frameworks/stdlib/Context.qll index f94c24a8529..d8e7a133726 100644 --- a/ql/src/semmle/go/frameworks/stdlib/Context.qll +++ b/ql/src/semmle/go/frameworks/stdlib/Context.qll @@ -12,7 +12,6 @@ module Context { * The two packages are identical; before Go 1.7 it was only available * under `golang.org/x`; as of Go 1.7 it is included in the standard library. */ - bindingset[result] private string packagePath() { result = ["context", package("golang.org/x/net", "context")] } private class FunctionModels extends TaintTracking::FunctionModel { diff --git a/ql/test/library-tests/semmle/go/Packages/main.go b/ql/test/library-tests/semmle/go/Packages/main.go index cd3014221d4..640439e0e92 100644 --- a/ql/test/library-tests/semmle/go/Packages/main.go +++ b/ql/test/library-tests/semmle/go/Packages/main.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/nonexistent-test-pkg" - "github.com/nonexistent/test" - test2 "github.com/nonexistent/v2/test" + _ "github.com/nonexistent/test" + _ "github.com/nonexistent/v2/test" ) func main() { diff --git a/ql/test/library-tests/semmle/go/Packages/package.expected b/ql/test/library-tests/semmle/go/Packages/package.expected index 256819c6151..8c4d8ab8e94 100644 --- a/ql/test/library-tests/semmle/go/Packages/package.expected +++ b/ql/test/library-tests/semmle/go/Packages/package.expected @@ -1,2 +1,2 @@ -| PackageName/test | -| PackageName/v2/test | +| github.com/nonexistent/test | +| github.com/nonexistent/v2/test |