Skip to content

Commit 808dde2

Browse files
author
cokeBeer
committed
add v2modulePath()
1 parent 252b190 commit 808dde2

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

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

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,39 @@ private import semmle.go.security.SafeUrlFlowCustomizations
1212
* from the [Beego](https://github.com/beego/beego) package.
1313
*/
1414
module Beego {
15-
/**
16-
* Gets the module path `github.com/astaxie/beego` or `github.com/beego/beego`
17-
* or `github.com/beego/beego/v2`.
18-
*/
19-
string modulePath() {
20-
result =
21-
[
22-
"github.com/astaxie/beego", "github.com/beego/beego",
23-
"github.com/beego/beego/v2"
24-
]
25-
}
15+
/** Gets the module path `github.com/astaxie/beego` or `github.com/beego/beego` */
16+
string modulePath() { result = ["github.com/astaxie/beego", "github.com/beego/beego"] }
17+
18+
/** Gets the v2 module path `github.com/beego/beego/v2` */
19+
string v2modulePath() { result = "github.com/beego/beego/v2" }
2620

2721
/** Gets the path for the root package of beego. */
28-
string packagePath() { result = package(modulePath(), ["", "server/web"]) }
22+
string packagePath() {
23+
result = package(modulePath(), "")
24+
or
25+
result = package(v2modulePath(), "server/web")
26+
}
2927

3028
/** Gets the path for the context package of beego. */
31-
string contextPackagePath() { result = package(modulePath(), ["context", "server/web/context"]) }
29+
string contextPackagePath() {
30+
result = package(modulePath(), "context")
31+
or
32+
result = package(v2modulePath(), "server/web/context")
33+
}
3234

3335
/** Gets the path for the logs package of beego. */
34-
string logsPackagePath() { result = package(modulePath(), ["logs", "core/logs"]) }
36+
string logsPackagePath() {
37+
result = package(modulePath(), "logs")
38+
or
39+
result = package(v2modulePath(), "core/logs")
40+
}
3541

3642
/** Gets the path for the utils package of beego. */
37-
string utilsPackagePath() { result = package(modulePath(), ["utils", "core/utils"]) }
43+
string utilsPackagePath() {
44+
result = package(modulePath(), "utils")
45+
or
46+
result = package(v2modulePath(), "core/utils")
47+
}
3848

3949
/**
4050
* `BeegoInput` sources of untrusted data.

0 commit comments

Comments
 (0)