Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo appears to leak SSL_CERT_FILE and SSL_CERT_DIR to subprocesses #3676

Open
sfackler opened this issue Feb 9, 2017 · 9 comments
Open
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-environment-variables Area: environment variables C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@sfackler
Copy link
Member

sfackler commented Feb 9, 2017

I have not personally confirmed that this is the case, but I'm betting it's the cause of sfackler/rust-openssl#575

cc #2888

@sfackler
Copy link
Member Author

sfackler commented Feb 9, 2017

Looks like its probably a dependency doing this (maybe libcurl?). Might be a bit awkward to deal with, but we could maybe snapshot the environment on startup and feed that to subprocesses?

@sfackler
Copy link
Member Author

sfackler commented Feb 9, 2017

Oh right, it's openssl-probe.

@alexcrichton
Copy link
Member

Yeah I'm ~100% sure openssl-probe would be doing this.

I had no idea this could lead to bugs...

@nathanaeljones for background on this there's a very long comment explaining what's going on, but the general gist is that we're shipping a statically linked OpenSSL so it's up to Cargo to find ssl certs for a system (normally this is configured by a distro). In doing so the only way we've found at least so far is to initialize through env vars, which is then causing this to leak into child processes.

@jethrogb
Copy link
Contributor

jethrogb commented May 7, 2017

Got bit by this in #4002

@jethrogb
Copy link
Contributor

jethrogb commented May 7, 2017

Instead of overriding the environment, cargo should use X509_STORE_load_locations instead of X509_STORE_set_default_paths on every X509 store to set the locations found using openssl-probe.

@sfackler
Copy link
Member Author

sfackler commented May 7, 2017

@jethrogb this is all mediated through curl which AFAIK doesn't expose that.

@jethrogb
Copy link
Contributor

jethrogb commented May 7, 2017

Sure it does, you just need to set CURLOPT_CAINFO and CURLOPT_CAPATH.

@alexcrichton
Copy link
Member

PRs are of course always welcome to patch this up! This isn't intentional, it's just a side effect of how things are implemented today.

@sfackler
Copy link
Member Author

sfackler commented May 8, 2017

Those environment variables will still affect anything downstream using curl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-environment-variables Area: environment variables C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

5 participants