Uh oh!
There was an error while loading. Please reload this page.
Use rustls for TLS - #2
Merged
Merged
Conversation
HTHou
marked this pull request as ready for review
August 12, 2026 10:06
CritasWang
approved these changes
Aug 12, 2026
There was a problem hiding this comment.
Pull request overview
Migrates optional TLS support from native-tls to rustls while preserving existing configuration behavior.
Changes:
- Adds rustls transport, native roots, custom CAs, hostname override, and mutual TLS.
- Reworks TLS fixtures and tests.
- Adds cross-platform TLS and Rust 1.75 CI coverage.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
Cargo.toml | Replaces native-tls dependencies with rustls. |
src/connection/mod.rs | Implements rustls transport and tests. |
src/error.rs | Updates TLS error representation. |
README.md | Documents rustls behavior. |
README_ZH.md | Adds Chinese rustls documentation. |
.github/workflows/ci.yml | Adds platform and MSRV jobs. |
tests/fixtures/tls/README.md | Updates certificate-generation guidance. |
tests/fixtures/tls/cert.pem | Regenerates the server certificate. |
tests/fixtures/tls/client-cert.pem | Regenerates the client certificate. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/connection/mod.rs:288
- The rustls migration leaves hostname verification and
domain_overrideuntested. The loopback certificate contains SANs for both the endpoint (127.0.0.1) and the override (localhost), so the current successful handshake would also pass if this line ignored the override, and no test checks that a mismatched name is rejected. Add coverage using a name absent from the certificate (and a valid override) so this acceptance criterion cannot regress.
let domain = tls.domain_override.as_deref().unwrap_or(&endpoint.host);
let server_name = ServerName::try_from(domain.to_owned())
.map_err(|e| Error::Client(format!("invalid TLS server name '{domain}': {e}")))?;
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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
native-tlsclient transport with rustls 0.23 using theringcrypto providerrustls-native-certs, then use rustls/WebPKI for consistent certificate-chain and hostname verification on every platformthrift = "0.23"; TLS continues to wrap the TCP stream below Thrift's framed transportThe explicit
uuid,zeroize, and Applesecurity-frameworkcompatibility constraints keep this lockfile-free library resolvable with the declared Rust 1.75 MSRV.Closes#1.
User impact
The existing
tlsfeature and public configuration fields remain unchanged. TLS-enabled builds now use rustls for TLS 1.2/1.3.rustls-native-certssupplies the native trust roots andca_cert_pathaugments them, while rustls/WebPKI applies the same verification rules across macOS, Windows, and Linux.accept_invalid_certsskips certificate-chain and hostname verification, while TLS handshake signatures remain cryptographically verified.Validation
./tools/check-license.shcargo fmt --all -- --checkcargo clippy --all-targets --no-default-features -- -D warningscargo clippy --all-targets --features tls -- -D warningscargo test --features tls(124 unit tests + doc test)cargo check --features tlswith Rust 1.75.0cargo package --allow-dirty