Skip to content

saml: close the IdP metadata HTTP response body - #195

Open
pacocartones wants to merge 1 commit into
hashicorp:mainfrom
pacocartones:fix/close-idp-metadata-response-body
Open

pacocartones wants to merge 1 commit into
hashicorp:mainfrom
pacocartones:fix/close-idp-metadata-response-body

Conversation

@pacocartones

Copy link
Copy Markdown

fetchIDPMetadata (saml/sp.go) reads res.Body via io.ReadAll but never closes it, so the response body / connection leaks. The two other HTTP fetch sites in this repo already handle this correctly — oidc/provider.go and jwt/keyset.go both defer resp.Body.Close(). This adds the same defer res.Body.Close() right after the successful http.Get.

One-line change; go build ./saml/ passes.

fetchIDPMetadata reads res.Body but never closes it, leaking the connection.
The two other HTTP fetch sites in this repo already close it correctly
(oidc/provider.go and jwt/keyset.go both defer resp.Body.Close()).

Signed-off-by: pacocartones <pacocartones@users.noreply.github.com>
@pacocartones
pacocartones requested a review from a team as a code owner August 29, 2026 20:48
@hashicorp-cla-app

hashicorp-cla-app Bot commented Aug 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant