Repository navigation
Separate TLS transport features from the crypto provider choice - #151
Conversation
`export-grpc` and `export-http-*` now select a transport only, and the new `tls-aws-lc` feature (on by default) supplies aws-lc-rs as the rustls `CryptoProvider` for whichever of them are enabled. This matches the default provider of both `rustls` and `reqwest`, and stops the SDK from compiling two providers into applications which already use one. An application which installs a provider before configuring Logfire keeps using it, since `tonic` and `reqwest` both prefer an installed provider. That is how to export using `ring`, a FIPS build of aws-lc-rs, or any other provider. Disabling default features leaves no built-in provider at all, and building an exporter then reports `CryptoProviderRequired` rather than letting `reqwest` panic. Also configure TLS explicitly for https gRPC endpoints. `tonic` only does so in `Endpoint::new`, which none of its public constructors reach, so exporting over gRPC to an https endpoint failed with "Connecting to HTTPS without TLS enabled". `tonic/tls-native-roots` supplies the trust anchors it needs.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟡 Changes recommended
The TLS documentation is incomplete, and the stated breaking-change scope omits the new exhaustive-enum break.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Separates transport features from rustls provider selection and fixes TLS configuration for gRPC HTTPS exports.
Changes:
- Adds explicit gRPC TLS setup and provider validation.
- Introduces opt-in/default
tls-aws-lcfeatures. - Adds provider tests and no-provider CI coverage.
File summaries
| File | Description |
|---|---|
.github/workflows/main.yml |
Adds no-provider build and test checks. |
logfire/Cargo.toml |
Separates transport and provider features. |
logfire/src/exporters.rs |
Configures gRPC TLS and validates providers. |
logfire/src/lib.rs |
Documents TLS setup and its error. |
logfire/tests/test_crypto_provider.rs |
Tests exporter provider requirements. |
logfire-client/Cargo.toml |
Adds separate provider selection. |
logfire-client/src/builder.rs |
Reports missing provider errors. |
logfire-client/tests/test_crypto_provider.rs |
Tests client provider requirements. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Both from review feedback. Adding a variant to `BuilderError` breaks downstream exhaustive matches whatever features are enabled, so mark it `#[non_exhaustive]` as `ConfigureError` already is. The documented no-default-features setup also needs a direct `rustls` dependency to choose a provider, with `rustls`'s own default features disabled, since those include aws-lc-rs.
| } | ||
|
|
||
| /// Install a provider, for test configurations which have no built-in one. | ||
| fn install_crypto_provider() { |
There was a problem hiding this comment.
This looks a little suspect? Is there another way we can do this
cetra3
left a comment
There was a problem hiding this comment.
LGTM, can we test compiling with different feature flags to make sure that we can still compile?
|
Added a features job running |
Transport features and the choice of rustls
CryptoProviderare now separate, so applications can either ignore the question entirely or pick a provider themselves. This follows up on #150.gRPC export over https is currently broken
Before this PR, exporting over gRPC to an https endpoint fails for everyone:
tonicconfigures TLS for an https URI only inEndpoint::new, and none of its public constructors reach it:Channel::builder,Endpoint::from_shared, everyTryFromandFromStrall route tonew_uri, which leavestls: None. So the exporter never enabled TLS, whatever the TLS features said. This PR sets it explicitly, and addstonic/tls-native-rootsfor the trust anchors that needs. Verified against tonic 0.14.6 by connecting to a real https endpoint: it fails as above beforehand and connects afterwards.Features
export-grpc,export-http-protobuf,export-http-jsontls-aws-lc(default)An installed provider always wins, because
tonicandreqwestboth prefer one over their own fallback. The SDK never installs a process-wide provider itself, since that would break an application's owninstall_default().With default features off there is no fallback, and building an exporter returns the new
ConfigureError::CryptoProviderRequiredinstead of lettingreqwestpanic.logfire-clientgets the same split andBuilderError::CryptoProviderRequired.aws-lc-rs is also the default provider of rustls 0.23 and reqwest 0.13, so the default here is the option least likely to collide with the rest of an application's graph. Note that
export-http-protobufalready pulled in aws-lc-rs through reqwest before this PR, so default builds gain nothing new.FIPS
FIPS needs no feature of its own: enable rustls's
fipsfeature, which switches aws-lc-rs to its FIPS module, and installrustls::crypto::default_fips_provider(). Afipsfeature here would forcecargo clippy --all-featuresandcargo llvm-cov --all-featuresto build the FIPS module in CI, which needs a heavier toolchain.Breaking changes
default-features = falsewith an export feature must now either addtls-aws-lcor install a provider before configuring Logfire.match, whatever features are enabled.ConfigureErrorwas already#[non_exhaustive];BuilderErroris now marked the same way, so future variants do not repeat this.Tests and CI
grpc_tls_tests::https_endpoints_have_tls_configuredconnects to a listener that accepts and never replies: with TLS configured the attempt times out, without ittonicfails immediately. Confirmed it fails when the fix is mutated away, rather than passing by construction.test_crypto_providerin both crates asserts the error without a provider and success once one is installed.cargo treecheck that neither aws-lc-rs nor ring is compiled withouttls-aws-lc.Locally:
cargo test --workspace --all-features,--no-default-features, clippy, rustdoc and doctests all pass.The documented ring-only recipe was also run as written in a separate crate: building an exporter reports
CryptoProviderRequiredbefore a provider is installed and succeeds afterwards, andcargo tree -e normalcontains ring with no aws-lc-rs.