Skip to content

Commit af9c7c0

Browse files
authored
Merge pull request #512 from smowton/smowton/admin/pick-performance-fix-onto-rc-31
Apply package perf fix to rc/3.1
2 parents dcc1de4 + bcee55c commit af9c7c0

34 files changed

Lines changed: 20 additions & 56 deletions

ql/src/semmle/go/Packages.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ class Package extends @package {
3232
* For example, `package("github.com/go-pg/pg", "types")` gets an import path that can
3333
* refer to `"github.com/go-pg/pg/types"`, but also to `"github.com/go-pg/pg/v10/types"`.
3434
*/
35-
bindingset[result, mod, path]
35+
bindingset[mod, path]
3636
string package(string mod, string path) {
3737
// "\Q" and "\E" start and end a quoted section of a regular expression. Anything like "." or "*" that
3838
// "*" that comes between them is not interpreted as it would normally be in a regular expression.
39-
result.regexpMatch("\\Q" + mod + "\\E([/.]v[^/]+)?($|/)\\Q" + path + "\\E")
39+
result.regexpMatch("\\Q" + mod + "\\E([/.]v[^/]+)?($|/)\\Q" + path + "\\E") and
40+
result = any(Package p).getPath()
4041
}

ql/src/semmle/go/frameworks/Beego.qll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,18 @@ private import semmle.go.security.SafeUrlFlowCustomizations
1313
*/
1414
module Beego {
1515
/** Gets the module path `github.com/astaxie/beego` or `github.com/beego/beego`. */
16-
bindingset[result]
1716
string modulePath() { result = ["github.com/astaxie/beego", "github.com/beego/beego"] }
1817

1918
/** Gets the path for the root package of beego. */
20-
bindingset[result]
2119
string packagePath() { result = package(modulePath(), "") }
2220

2321
/** Gets the path for the context package of beego. */
24-
bindingset[result]
2522
string contextPackagePath() { result = package(modulePath(), "context") }
2623

2724
/** Gets the path for the logs package of beego. */
28-
bindingset[result]
2925
string logsPackagePath() { result = package(modulePath(), "logs") }
3026

3127
/** Gets the path for the utils package of beego. */
32-
bindingset[result]
3328
string utilsPackagePath() { result = package(modulePath(), "utils") }
3429

3530
/**

ql/src/semmle/go/frameworks/BeegoOrm.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ private import semmle.go.security.StoredXssCustomizations
1212
*/
1313
module BeegoOrm {
1414
/** Gets the package name `github.com/astaxie/beego/orm`. */
15-
bindingset[result]
1615
string packagePath() { result = package("github.com/astaxie/beego", "orm") }
1716

1817
private class DbSink extends SQL::QueryString::Range {

ql/src/semmle/go/frameworks/Chi.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import go
66

77
private module Chi {
88
/** Gets the package name `github.com/go-chi/chi`. */
9-
bindingset[result]
109
string packagePath() { result = package("github.com/go-chi/chi", "") }
1110

1211
/**

ql/src/semmle/go/frameworks/Couchbase.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module Couchbase {
1414
* Note that v1 and v2 have different APIs, but the names are disjoint so there is no need to
1515
* distinguish between them.
1616
*/
17-
bindingset[result]
1817
string packagePath() {
1918
result =
2019
package([

ql/src/semmle/go/frameworks/Echo.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import go
77

88
private module Echo {
99
/** Gets the package name `github.com/labstack/echo`. */
10-
bindingset[result]
1110
private string packagePath() { result = package("github.com/labstack/echo", "") }
1211

1312
/**

ql/src/semmle/go/frameworks/ElazarlGoproxy.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import go
99
*/
1010
module ElazarlGoproxy {
1111
/** Gets the package name. */
12-
bindingset[result]
1312
string packagePath() { result = package("github.com/elazarl/goproxy", "") }
1413

1514
private class NewResponse extends HTTP::HeaderWrite::Range, DataFlow::CallNode {

ql/src/semmle/go/frameworks/Email.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ module EmailData {
4444
}
4545

4646
/** Gets the package name `github.com/sendgrid/sendgrid-go/helpers/mail`. */
47-
bindingset[result]
4847
private string sendgridMail() {
4948
result = package("github.com/sendgrid/sendgrid-go", "helpers/mail")
5049
}

ql/src/semmle/go/frameworks/Encoding.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import go
66

77
/** Gets the package name `github.com/json-iterator/go`. */
8-
bindingset[result]
98
private string packagePath() { result = package("github.com/json-iterator/go", "") }
109

1110
/** A model of json-iterator's `Unmarshal` function, propagating taint from the JSON input to the decoded object. */

ql/src/semmle/go/frameworks/EvanphxJsonPatch.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import go
66

77
private module EvanphxJsonPatch {
88
/** Gets the package name `github.com/evanphx/json-patch`. */
9-
bindingset[result]
109
private string packagePath() { result = package("github.com/evanphx/json-patch", "") }
1110

1211
private class MergeMergePatches extends TaintTracking::FunctionModel {

0 commit comments

Comments
 (0)