Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 3c8fa02

Browse files
author
Max Schaefer
committed
Regularise a few comments.
1 parent adc3ce8 commit 3c8fa02

2 files changed

Lines changed: 22 additions & 30 deletions

File tree

ql/src/semmle/go/dataflow/BarrierGuardUtil.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* Contains implementations of some commonly used barrier
3-
* guards for sanitizing untrusted URLs.
2+
* Provides implementations of some commonly used barrier guards for sanitizing untrusted URLs.
43
*/
54

65
import go

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

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import go
44

55
/**
6-
* A data-flow node that establishes a new WebSocket connection.
6+
* A function call that establishes a new WebSocket connection.
77
*
88
* Extend this class to refine existing API models. If you want to model new APIs,
99
* extend `WebSocketRequestCall::Range` instead.
@@ -20,7 +20,7 @@ class WebSocketRequestCall extends DataFlow::CallNode {
2020
/** Provides classes for working with WebSocket request functions. */
2121
module WebSocketRequestCall {
2222
/**
23-
* A data-flow node that establishes a new WebSocket connection.
23+
* A function call that establishes a new WebSocket connection.
2424
*
2525
* Extend this class to model new APIs. If you want to refine existing
2626
* API models, extend `WebSocketRequestCall` instead.
@@ -31,8 +31,7 @@ module WebSocketRequestCall {
3131
}
3232

3333
/**
34-
* A WebSocket request expression string used in an API function of the
35-
* `golang.org/x/net/websocket` package.
34+
* A call to the `Dial` function of the `golang.org/x/net/websocket` package.
3635
*/
3736
private class GolangXNetDialFunc extends Range {
3837
GolangXNetDialFunc() {
@@ -44,8 +43,7 @@ module WebSocketRequestCall {
4443
}
4544

4645
/**
47-
* A WebSocket DialConfig expression string used in an API function
48-
* of the `golang.org/x/net/websocket` package.
46+
* A call to the `DialConfig` function of the `golang.org/x/net/websocket` package.
4947
*/
5048
private class GolangXNetDialConfigFunc extends Range {
5149
GolangXNetDialConfigFunc() {
@@ -64,8 +62,7 @@ module WebSocketRequestCall {
6462
}
6563

6664
/**
67-
* A WebSocket request expression string used in an API function
68-
* of the `github.com/gorilla/websocket` package.
65+
* A call to the `Dialer` or `DialContext` function of the `github.com/gorilla/websocket` package.
6966
*/
7067
private class GorillaWebSocketDialFunc extends Range {
7168
DataFlow::Node url;
@@ -87,8 +84,7 @@ module WebSocketRequestCall {
8784
}
8885

8986
/**
90-
* A WebSocket request expression string used in an API function
91-
* of the `github.com/gobwas/ws` package.
87+
* A call to the `Dialer.Dial` method of the `github.com/gobwas/ws` package.
9288
*/
9389
private class GobwasWsDialFunc extends Range {
9490
GobwasWsDialFunc() {
@@ -106,8 +102,7 @@ module WebSocketRequestCall {
106102
}
107103

108104
/**
109-
* A WebSocket request expression string used in an API function
110-
* of the `nhooyr.io/websocket` package.
105+
* A call to the `Dial` function of the `nhooyr.io/websocket` package.
111106
*/
112107
private class NhooyrWebSocketDialFunc extends Range {
113108
NhooyrWebSocketDialFunc() {
@@ -119,24 +114,22 @@ module WebSocketRequestCall {
119114
}
120115

121116
/**
122-
* A WebSocket request expression string used in an API function
123-
* of the `github.com/sacOO7/gowebsocket` package.
117+
* A call to the `BuildProxy` or `New` function of the `github.com/sacOO7/gowebsocket` package.
124118
*/
125119
private class SacOO7DialFunc extends Range {
126120
SacOO7DialFunc() {
127121
// func BuildProxy(Url string) func(*http.Request) (*url.URL, error)
128122
// func New(url string) Socket
129-
this.getTarget().hasQualifiedName("github.com/sacOO7/gowebsocket", ["New", "BuildProxy"])
123+
this.getTarget().hasQualifiedName("github.com/sacOO7/gowebsocket", ["BuildProxy", "New"])
130124
}
131125

132126
override DataFlow::Node getRequestUrl() { result = this.getArgument(0) }
133127
}
134128
}
135129

136-
/*
130+
/**
137131
* A message written to a WebSocket, considered as a flow sink for reflected XSS.
138132
*/
139-
140133
class WebSocketReaderAsSource extends UntrustedFlowSource::Range {
141134
WebSocketReaderAsSource() {
142135
exists(WebSocketReader r | this = r.getAnOutput().getNode(r.getACall()))
@@ -154,7 +147,7 @@ class WebSocketReader extends Function {
154147

155148
WebSocketReader() { this = self }
156149

157-
/** Gets an output of this function that is read from a WebSocket connection. */
150+
/** Gets an output of this function containing data that is read from a WebSocket connection. */
158151
FunctionOutput getAnOutput() { result = self.getAnOutput() }
159152
}
160153

@@ -167,12 +160,12 @@ module WebSocketReader {
167160
* extend `WebSocketReader` instead.
168161
*/
169162
abstract class Range extends Function {
170-
/**Returns the parameter in which the function stores the message read. */
163+
/** Gets an output of this function containing data that is read from a WebSocket connection. */
171164
abstract FunctionOutput getAnOutput();
172165
}
173166

174167
/**
175-
* Models the `Receive` method of the `golang.org/x/net/websocket` package.
168+
* The `Codec.Receive` method of the `golang.org/x/net/websocket` package.
176169
*/
177170
private class GolangXNetCodecRecv extends Range, Method {
178171
GolangXNetCodecRecv() {
@@ -184,7 +177,7 @@ module WebSocketReader {
184177
}
185178

186179
/**
187-
* Models the `Read` method of the `golang.org/x/net/websocket` package.
180+
* The `Conn.Read` method of the `golang.org/x/net/websocket` package.
188181
*/
189182
private class GolangXNetConnRead extends Range, Method {
190183
GolangXNetConnRead() {
@@ -196,7 +189,7 @@ module WebSocketReader {
196189
}
197190

198191
/**
199-
* Models the `Read` method of the `nhooyr.io/websocket` package.
192+
* The `Conn.Read` method of the `nhooyr.io/websocket` package.
200193
*/
201194
private class NhooyrWebSocketRead extends Range, Method {
202195
NhooyrWebSocketRead() {
@@ -208,7 +201,7 @@ module WebSocketReader {
208201
}
209202

210203
/**
211-
* Models the `Reader` method of the `nhooyr.io/websocket` package.
204+
* The `Conn.Reader` method of the `nhooyr.io/websocket` package.
212205
*/
213206
private class NhooyrWebSocketReader extends Range, Method {
214207
NhooyrWebSocketReader() {
@@ -220,7 +213,7 @@ module WebSocketReader {
220213
}
221214

222215
/**
223-
* Models the `ReadFrame`function of the `github.com/gobwas/ws` package.
216+
* The `ReadFrame` function of the `github.com/gobwas/ws` package.
224217
*/
225218
private class GobwasWsReadFrame extends Range {
226219
GobwasWsReadFrame() {
@@ -232,7 +225,7 @@ module WebSocketReader {
232225
}
233226

234227
/**
235-
* Models the `ReadHeader`function of the `github.com/gobwas/ws` package.
228+
* The `ReadHeader` function of the `github.com/gobwas/ws` package.
236229
*/
237230
private class GobwasWsReadHeader extends Range {
238231
GobwasWsReadHeader() {
@@ -244,7 +237,7 @@ module WebSocketReader {
244237
}
245238

246239
/**
247-
* Models the `ReadJson` function of the `github.com/gorilla/websocket` package.
240+
* The `ReadJson` function of the `github.com/gorilla/websocket` package.
248241
*/
249242
private class GorillaWebSocketReadJson extends Range {
250243
GorillaWebSocketReadJson() {
@@ -256,7 +249,7 @@ module WebSocketReader {
256249
}
257250

258251
/**
259-
* Models the `ReadJson` method of the `github.com/gorilla/websocket` package.
252+
* The `Conn.ReadJson` method of the `github.com/gorilla/websocket` package.
260253
*/
261254
private class GorillaWebSocketConnReadJson extends Range, Method {
262255
GorillaWebSocketConnReadJson() {
@@ -268,7 +261,7 @@ module WebSocketReader {
268261
}
269262

270263
/**
271-
* Models the `ReadMessage` method of the `github.com/gorilla/websocket` package.
264+
* The `Conn.ReadMessage` method of the `github.com/gorilla/websocket` package.
272265
*/
273266
private class GorillaWebSocketReadMessage extends Range, Method {
274267
GorillaWebSocketReadMessage() {

0 commit comments

Comments
 (0)