Fix SSL certificate verification#47
Merged
Merged
Conversation
- Load system CA certs explicitly instead of relying on set_default_verify_paths(), which fails when OpenSSL is vendored (compiled-in OPENSSLDIR points to nonexistent path) - Include verify_certs in ConnMode cache key so connections with different verify settings don't share a cached hyper Client - Add timeout parameter to raw_connect Python binding - Wrap TCP connect in a timeout (was missing, causing hangs) - Add Rust and Python tests for all connection types
F1: verify_certs=True now checks hostname (set_host/set_ip on both TLS paths) F2: TLS and proxy handshakes bounded by connect timeout (pooled + raw paths) F3: ConnMode cache key includes cipher_string, TLS versions, and ALPN F4: load_system_ca_certs tracks dir loading to avoid unnecessary fallback
ausmaster
self-requested a review
June 15, 2026 21:19
|
Approved btw. |
liquidsec
added a commit
that referenced
this pull request
Jun 15, 2026
* chore(deps): bump http from 1.4.1 to 1.4.2 Bumps [http](https://github.com/hyperium/http) from 1.4.1 to 1.4.2. - [Release notes](https://github.com/hyperium/http/releases) - [Changelog](https://github.com/hyperium/http/blob/master/CHANGELOG.md) - [Commits](hyperium/http@v1.4.1...v1.4.2) --- updated-dependencies: - dependency-name: http dependency-version: 1.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps-dev): bump ruff from 0.15.15 to 0.15.17 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.15 to 0.15.17. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@0.15.15...0.15.17) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.15.17 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump version to 0.9.0 * chore(deps): bump openssl from 0.10.80 to 0.10.81 (#45) Bumps [openssl](https://github.com/rust-openssl/rust-openssl) from 0.10.80 to 0.10.81. - [Release notes](https://github.com/rust-openssl/rust-openssl/releases) - [Commits](rust-openssl/rust-openssl@openssl-v0.10.80...openssl-v0.10.81) --- updated-dependencies: - dependency-name: openssl dependency-version: 0.10.81 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix SSL certificate verification (#47) * Fix SSL certificate verification (verify_certs=True) - Load system CA certs explicitly instead of relying on set_default_verify_paths(), which fails when OpenSSL is vendored (compiled-in OPENSSLDIR points to nonexistent path) - Include verify_certs in ConnMode cache key so connections with different verify settings don't share a cached hyper Client - Add timeout parameter to raw_connect Python binding - Wrap TCP connect in a timeout (was missing, causing hangs) - Add Rust and Python tests for all connection types * Replace deprecated as_utf8() with to_string() * Update Cargo.lock for 0.9.0 * Add hostname verification, timeout coverage, and TLS cache key fixes F1: verify_certs=True now checks hostname (set_host/set_ip on both TLS paths) F2: TLS and proxy handshakes bounded by connect timeout (pooled + raw paths) F3: ConnMode cache key includes cipher_string, TLS versions, and ALPN F4: load_system_ca_certs tracks dir loading to avoid unnecessary fallback * Fix rustfmt in tls_server.rs --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
verify_certs=Truevalidated the certificate chain but did NOT verify the hostname. A cert valid for any domain was accepted when connecting to any other domain. Fixed by callingset_host()/set_ip()on the X509 verify params on both TLS paths (pooled and raw).set_default_verify_paths()looks at a compiled-in OPENSSLDIR that doesn't exist on the host. Replaced withload_system_ca_certs()that checksSSL_CERT_FILE/SSL_CERT_DIRenv vars, then probes well-known system paths. Also fixed dir-loading not being tracked, which caused an unnecessary fallback toset_default_verify_paths().tokio::time::timeouton both pooled and raw paths. Also setHttpConnector::set_connect_timeoutfor the pooled path's TCP phase.ConnModeonly keyed on proxy URL andverify_certs, so requests with different cipher strings, TLS versions, or ALPN protocols shared the same cached client. ExtractedTlsKeystruct (verify_certs + cipher_string + min/max TLS version + ALPN) and included it in all ConnMode variants.timeoutparameter to theraw_connectPython binding and wrappedTcpStream::connectin a timeout.as_utf8()withto_string()(4 call sites in cert info extraction).