Skip to content

Commit 8aba71f

Browse files
committed
upgrade tests
1 parent 1c657a6 commit 8aba71f

14 files changed

Lines changed: 180 additions & 6246 deletions

go/ql/lib/go.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import semmle.go.frameworks.Email
4141
import semmle.go.frameworks.Encoding
4242
import semmle.go.frameworks.Fiber
4343
import semmle.go.frameworks.Gin
44+
import semmle.go.frameworks.Fasthttp
4445
import semmle.go.frameworks.Glog
4546
import semmle.go.frameworks.GoKit
4647
import semmle.go.frameworks.GoMicro
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
testFailures
2+
failures
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import go
2+
import TestUtilities.InlineExpectationsTest
3+
4+
module FasthttpTest implements TestSig {
5+
string getARelevantTag() { result = ["URI", "req"] }
6+
7+
predicate hasActualResult(Location location, string element, string tag, string value) {
8+
exists(Fasthttp::Request::RequestAdditionalStep q, DataFlow::Node succ |
9+
q.hasTaintStep(_, succ)
10+
|
11+
succ.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
12+
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
13+
element = succ.toString() and
14+
value = succ.toString() and
15+
tag = "req"
16+
)
17+
or
18+
exists(Fasthttp::URI::UriAdditionalStep q, DataFlow::Node succ | q.hasTaintStep(_, succ) |
19+
succ.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
20+
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
21+
element = succ.toString() and
22+
value = succ.toString() and
23+
tag = "URI"
24+
)
25+
}
26+
}
27+
28+
import MakeTest<FasthttpTest>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| fasthttp.go:217:23:217:50 | "https://userControlled.com" |
2+
| fasthttp.go:218:28:218:63 | type conversion |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import go
2+
import semmle.go.security.OpenUrlRedirectCustomizations
3+
4+
select any(OpenUrlRedirect::Sink s)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
| fasthttp.go:13:42:13:57 | "127.0.0.1:8909" |
2+
| fasthttp.go:14:32:14:46 | "google.com:80" |
3+
| fasthttp.go:15:39:15:53 | "google.com:80" |
4+
| fasthttp.go:16:48:16:62 | "google.com:80" |
5+
| fasthttp.go:27:24:27:46 | "http://127.0.0.1:8909" |
6+
| fasthttp.go:28:32:28:54 | "http://127.0.0.1:8909" |
7+
| fasthttp.go:29:31:29:53 | "http://127.0.0.1:8909" |
8+
| fasthttp.go:30:25:30:47 | "http://127.0.0.1:8909" |
9+
| fasthttp.go:32:14:32:16 | req |
10+
| fasthttp.go:33:23:33:25 | req |
11+
| fasthttp.go:34:22:34:24 | req |
12+
| fasthttp.go:35:21:35:23 | req |
13+
| fasthttp.go:54:26:54:48 | "http://127.0.0.1:8909" |
14+
| fasthttp.go:55:34:55:56 | "http://127.0.0.1:8909" |
15+
| fasthttp.go:56:33:56:55 | "http://127.0.0.1:8909" |
16+
| fasthttp.go:57:27:57:49 | "http://127.0.0.1:8909" |
17+
| fasthttp.go:58:16:58:18 | req |
18+
| fasthttp.go:59:24:59:26 | req |
19+
| fasthttp.go:60:25:60:27 | req |
20+
| fasthttp.go:61:23:61:25 | req |
21+
| fasthttp.go:65:14:65:16 | req |
22+
| fasthttp.go:66:22:66:24 | req |
23+
| fasthttp.go:67:21:67:23 | req |
24+
| fasthttp.go:70:13:70:19 | resByte |
25+
| fasthttp.go:71:21:71:27 | resByte |
26+
| fasthttp.go:72:20:72:26 | resByte |
27+
| fasthttp.go:73:14:73:20 | resByte |
28+
| fasthttp.go:74:12:74:14 | req |
29+
| fasthttp.go:75:20:75:22 | req |
30+
| fasthttp.go:76:21:76:23 | req |
31+
| fasthttp.go:77:19:77:21 | req |
32+
| fasthttp.go:80:20:80:22 | req |
33+
| fasthttp.go:81:28:81:30 | req |
34+
| fasthttp.go:82:27:82:29 | req |
35+
| fasthttp.go:85:17:85:32 | "127.0.0.1:8909" |
36+
| fasthttp.go:86:24:86:39 | "127.0.0.1:8909" |
37+
| fasthttp.go:87:26:87:41 | "127.0.0.1:8909" |
38+
| fasthttp.go:88:33:88:48 | "127.0.0.1:8909" |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import go
2+
import semmle.go.security.RequestForgery
3+
4+
select any(RequestForgery::Sink s)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
| fasthttp.go:102:15:102:53 | call to Peek |
2+
| fasthttp.go:119:23:119:31 | dstWriter |
3+
| fasthttp.go:120:3:120:24 | call to Header |
4+
| fasthttp.go:121:3:121:31 | call to TrailerHeader |
5+
| fasthttp.go:123:3:123:28 | call to RequestURI |
6+
| fasthttp.go:124:3:124:22 | call to Host |
7+
| fasthttp.go:125:3:125:27 | call to UserAgent |
8+
| fasthttp.go:126:3:126:33 | call to ContentEncoding |
9+
| fasthttp.go:127:3:127:29 | call to ContentType |
10+
| fasthttp.go:128:3:128:33 | call to Cookie |
11+
| fasthttp.go:129:3:129:46 | call to CookieBytes |
12+
| fasthttp.go:130:3:130:39 | call to MultipartFormBoundary |
13+
| fasthttp.go:131:3:131:35 | call to Peek |
14+
| fasthttp.go:132:3:132:38 | call to PeekAll |
15+
| fasthttp.go:133:3:133:48 | call to PeekBytes |
16+
| fasthttp.go:134:3:134:26 | call to PeekKeys |
17+
| fasthttp.go:135:3:135:33 | call to PeekTrailerKeys |
18+
| fasthttp.go:136:3:136:25 | call to Referer |
19+
| fasthttp.go:137:3:137:28 | call to RawHeaders |
20+
| fasthttp.go:140:3:140:25 | call to Path |
21+
| fasthttp.go:141:3:141:33 | call to PathOriginal |
22+
| fasthttp.go:144:3:144:28 | call to FullURI |
23+
| fasthttp.go:145:3:145:36 | call to LastPathSegment |
24+
| fasthttp.go:146:3:146:32 | call to QueryString |
25+
| fasthttp.go:147:3:147:27 | call to String |
26+
| fasthttp.go:148:28:148:36 | dstWriter |
27+
| fasthttp.go:153:3:153:43 | call to Peek |
28+
| fasthttp.go:154:3:154:56 | call to PeekBytes |
29+
| fasthttp.go:155:3:155:48 | call to PeekMulti |
30+
| fasthttp.go:156:3:156:61 | call to PeekMultiBytes |
31+
| fasthttp.go:157:3:157:44 | call to QueryString |
32+
| fasthttp.go:158:3:158:39 | call to String |
33+
| fasthttp.go:159:40:159:48 | dstWriter |
34+
| fasthttp.go:163:3:163:19 | call to Path |
35+
| fasthttp.go:167:3:167:22 | call to Referer |
36+
| fasthttp.go:168:3:168:23 | call to PostBody |
37+
| fasthttp.go:169:3:169:32 | call to RequestBodyStream |
38+
| fasthttp.go:170:3:170:25 | call to RequestURI |
39+
| fasthttp.go:171:3:171:24 | call to UserAgent |
40+
| fasthttp.go:172:3:172:19 | call to Host |
41+
| fasthttp.go:174:3:174:27 | call to Host |
42+
| fasthttp.go:175:3:175:27 | call to Body |
43+
| fasthttp.go:176:3:176:33 | call to RequestURI |
44+
| fasthttp.go:177:3:177:33 | call to BodyGunzip |
45+
| fasthttp.go:178:3:178:34 | call to BodyInflate |
46+
| fasthttp.go:179:3:179:35 | call to BodyUnbrotli |
47+
| fasthttp.go:180:3:180:33 | call to BodyStream |
48+
| fasthttp.go:181:34:181:42 | dstWriter |
49+
| fasthttp.go:182:30:182:38 | dstWriter |
50+
| fasthttp.go:183:3:183:39 | call to BodyUncompressed |
51+
| fasthttp.go:184:31:184:39 | dstReader |
52+
| fasthttp.go:185:36:185:44 | dstReader |
53+
| fasthttp.go:186:45:186:53 | dstReader |
54+
| fasthttp.go:187:39:187:47 | dstReader |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import go
2+
3+
select any(UntrustedFlowSource s)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
| fasthttp.go:193:34:193:58 | type conversion |
2+
| fasthttp.go:194:40:194:56 | "user Controlled" |
3+
| fasthttp.go:197:31:197:55 | type conversion |
4+
| fasthttp.go:198:37:198:53 | "user Controlled" |
5+
| fasthttp.go:199:34:199:58 | type conversion |
6+
| fasthttp.go:200:37:200:45 | dstReader |
7+
| fasthttp.go:206:26:206:39 | type conversion |
8+
| fasthttp.go:207:32:207:37 | "body" |
9+
| fasthttp.go:212:34:212:90 | call to AppendQuotedArg |
10+
| fasthttp.go:213:34:213:83 | call to AppendHTMLEscape |
11+
| fasthttp.go:214:34:214:96 | call to AppendHTMLEscapeBytes |

0 commit comments

Comments
 (0)