@@ -4,6 +4,7 @@ package main
4
4
5
5
import (
6
6
"bufio"
7
+ "fmt"
7
8
"net"
8
9
"time"
9
10
@@ -40,12 +41,12 @@ func fasthttpClient() {
40
41
uri4 := fasthttp .AcquireURI ()
41
42
uri4 .UpdateBytes (source ().([]byte ))
42
43
sink (uri4 ) // $ hasTaintFlow="uri4"
43
- uri5 := fasthttp .AcquireURI ()
44
- uri5 .Parse (source ().([]byte ), nil )
45
- sink (uri5 ) // $ hasTaintFlow="uri5"
46
- uri6 := fasthttp .AcquireURI ()
47
- uri6 .Parse (nil , source ().([]byte ))
48
- sink (uri6 ) // $ hasTaintFlow="uri6"
44
+ uri5 := fasthttp .AcquireURI ()
45
+ uri5 .Parse (source ().([]byte ), nil )
46
+ sink (uri5 ) // $ hasTaintFlow="uri5"
47
+ uri6 := fasthttp .AcquireURI ()
48
+ uri6 .Parse (nil , source ().([]byte ))
49
+ sink (uri6 ) // $ hasTaintFlow="uri6"
49
50
50
51
resByte := make ([]byte , 1000 )
51
52
userInput = "http://127.0.0.1:8909"
@@ -144,8 +145,6 @@ func fasthttpServer() {
144
145
requestCtx .URI ().QueryArgs ().QueryString () // $ UntrustedFlowSource="call to QueryString"
145
146
requestCtx .URI ().QueryArgs ().String () // $ UntrustedFlowSource="call to String"
146
147
requestCtx .String () // $ UntrustedFlowSource="call to String"
147
- // not sure what is the best way to write query for following
148
- //requestCtx.URI().QueryArgs().VisitAll(type func(,))
149
148
150
149
requestCtx .Path () // $ UntrustedFlowSource="call to Path"
151
150
// multipart.Form is already implemented
@@ -158,29 +157,28 @@ func fasthttpServer() {
158
157
requestCtx .UserAgent () // $ UntrustedFlowSource="call to UserAgent"
159
158
requestCtx .Host () // $ UntrustedFlowSource="call to Host"
160
159
161
- requestCtx .Request .Host () // $ UntrustedFlowSource="call to Host"
162
- requestCtx .Request .Body () // $ UntrustedFlowSource="call to Body"
163
- requestCtx .Request .RequestURI () // $ UntrustedFlowSource="call to RequestURI"
164
- requestCtx .Request .BodyGunzip () // $ UntrustedFlowSource="call to BodyGunzip "
165
- requestCtx .Request .BodyInflate () // $ UntrustedFlowSource="call to BodyInflate "
166
- requestCtx .Request .BodyUnbrotli () // $ UntrustedFlowSource="call to BodyUnbrotli "
167
- requestCtx .Request .BodyStream () // $ UntrustedFlowSource="call to BodyStream "
168
- requestCtx .Request .BodyUncompressed () // $ UntrustedFlowSource="call to BodyUncompressed "
160
+ requestCtx .Request .Host () // $ UntrustedFlowSource="call to Host"
161
+ requestCtx .Request .Body () // $ UntrustedFlowSource="call to Body"
162
+ requestCtx .Request .RequestURI () // $ UntrustedFlowSource="call to RequestURI"
163
+ body1 , _ := requestCtx .Request .BodyGunzip () //$ UntrustedFlowSource="... := ...[0] "
164
+ body2 , _ := requestCtx .Request .BodyInflate () //$ UntrustedFlowSource="... := ...[0] "
165
+ body3 , _ := requestCtx .Request .BodyUnbrotli () //$ UntrustedFlowSource="... := ...[0] "
166
+ body4 , _ := requestCtx .Request .BodyUncompressed () // $ UntrustedFlowSource="... := ...[0] "
167
+ requestCtx .Request .BodyStream () // $ UntrustedFlowSource="call to BodyStream "
169
168
requestCtx .Request .ReadBody (dstReader , 100 , 1000 )
170
169
requestCtx .Request .ReadLimitBody (dstReader , 100 )
171
170
requestCtx .Request .ContinueReadBodyStream (dstReader , 100 , true )
172
171
requestCtx .Request .ContinueReadBody (dstReader , 100 )
173
- // not sure what is the best way to write query for following
174
- //requestCtx.Request.Header.VisitAllCookie()
172
+ fmt .Println (body1 , body2 , body3 , body4 )
175
173
176
174
// Response methods
177
175
// Xss Sinks Related method
178
176
userInput := "user Controlled input"
179
177
userInputByte := []byte ("user Controlled input" )
180
- requestCtx .Response .AppendBody (userInputByte ) // $ XssSink=userInputByte
181
- requestCtx .Response .AppendBodyString (userInput ) // $ XssSink=userInput
182
- rspWriter := requestCtx .Response .BodyWriter () // IDK how to handle this that returns a `io.Writer`
183
- rspWriter .Write (userInputByte )
178
+ requestCtx .Response .AppendBody (userInputByte ) // $ XssSink=userInputByte
179
+ requestCtx .Response .AppendBodyString (userInput ) // $ XssSink=userInput
180
+ rspWriter := requestCtx .Response .BodyWriter () // IDK how to handle this that returns a `io.Writer`
181
+ rspWriter .Write (userInputByte ) // $ XssSink=userInputByte
184
182
requestCtx .Response .SetBody (userInputByte ) // $ XssSink=userInputByte
185
183
requestCtx .Response .SetBodyString (userInput ) // $ XssSink=userInput
186
184
requestCtx .Response .SetBodyRaw (userInputByte ) // $ XssSink=userInputByte
0 commit comments