Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deps]: Update Rust crate rustls-platform-verifier to 0.4.0 #58

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/bitwarden-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ bitwarden-error = { workspace = true }
# By default, we use rustls as the TLS stack and rust-platform-verifier to support user-installed root certificates
# The only exception is WASM, as it just uses the browsers/node fetch
reqwest = { workspace = true, features = ["rustls-tls-manual-roots"] }
rustls-platform-verifier = "0.3.4"
rustls = { version = "0.23.19", default-features = false }
rustls-platform-verifier = "0.4.0"

[dev-dependencies]
bitwarden-crypto = { workspace = true }
Expand Down
25 changes: 3 additions & 22 deletions crates/bitwarden-core/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ impl Client {

#[cfg(not(target_arch = "wasm32"))]
{
use rustls::ClientConfig;
use rustls_platform_verifier::ConfigVerifierExt;
client_builder =
client_builder.use_preconfigured_tls(rustls_platform_verifier::tls_config());
client_builder.use_preconfigured_tls(ClientConfig::with_platform_verifier());
}

client_builder
Expand Down Expand Up @@ -83,24 +85,3 @@ impl Client {
}
}
}

#[cfg(test)]
mod tests {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn test_reqwest_rustls_platform_verifier_are_compatible() {
// rustls-platform-verifier is generating a rustls::ClientConfig,
// which reqwest accepts as a &dyn Any and then downcasts it to a
// rustls::ClientConfig.

// This means that if the rustls version of the two crates don't match,
// the downcast will fail and we will get a runtime error.

// This tests is added to ensure that it doesn't happen.

let _ = reqwest::ClientBuilder::new()
.use_preconfigured_tls(rustls_platform_verifier::tls_config())
.build()
.unwrap();
}
}
2 changes: 1 addition & 1 deletion crates/bitwarden-uniffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ android_logger = "0.14"
# The use of rustls-platform-verifier requires some extra support to communicate with the Android platform
jni = ">=0.19, <0.20"
libloading = ">=0.8.1, <0.9"
rustls-platform-verifier = "0.3.4"
rustls-platform-verifier = "0.4.0"

[target.'cfg(target_os = "ios")'.dependencies]
oslog = "0.2.0"
Expand Down
Loading