Skip to content

Commit

Permalink
Ignore defer close gosec warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nmanoogian committed Apr 25, 2023
1 parent fd05562 commit afc0920
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ func performRequest(req *http.Request, verifyTLS bool) (int, http.Header, []byte

requestErr := retry(RequestAttempts, 100*time.Millisecond, func() error {
// disable semgrep rule b/c we properly check that resp isn't nil before using it within the err block
resp, err := client.Do(req) // nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable
resp, err := client.Do(req) // nosec: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable
if err != nil {
if resp != nil {
defer resp.Body.Close()
defer resp.Body.Close() // #nosec: G307
}

utils.LogDebug(err.Error())
Expand Down Expand Up @@ -264,7 +264,7 @@ func performRequest(req *http.Request, verifyTLS bool) (int, http.Header, []byte
})

if response != nil {
defer response.Body.Close()
defer response.Body.Close() // #nosec: G307
}

if requestErr != nil && response == nil {
Expand Down

0 comments on commit afc0920

Please sign in to comment.