Skip to content

Commit

Permalink
lib/services/saml: ensure response body is closed (#40725)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmb3 authored Apr 22, 2024
1 parent 4f2fdfd commit e69c778
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/services/saml.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ func ValidateSAMLConnector(sc types.SAMLConnector, rg RoleGetter) error {
if err != nil {
return trace.WrapWithMessage(err, "unable to fetch entity descriptor from %v for SAML connector %v", sc.GetEntityDescriptorURL(), sc.GetName())
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return trace.BadParameter("status code %v when fetching from %v for SAML connector %v", resp.StatusCode, sc.GetEntityDescriptorURL(), sc.GetName())
}
defer resp.Body.Close()
body, err := utils.ReadAtMost(resp.Body, teleport.MaxHTTPResponseSize)
if err != nil {
return trace.Wrap(err)
Expand Down

0 comments on commit e69c778

Please sign in to comment.