@@ -23,31 +23,31 @@ func HandlerGin(c *gin.Context) {
2323 safe string `binding:"alphanum"`
2424 }
2525
26- err := c .ShouldBindJSON (& body )
26+ err := c .ShouldBindJSON (& body ) // $ Source
2727
2828 http .Get (fmt .Sprintf ("http://example.com/%d" , body .integer )) // OK
2929 http .Get (fmt .Sprintf ("http://example.com/%v" , body .float )) // OK
3030 http .Get (fmt .Sprintf ("http://example.com/%v" , body .boolean )) // OK
31- http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // SSRF
32- http .Get (fmt .Sprintf ("http://example.com/%s" , body .safe )) // SSRF
31+ http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // $ Alert
32+ http .Get (fmt .Sprintf ("http://example.com/%s" , body .safe )) // $ Alert
3333
3434 if err == nil {
35- http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // SSRF
35+ http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // $ Alert
3636 http .Get (fmt .Sprintf ("http://example.com/%s" , body .safe )) // OK
3737 }
3838
39- taintedParam := c .Param ("id" )
39+ taintedParam := c .Param ("id" ) // $ Source
4040
4141 validate := validator .New ()
4242 err = validate .Var (taintedParam , "alpha" )
4343 if err == nil {
4444 http .Get ("http://example.com/" + taintedParam ) // OK
4545 }
4646
47- http .Get ("http://example.com/" + taintedParam ) //SSRF
47+ http .Get ("http://example.com/" + taintedParam ) // $ Alert
4848
49- taintedQuery := c .Query ("id" )
50- http .Get ("http://example.com/" + taintedQuery ) //SSRF
49+ taintedQuery := c .Query ("id" ) // $ Source
50+ http .Get ("http://example.com/" + taintedQuery ) // $ Alert
5151}
5252
5353func HandlerHttp (req * http.Request ) {
@@ -59,41 +59,41 @@ func HandlerHttp(req *http.Request) {
5959 word string
6060 safe string `validate:"alphanum"`
6161 }
62- reqBody , _ := ioutil .ReadAll (req .Body )
62+ reqBody , _ := ioutil .ReadAll (req .Body ) // $ Source
6363 json .Unmarshal (reqBody , & body )
6464
6565 http .Get (fmt .Sprintf ("http://example.com/%d" , body .integer )) // OK
6666 http .Get (fmt .Sprintf ("http://example.com/%v" , body .float )) // OK
6767 http .Get (fmt .Sprintf ("http://example.com/%v" , body .boolean )) // OK
68- http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // SSRF
69- http .Get (fmt .Sprintf ("http://example.com/%s" , body .safe )) // SSRF
68+ http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // $ Alert
69+ http .Get (fmt .Sprintf ("http://example.com/%s" , body .safe )) // $ Alert
7070
7171 validate := validator .New ()
7272 err := validate .Struct (body )
7373 if err == nil {
74- http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // SSRF
74+ http .Get (fmt .Sprintf ("http://example.com/%s" , body .word )) // $ Alert
7575 http .Get (fmt .Sprintf ("http://example.com/%s" , body .safe )) // OK
7676 }
7777
78- taintedQuery := req .URL .Query ().Get ("param1" )
79- http .Get ("http://example.com/" + taintedQuery ) // SSRF
78+ taintedQuery := req .URL .Query ().Get ("param1" ) // $ Source
79+ http .Get ("http://example.com/" + taintedQuery ) // $ Alert
8080
81- taintedParam := strings .TrimPrefix (req .URL .Path , "/example-path/" )
82- http .Get ("http://example.com/" + taintedParam ) // SSRF
81+ taintedParam := strings .TrimPrefix (req .URL .Path , "/example-path/" ) // $ Source
82+ http .Get ("http://example.com/" + taintedParam ) // $ Alert
8383}
8484
8585func HandlerMux (r * http.Request ) {
86- vars := mux .Vars (r )
86+ vars := mux .Vars (r ) // $ Source
8787 taintedParam := vars ["id" ]
88- http .Get ("http://example.com/" + taintedParam ) // SSRF
88+ http .Get ("http://example.com/" + taintedParam ) // $ Alert
8989
9090 numericID , _ := strconv .Atoi (taintedParam )
9191 http .Get (fmt .Sprintf ("http://example.com/%d" , numericID )) // OK
9292}
9393
9494func HandlerChi (r * http.Request ) {
95- taintedParam := chi .URLParam (r , "articleID" )
96- http .Get ("http://example.com/" + taintedParam ) // SSRF
95+ taintedParam := chi .URLParam (r , "articleID" ) // $ Source
96+ http .Get ("http://example.com/" + taintedParam ) // $ Alert
9797
9898 b , _ := strconv .ParseBool (taintedParam )
9999 http .Get (fmt .Sprintf ("http://example.com/%t" , b )) // OK
0 commit comments