From 83b6c7d42f20155b62eb85a961aaac8d196db68b Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 8 Oct 2024 13:42:15 -0400 Subject: [PATCH] agent: setup rustls CryptoProvider Fixes a crash in `agent` due to missing a `CryptoProvider` for `rustls` TLS connections. --- Cargo.lock | 1 + crates/agent/Cargo.toml | 1 + crates/agent/src/main.rs | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 4c3ba7426e..d12a19badc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -134,6 +134,7 @@ dependencies = [ "regex", "reqwest", "runtime", + "rustls 0.23.10", "schemars", "serde", "serde_json", diff --git a/crates/agent/Cargo.toml b/crates/agent/Cargo.toml index 3776cd6ec8..dd7e7ec103 100644 --- a/crates/agent/Cargo.toml +++ b/crates/agent/Cargo.toml @@ -49,6 +49,7 @@ lazy_static = { workspace = true } rand = { workspace = true } regex = { workspace = true } reqwest = { workspace = true } +rustls = { workspace = true } schemars = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/agent/src/main.rs b/crates/agent/src/main.rs index 874b5bb521..cfe59e4cff 100644 --- a/crates/agent/src/main.rs +++ b/crates/agent/src/main.rs @@ -51,6 +51,12 @@ struct Args { } fn main() -> Result<(), anyhow::Error> { + // Required in order for libraries to use `rustls` for TLS. + // See: https://docs.rs/rustls/latest/rustls/crypto/struct.CryptoProvider.html + rustls::crypto::aws_lc_rs::default_provider() + .install_default() + .expect("failed to install default crypto provider"); + // Use reasonable defaults for printing structured logs to stderr. let subscriber = tracing_subscriber::FmtSubscriber::builder() .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())