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

fix: explicitly choose aws_lc_rs as the crypto provider #266

Merged
merged 1 commit into from
Sep 19, 2024
Merged
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
3 changes: 3 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions htsget-actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ default = []

[dependencies]
actix-web = { version = "4", features = ["rustls-0_23"] }
rustls = "0.23"
actix-cors = "0.7"
http_1 = { package = "http", version = "1" }
http = "0.2"
Expand Down
3 changes: 3 additions & 0 deletions htsget-actix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ mod tests {
use actix_web::dev::ServiceResponse;
use actix_web::{test, web, App};
use async_trait::async_trait;
use rustls::crypto::aws_lc_rs;
use tempfile::TempDir;

use htsget_axum::server::BindServer;
Expand Down Expand Up @@ -261,6 +262,8 @@ mod tests {

impl ActixTestServer {
fn new_with_tls<P: AsRef<Path>>(path: P) -> Self {
let _ = aws_lc_rs::default_provider().install_default();

Self {
config: config_with_tls(path),
}
Expand Down
8 changes: 7 additions & 1 deletion htsget-actix/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use rustls::crypto::aws_lc_rs;
use std::io;
use tokio::select;
use tracing::debug;

Expand All @@ -7,7 +9,11 @@ use htsget_axum::server::data;
use htsget_config::command;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
async fn main() -> io::Result<()> {
aws_lc_rs::default_provider()
.install_default()
.map_err(|_| io::Error::other("setting crypto provider"))?;

if let Some(path) = Config::parse_args_with_command(command!())? {
let config = Config::from_path(&path)?;

Expand Down
1 change: 1 addition & 0 deletions htsget-axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ default = []
[dependencies]
# Axum server
hyper = { version = "1", features = ["http1", "http2", "server"] }
rustls = "0.23"
hyper-util = "0.1"
tower-http = { version = "0.5", features = ["trace", "cors", "fs"] }
http = "1"
Expand Down
5 changes: 5 additions & 0 deletions htsget-axum/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rustls::crypto::aws_lc_rs;
use std::io;
use tokio::select;
use tracing::debug;
Expand All @@ -8,6 +9,10 @@ use htsget_config::config::Config;

#[tokio::main]
async fn main() -> io::Result<()> {
aws_lc_rs::default_provider()
.install_default()
.map_err(|_| io::Error::other("setting crypto provider"))?;

if let Some(path) =
Config::parse_args_with_command(command!()).expect("expected valid command parsing")
{
Expand Down
5 changes: 5 additions & 0 deletions htsget-axum/src/server/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ mod tests {
use http::header::HeaderName;
use http::{HeaderMap, Method};
use reqwest::{Client, ClientBuilder, RequestBuilder};
use rustls::crypto::aws_lc_rs;
use tempfile::{tempdir, TempDir};
use tokio::fs::{create_dir, File};
use tokio::io::AsyncWriteExt;
Expand Down Expand Up @@ -209,6 +210,8 @@ mod tests {

#[tokio::test]
async fn test_tls_server() {
let _ = aws_lc_rs::default_provider().install_default();

let (_, base_path) = create_local_test_files().await;
let config = config_with_tls(base_path.path()).data_server().clone();
let server_config = config.into_tls().unwrap();
Expand Down Expand Up @@ -261,6 +264,8 @@ mod tests {
}

fn tls_formatter() -> BindServer {
let _ = aws_lc_rs::default_provider().install_default();

let tmp_dir = tempdir().unwrap();
let config = config_with_tls(tmp_dir.path()).data_server().clone();
let server_config = config.into_tls().unwrap();
Expand Down
3 changes: 3 additions & 0 deletions htsget-axum/src/server/ticket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ mod tests {
};
use http::header::HeaderName;
use http::{Method, Request};
use rustls::crypto::aws_lc_rs;
use tempfile::TempDir;
use tower::ServiceExt;

Expand Down Expand Up @@ -208,6 +209,8 @@ mod tests {

impl AxumTestServer {
fn new_with_tls<P: AsRef<Path>>(path: P) -> Self {
let _ = aws_lc_rs::default_provider().install_default();

Self {
config: config_with_tls(path),
}
Expand Down
5 changes: 2 additions & 3 deletions htsget-config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,11 @@ pub(crate) mod tests {
use std::fmt::Display;

use crate::config::parser::from_str;
use figment::Jail;
use http::uri::Authority;

use crate::storage::Storage;
use crate::tls::tests::with_test_certificates;
use crate::types::Scheme::Http;
use figment::Jail;
use http::uri::Authority;

use super::*;

Expand Down
3 changes: 3 additions & 0 deletions htsget-config/src/tls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ pub(crate) mod tests {
use std::path::Path;

use rcgen::generate_simple_self_signed;
use rustls::crypto::aws_lc_rs;
use rustls_pemfile::{certs, pkcs8_private_keys};
use tempfile::TempDir;

Expand Down Expand Up @@ -245,6 +246,8 @@ pub(crate) mod tests {
where
F: FnOnce(&Path, PrivateKeyDer<'static>, CertificateDer<'static>),
{
let _ = aws_lc_rs::default_provider().install_default();

let tmp_dir = TempDir::new().unwrap();

let key_path = tmp_dir.path().join("key.pem");
Expand Down
1 change: 1 addition & 0 deletions htsget-lambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ default = []
[dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tower-http = { version = "0.5", features = ["cors"] }
rustls = "0.23"
lambda_http = { version = "0.13" }
lambda_runtime = { version = "0.13" }
serde = { version = "1" }
Expand Down
9 changes: 7 additions & 2 deletions htsget-lambda/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
use std::env::set_var;

use htsget_axum::server::ticket::TicketServer;
use htsget_config::command;
use htsget_config::config::Config;
use lambda_http::{run, Error};
use rustls::crypto::aws_lc_rs;
use std::env::set_var;
use std::io;
use tracing::debug;

#[tokio::main]
async fn main() -> Result<(), Error> {
aws_lc_rs::default_provider()
.install_default()
.map_err(|_| io::Error::other("setting crypto provider"))?;

// Ignore the API gateway stage.
// See https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-http#integration-with-api-gateway-stages
set_var("AWS_LAMBDA_HTTP_IGNORE_STAGE_IN_PATH", "true");
Expand Down
Loading