Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Do not reuse transport #25

Closed
wants to merge 1 commit into from
Closed

Conversation

ctrox
Copy link

@ctrox ctrox commented Dec 17, 2019

Reusing the base transport can have unintended side effects, for example when setting VAULT_CACERT requests to the IAM API break as the cert store is modified.

Closes #24

Because this breaks setting VAULT_CACERT as the certificate store from
the vault client will be reused
@tonglil tonglil requested review from a team, msuterski, akhenakh and sbower and removed request for a team May 7, 2020 18:58
@msuterski
Copy link

thanks for the PR @ctrox !

What are the consequences of not re-using the Transport?

@ctrox
Copy link
Author

ctrox commented May 8, 2020

Hard to say what the initial intention was, but my best guess is that it was being reused to inherit the IdleConnTimeout timeout set here. But in general I think it is a bad idea, since the call to Vaults NewClient is initializing the transport and potentially headers and other things that are set there could be leaked to Googles IAM API.

@msuterski
Copy link

@ctrox sorry for the delay.

There was a change introduced few months ago that attempted to not reuse the http client, because headers could have been re-used between calls

#23

If I understand your change correctly, this addresses similar problem, but on a different level of a request, where certs attached to a request could be reused between calls. Is this correct?

@ctrox
Copy link
Author

ctrox commented May 29, 2020

No worries!

Yes exactly, the change in #23 makes sure the whole http.Client is not reused but still reused the base transport (Base: hc.Transport,), which contains the cert store and resulted in my failure as my connection to Vault has a modified cert store, trusting some internal CA. So this broke subsequent requests to the IAM API as it reused that cert store. I hope this clears it up.

@msuterski msuterski removed their request for review October 8, 2021 18:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transport reuse breaks VAULT_CACERT
3 participants