Repository navigation
fix(features): don't enable rustls/default from rustls-ring - #220
EddieHouston wants to merge 1 commit into
Conversation
"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
8ef4974 to
2fe62df
Compare
caarloshenriq
left a comment
There was a problem hiding this comment.
tACK 2fe62df
Confirmed the before and after feature sets from the description with cargo tree -e normal -i rustls. Also reproduced the downstream panic with a minimal binary depending on electrum-client with use-rustls-ring and calling rustls::ClientConfig::builder() before any electrum-client connection: panics on master, runs clean on this PR.
|
Tested ACK 2fe62df We ran into #219 in a wallet that uses electrum-client 0.25.0 through bdk_electrum 0.24.0 with
With this branch patched in (
|
|
@oleonardolima @notmandatory I ran into this too can we get this merged?
|
notmandatory
left a comment
There was a problem hiding this comment.
ACK 2fe62df
Confirmed locally.
Fixes #219.
The
rustls-ringfeature used"rustls/ring"(without?), which also activates the crate's explicitrustlsfeature, and that feature enablesrustls/default, i.e. the aws-lc-rs provider. So a downstream asking foruse-rustls-ring(expecting ring only) ended up with both providers enabled on rustls: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):After:
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 enablinguse-rustls-ring; they would need to enable the aws-lc provider themselves.