Skip to content

fix(features): don't enable rustls/default from rustls-ring#220

Open
EddieHouston wants to merge 1 commit into
bitcoindevkit:masterfrom
EddieHouston:fix/rustls-ring-no-default
Open

fix(features): don't enable rustls/default from rustls-ring#220
EddieHouston wants to merge 1 commit into
bitcoindevkit:masterfrom
EddieHouston:fix/rustls-ring-no-default

Conversation

@EddieHouston

Copy link
Copy Markdown
Contributor

Fixes #219.

The rustls-ring feature used "rustls/ring" (without ?), which also activates the crate's explicit rustls feature, and that feature enables rustls/default, i.e. the aws-lc-rs provider. So a downstream asking for use-rustls-ring (expecting ring only) ended up with both providers enabled on rustls:

electrum-client feature "rustls"
  └── electrum-client feature "rustls-ring"
      └── electrum-client feature "use-rustls-ring"

With both providers compiled in, any crate in the same binary relying on rustls's process-default provider panics on first TLS use ("exactly one of aws-lc-rs and ring"). electrum-client itself is unaffected (it selects its provider explicitly), but we hit this in lwk after bumping electrum-client 0.21 -> 0.25: the shared rustls went from ring-only to ring + aws-lc-rs and an unrelated tokio-tungstenite connection started panicking.

Before (on master, --no-default-features --features use-rustls-ring):

rustls v0.23.41 aws-lc-rs,aws_lc_rs,default,log,logging,prefer-post-quantum,ring,std,tls12

After:

rustls v0.23.41 log,logging,ring,std,tls12

The default (rustls/aws-lc) feature path is unchanged. Note this is behavior-visible for any downstream that unintentionally relied on the leak to get aws-lc-rs while only enabling use-rustls-ring; they would need to enable the aws-lc provider themselves.

"rustls/ring" (without ?) also activates the crate's explicit `rustls`
feature, which enables rustls/default, i.e. the aws-lc-rs provider. So
use-rustls-ring ends up enabling both crypto providers on rustls, and any
crate in the same binary relying on the process-default provider panics
("exactly one of aws-lc-rs and ring"). Use the ?/ syntax so rustls-ring
stays ring-only.

Fixes bitcoindevkit#219
@oleonardolima
oleonardolima force-pushed the fix/rustls-ring-no-default branch from 8ef4974 to 2fe62df Compare July 23, 2026 18:26
@oleonardolima oleonardolima added the bug Something isn't working label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use-rustls-ring transitively enables rustls/default (aws-lc-rs), breaking ring-only builds

2 participants