Skip to content

Commit d10b9e6

Browse files
committed
Fix linter warnings in Request Forgery tests
1 parent afc78ce commit d10b9e6

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

go/ql/test/query-tests/Security/CWE-918/RequestForgery.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
| websocket.go:129:3:129:62 | call to DialContext | websocket.go:126:21:126:31 | call to Referer | websocket.go:129:38:129:51 | untrustedInput | The $@ of this request depends on a $@. | websocket.go:129:38:129:51 | untrustedInput | WebSocket URL | websocket.go:126:21:126:31 | call to Referer | user-provided value |
1515
| websocket.go:155:3:155:45 | call to Dial | websocket.go:154:21:154:31 | call to Referer | websocket.go:155:31:155:44 | untrustedInput | The $@ of this request depends on a $@. | websocket.go:155:31:155:44 | untrustedInput | WebSocket URL | websocket.go:154:21:154:31 | call to Referer | user-provided value |
1616
| websocket.go:162:3:162:45 | call to Dial | websocket.go:160:21:160:31 | call to Referer | websocket.go:162:31:162:44 | untrustedInput | The $@ of this request depends on a $@. | websocket.go:162:31:162:44 | untrustedInput | WebSocket URL | websocket.go:160:21:160:31 | call to Referer | user-provided value |
17-
| websocket.go:197:3:197:32 | call to BuildProxy | websocket.go:195:21:195:31 | call to Referer | websocket.go:197:18:197:31 | untrustedInput | The $@ of this request depends on a $@. | websocket.go:197:18:197:31 | untrustedInput | WebSocket URL | websocket.go:195:21:195:31 | call to Referer | user-provided value |
18-
| websocket.go:204:3:204:25 | call to New | websocket.go:202:21:202:31 | call to Referer | websocket.go:204:11:204:24 | untrustedInput | The $@ of this request depends on a $@. | websocket.go:204:11:204:24 | untrustedInput | WebSocket URL | websocket.go:202:21:202:31 | call to Referer | user-provided value |
17+
| websocket.go:197:7:197:36 | call to BuildProxy | websocket.go:195:21:195:31 | call to Referer | websocket.go:197:22:197:35 | untrustedInput | The $@ of this request depends on a $@. | websocket.go:197:22:197:35 | untrustedInput | WebSocket URL | websocket.go:195:21:195:31 | call to Referer | user-provided value |
18+
| websocket.go:204:7:204:29 | call to New | websocket.go:202:21:202:31 | call to Referer | websocket.go:204:15:204:28 | untrustedInput | The $@ of this request depends on a $@. | websocket.go:204:15:204:28 | untrustedInput | WebSocket URL | websocket.go:202:21:202:31 | call to Referer | user-provided value |
1919
edges
2020
| RequestForgery.go:8:12:8:34 | call to FormValue | RequestForgery.go:11:24:11:65 | ...+... | provenance | Src:MaD:1 |
2121
| tst.go:10:13:10:35 | call to FormValue | tst.go:14:11:14:17 | tainted | provenance | Src:MaD:1 |
@@ -42,8 +42,8 @@ edges
4242
| websocket.go:126:21:126:31 | call to Referer | websocket.go:129:38:129:51 | untrustedInput | provenance | Src:MaD:2 |
4343
| websocket.go:154:21:154:31 | call to Referer | websocket.go:155:31:155:44 | untrustedInput | provenance | Src:MaD:2 |
4444
| websocket.go:160:21:160:31 | call to Referer | websocket.go:162:31:162:44 | untrustedInput | provenance | Src:MaD:2 |
45-
| websocket.go:195:21:195:31 | call to Referer | websocket.go:197:18:197:31 | untrustedInput | provenance | Src:MaD:2 |
46-
| websocket.go:202:21:202:31 | call to Referer | websocket.go:204:11:204:24 | untrustedInput | provenance | Src:MaD:2 |
45+
| websocket.go:195:21:195:31 | call to Referer | websocket.go:197:22:197:35 | untrustedInput | provenance | Src:MaD:2 |
46+
| websocket.go:202:21:202:31 | call to Referer | websocket.go:204:15:204:28 | untrustedInput | provenance | Src:MaD:2 |
4747
models
4848
| 1 | Source: net/http; Request; true; FormValue; ; ; ReturnValue; remote; manual |
4949
| 2 | Source: net/http; Request; true; Referer; ; ; ReturnValue; remote; manual |
@@ -80,7 +80,7 @@ nodes
8080
| websocket.go:160:21:160:31 | call to Referer | semmle.label | call to Referer |
8181
| websocket.go:162:31:162:44 | untrustedInput | semmle.label | untrustedInput |
8282
| websocket.go:195:21:195:31 | call to Referer | semmle.label | call to Referer |
83-
| websocket.go:197:18:197:31 | untrustedInput | semmle.label | untrustedInput |
83+
| websocket.go:197:22:197:35 | untrustedInput | semmle.label | untrustedInput |
8484
| websocket.go:202:21:202:31 | call to Referer | semmle.label | call to Referer |
85-
| websocket.go:204:11:204:24 | untrustedInput | semmle.label | untrustedInput |
85+
| websocket.go:204:15:204:28 | untrustedInput | semmle.label | untrustedInput |
8686
subpaths

go/ql/test/query-tests/Security/CWE-918/websocket.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func test() {
166166
http.HandleFunc("/ex12", func(w http.ResponseWriter, r *http.Request) {
167167
untrustedInput := r.Referer()
168168

169-
if "localhost" == untrustedInput {
169+
if untrustedInput == "localhost" {
170170
dialer := gobwas.Dialer{}
171171
dialer.Dial(context.TODO(), untrustedInput)
172172
}
@@ -176,32 +176,32 @@ func test() {
176176
http.HandleFunc("/ex13", func(w http.ResponseWriter, r *http.Request) {
177177
untrustedInput := r.Referer()
178178

179-
if "localhost" == untrustedInput {
180-
sac.New(untrustedInput)
179+
if untrustedInput == "localhost" {
180+
_ = sac.New(untrustedInput)
181181
}
182182
})
183183

184184
// sac007 websocket BuildProxy good
185185
http.HandleFunc("/ex14", func(w http.ResponseWriter, r *http.Request) {
186186
untrustedInput := r.Referer()
187187

188-
if "localhost" == untrustedInput {
189-
sac.BuildProxy(untrustedInput)
188+
if untrustedInput == "localhost" {
189+
_ = sac.BuildProxy(untrustedInput)
190190
}
191191
})
192192

193193
// sac007 websocket BuildProxy bad
194194
http.HandleFunc("/ex15", func(w http.ResponseWriter, r *http.Request) {
195195
untrustedInput := r.Referer()
196196

197-
sac.BuildProxy(untrustedInput)
197+
_ = sac.BuildProxy(untrustedInput)
198198
})
199199

200200
// sac007 websocket New bad
201201
http.HandleFunc("/ex16", func(w http.ResponseWriter, r *http.Request) {
202202
untrustedInput := r.Referer()
203203

204-
sac.New(untrustedInput)
204+
_ = sac.New(untrustedInput)
205205
})
206206

207207
log.Println(http.ListenAndServe(":80", nil))

0 commit comments

Comments
 (0)