@@ -15,7 +15,7 @@ type ScannerCheck func(baseURL string, ssrfHost string, client *HTTPClient) []Fi
1515
1616var (
1717 scannerChecks = make (map [string ]ScannerCheck )
18- scannerMutex sync.Mutex
18+ scannerMutex sync.Mutex
1919)
2020
2121// RegisterScannerCheck registers a vulnerability check
@@ -152,6 +152,7 @@ func checkGetServlet(baseURL string, ssrfHost string, client *HTTPClient) []Find
152152 if err != nil {
153153 continue
154154 }
155+ defer resp .Body .Close ()
155156
156157 if resp .StatusCode == 200 {
157158 body , _ := io .ReadAll (resp .Body )
@@ -209,6 +210,7 @@ func checkQueryBuilderServlet(baseURL string, ssrfHost string, client *HTTPClien
209210 if err != nil {
210211 continue
211212 }
213+ defer resp .Body .Close ()
212214
213215 if resp .StatusCode == 200 {
214216 body , _ := io .ReadAll (resp .Body )
@@ -269,6 +271,7 @@ func checkGQLServlet(baseURL string, ssrfHost string, client *HTTPClient) []Find
269271 if err != nil {
270272 continue
271273 }
274+ defer resp .Body .Close ()
272275
273276 if resp .StatusCode == 200 {
274277 body , _ := io .ReadAll (resp .Body )
@@ -316,6 +319,7 @@ func checkPostServlet(baseURL string, ssrfHost string, client *HTTPClient) []Fin
316319 if err != nil {
317320 continue
318321 }
322+ defer resp .Body .Close ()
319323
320324 if resp .StatusCode == 200 {
321325 body , _ := io .ReadAll (resp .Body )
@@ -361,6 +365,7 @@ func checkCreateNewNodes(baseURL string, ssrfHost string, client *HTTPClient) []
361365 if err != nil {
362366 continue
363367 }
368+ defer resp .Body .Close ()
364369
365370 if resp .StatusCode == 200 || resp .StatusCode == 201 {
366371 body , _ := io .ReadAll (resp .Body )
@@ -401,6 +406,7 @@ func checkCreateNewNodes(baseURL string, ssrfHost string, client *HTTPClient) []
401406 if err != nil {
402407 continue
403408 }
409+ defer resp .Body .Close ()
404410
405411 if resp .StatusCode == 200 || resp .StatusCode == 201 {
406412 body , _ := io .ReadAll (resp .Body )
@@ -444,6 +450,7 @@ func checkLoginStatusServlet(baseURL string, ssrfHost string, client *HTTPClient
444450 if err != nil {
445451 continue
446452 }
453+ defer resp .Body .Close ()
447454
448455 if resp .StatusCode == 200 {
449456 body , _ := io .ReadAll (resp .Body )
@@ -466,6 +473,7 @@ func checkLoginStatusServlet(baseURL string, ssrfHost string, client *HTTPClient
466473 if err != nil {
467474 continue
468475 }
476+ defer resp2 .Body .Close ()
469477
470478 if resp2 .StatusCode == 200 {
471479 body2 , _ := io .ReadAll (resp2 .Body )
@@ -512,6 +520,7 @@ func checkUserInfoServlet(baseURL string, ssrfHost string, client *HTTPClient) [
512520 if err != nil {
513521 continue
514522 }
523+ defer resp .Body .Close ()
515524
516525 if resp .StatusCode == 200 {
517526 body , _ := io .ReadAll (resp .Body )
@@ -534,6 +543,7 @@ func checkUserInfoServlet(baseURL string, ssrfHost string, client *HTTPClient) [
534543 if err != nil {
535544 continue
536545 }
546+ defer resp2 .Body .Close ()
537547
538548 if resp2 .StatusCode == 200 {
539549 body2 , _ := io .ReadAll (resp2 .Body )
@@ -582,6 +592,7 @@ func checkFelixConsole(baseURL string, ssrfHost string, client *HTTPClient) []Fi
582592 if err != nil {
583593 continue
584594 }
595+ defer resp .Body .Close ()
585596
586597 if resp .StatusCode == 200 {
587598 body , _ := io .ReadAll (resp .Body )
@@ -621,6 +632,7 @@ func checkWCMDebugFilter(baseURL string, ssrfHost string, client *HTTPClient) []
621632 if err != nil {
622633 continue
623634 }
635+ defer resp .Body .Close ()
624636
625637 if resp .StatusCode == 200 {
626638 body , _ := io .ReadAll (resp .Body )
@@ -663,6 +675,7 @@ func checkWCMSuggestionsServlet(baseURL string, ssrfHost string, client *HTTPCli
663675 if err != nil {
664676 continue
665677 }
678+ defer resp .Body .Close ()
666679
667680 if resp .StatusCode == 200 {
668681 body , _ := io .ReadAll (resp .Body )
@@ -711,6 +724,7 @@ func checkCRXDECRX(baseURL string, ssrfHost string, client *HTTPClient) []Findin
711724 if err != nil {
712725 continue
713726 }
727+ defer resp .Body .Close ()
714728
715729 if resp .StatusCode == 200 {
716730 body , _ := io .ReadAll (resp .Body )
@@ -765,6 +779,7 @@ func checkGroovyConsole(baseURL string, ssrfHost string, client *HTTPClient) []F
765779 if err != nil {
766780 continue
767781 }
782+ defer resp .Body .Close ()
768783
769784 if resp .StatusCode == 200 {
770785 body , _ := io .ReadAll (resp .Body )
@@ -811,6 +826,7 @@ func checkGroovyConsole(baseURL string, ssrfHost string, client *HTTPClient) []F
811826 if err != nil {
812827 continue
813828 }
829+ defer resp .Body .Close ()
814830
815831 if resp .StatusCode == 200 {
816832 body , _ := io .ReadAll (resp .Body )
@@ -862,6 +878,7 @@ func checkACSTools(baseURL string, ssrfHost string, client *HTTPClient) []Findin
862878 if err != nil {
863879 continue
864880 }
881+ defer resp .Body .Close ()
865882
866883 if resp .StatusCode == 200 {
867884 body , _ := io .ReadAll (resp .Body )
@@ -882,16 +899,17 @@ func checkACSTools(baseURL string, ssrfHost string, client *HTTPClient) []Findin
882899 // Check predicates endpoint
883900 predicatesURL := NormalizeURL (baseURL , "/bin/acs-tools/qe/predicates.json" )
884901 resp , err := client .Get (predicatesURL , nil )
885- if err == nil && resp .StatusCode == 200 {
886- body , _ := io .ReadAll (resp .Body )
887- resp .Body .Close ()
888-
889- if strings .Contains (string (body ), "relativedaterange" ) {
890- findings = append (findings , Finding {
891- Name : "ACSTools" ,
892- URL : predicatesURL ,
893- Description : "ACS Tools predicates." ,
894- })
902+ if err == nil {
903+ defer resp .Body .Close ()
904+ if resp .StatusCode == 200 {
905+ body , _ := io .ReadAll (resp .Body )
906+ if strings .Contains (string (body ), "relativedaterange" ) {
907+ findings = append (findings , Finding {
908+ Name : "ACSTools" ,
909+ URL : predicatesURL ,
910+ Description : "ACS Tools predicates." ,
911+ })
912+ }
895913 }
896914 }
897915
@@ -917,6 +935,7 @@ func checkWebDAV(baseURL string, ssrfHost string, client *HTTPClient) []Finding
917935 if err != nil {
918936 continue
919937 }
938+ defer resp .Body .Close ()
920939
921940 if resp .StatusCode == 401 {
922941 wwwAuth := strings .ToLower (resp .Header .Get ("WWW-Authenticate" ))
@@ -956,6 +975,7 @@ func checkSetPreferences(baseURL string, ssrfHost string, client *HTTPClient) []
956975 if err != nil {
957976 continue
958977 }
978+ defer resp .Body .Close ()
959979
960980 if resp .StatusCode == 400 {
961981 body , _ := io .ReadAll (resp .Body )
@@ -997,6 +1017,7 @@ func checkMergeMetadata(baseURL string, ssrfHost string, client *HTTPClient) []F
9971017 if err != nil {
9981018 continue
9991019 }
1020+ defer resp .Body .Close ()
10001021
10011022 if resp .StatusCode == 200 {
10021023 body , _ := io .ReadAll (resp .Body )
@@ -1052,6 +1073,7 @@ func checkGuideInternalSubmitServlet(baseURL string, ssrfHost string, client *HT
10521073 if err != nil {
10531074 continue
10541075 }
1076+ defer resp .Body .Close ()
10551077
10561078 if resp .StatusCode == 200 {
10571079 body , _ := io .ReadAll (resp .Body )
@@ -1110,6 +1132,7 @@ func checkReportingServicesServlet(baseURL string, ssrfHost string, client *HTTP
11101132 if err != nil {
11111133 continue
11121134 }
1135+ defer resp .Body .Close ()
11131136 if resp .StatusCode == 200 {
11141137 resp .Body .Close ()
11151138 return []Finding {{
@@ -1227,6 +1250,7 @@ func checkSWFXSS(baseURL string, ssrfHost string, client *HTTPClient) []Finding
12271250 if err != nil {
12281251 continue
12291252 }
1253+ defer resp .Body .Close ()
12301254
12311255 if resp .StatusCode == 200 {
12321256 ct := ContentType (resp .Header .Get ("Content-Type" ))
@@ -1278,4 +1302,3 @@ func checkExternalJobServlet(baseURL string, ssrfHost string, client *HTTPClient
12781302 }
12791303 return nil
12801304}
1281-
0 commit comments