feat: make rustls-backed TLS an opt-in feature - #58
Open
donbeave wants to merge 1 commit into
Open
Conversation
The manifest unconditionally enabled tonic's tls-ring feature, so every consumer carried a rustls/tokio-rustls dependency even when connecting over plaintext to a trusted local endpoint, or when their organization mandates the operating system's native TLS stack and forbids bundled rustls trust roots. This makes TLS opt-in via a new 'tls-ring' crate feature that forwards to tonic/tls-ring. Without it the client is plaintext-only: Certificate, Identity, ClientTlsConfig imports, the client_tls_config channel state, ChannelManager::with_tls_config, and Client::with_tls_and_urls are gated behind the feature, and endpoint URLs are always http. ClientTlsOption and ChannelConfig::client_tls stay available unconditionally so config parsing does not change shape. Verified: - cargo check/test --no-default-features (plaintext): green, and cargo tree -i rustls / -i tokio-rustls match no packages - cargo check/test --features tls-ring: green, unchanged behavior - cargo check/test with default features: green This is a behavior change for consumers relying on the implicit TLS default: they now enable the 'tls-ring' feature explicitly. Signed-off-by: Alexey Zhokhov <alexey@zhokhov.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.
What
The manifest unconditionally enables tonic's
tls-ringfeature, so every consumer carries a rustls/tokio-rustls dependency — even when connecting over plaintext to a trusted local endpoint, or when their organization mandates the operating system's native TLS stack and forbids bundled rustls trust roots.This PR makes TLS opt-in via a new
tls-ringcrate feature that forwards totonic/tls-ring:Certificate/Identity/ClientTlsConfigimports, theclient_tls_configchannel state,ChannelManager::with_tls_config, andClient::with_tls_and_urlsarecfg-gated, and endpoint URLs are alwayshttp.ClientTlsOptionandChannelConfig::client_tlsstay available unconditionally so configuration parsing does not change shape.--features tls-ringeverything behaves exactly as before.Verification
cargo check/cargo test --no-default-features: green, andcargo tree -i rustls/-i tokio-rustlsmatch no packagescargo check/cargo test --features tls-ring: greencargo check/cargo test(default features): greencargo fmt --check,cargo clippy --no-default-features: cleanNote on compatibility
This changes the implicit default: consumers relying on TLS today need to enable the
tls-ringfeature explicitly. If you prefer to keep backward compatibility, an alternative isdefault = ["tls-ring"]— plaintext consumers would then usedefault-features = false. Happy to switch to that shape if you prefer.Context: we ship an observability tool (Parallax) with a strict native-TLS-only dependency policy and a plaintext trusted local hop to a managed GreptimeDB; the unconditional rustls edge is currently the only thing keeping us on the HTTP SQL path instead of the row API. A follow-up we'd also be interested in contributing is a native-TLS connector via
Endpoint::connect_with_connector_lazy.🤖 Generated with Claude Code