diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 6dd683142..0c8799256 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -60,21 +60,13 @@ jobs: - name: Checkout repo uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} + - name: Add Rust target + run: rustup target add ${{ matrix.settings.target }} - name: Build env: TARGET: ${{ matrix.settings.target }} - run: cargo build ${{ matrix.features }} -p bws --release --target=${{ matrix.settings.target }} + run: cargo build -p bws --release --target=${{ matrix.settings.target }} - name: Login to Azure if: ${{ needs.setup.outputs.sign == 'true' }} diff --git a/.github/workflows/build-test-rustls-platform-verifier.yml b/.github/workflows/build-test-rustls-platform-verifier.yml new file mode 100644 index 000000000..ec7a03ca3 --- /dev/null +++ b/.github/workflows/build-test-rustls-platform-verifier.yml @@ -0,0 +1,34 @@ +--- +name: Build test rustls platform verifier + +on: + push: + branches: + - main + - rc + - hotfix-rc + pull_request: + workflow_dispatch: + +defaults: + run: + shell: bash + + + +jobs: + build-windows: + name: Build Windows + runs-on: windows-2022 + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Build + run: cargo build -p test-rustls-platform-verifier --release --target=x86_64-pc-windows-msvc + + - name: Upload artifact + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + with: + name: test-rustls-platform-verifier + path: ./target/x86_64-pc-windows-msvc/release/test-rustls-platform-verifier.exe diff --git a/Cargo.lock b/Cargo.lock index e9ed72fee..4a8233427 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3893,6 +3893,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "test-rustls-platform-verifier" +version = "0.5.0" +dependencies = [ + "env_logger", + "reqwest", + "rustls-platform-verifier", + "tokio", +] + [[package]] name = "textwrap" version = "0.16.1" diff --git a/Cargo.toml b/Cargo.toml index e721d9090..87255eeea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["crates/*"] +members = ["crates/*", "test-rustls-platform-verifier"] # Global settings for all crates should be defined here [workspace.package] diff --git a/crates/bitwarden-core/Cargo.toml b/crates/bitwarden-core/Cargo.toml index 365db9443..dd943b0bc 100644 --- a/crates/bitwarden-core/Cargo.toml +++ b/crates/bitwarden-core/Cargo.toml @@ -72,7 +72,7 @@ zxcvbn = ">=3.0.1, <4.0" reqwest = { version = ">=0.12.5, <0.13", features = [ "rustls-tls-manual-roots", ], default-features = false } -rustls-platform-verifier = "0.3.1" +rustls-platform-verifier = "0.3.3" [target.'cfg(target_os = "android")'.dependencies] # On android, the use of rustls-platform-verifier is more complicated and going through some changes at the moment, so we fall back to using webpki-roots diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml index 6686b5e1e..64ea92414 100644 --- a/crates/bws/Cargo.toml +++ b/crates/bws/Cargo.toml @@ -29,7 +29,7 @@ clap_complete = "4.5.2" color-eyre = "0.6.3" comfy-table = "7.1.1" directories = "5.0.1" -env_logger = "0.11.1" +env_logger = "0.11.5" log = "0.4.20" regex = { version = "1.10.3", features = [ "std", @@ -40,7 +40,7 @@ serde_json = "1.0.113" serde_yaml = "0.9" supports-color = "3.0.0" thiserror = "1.0.57" -tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros"] } +tokio = { version = "1.39.2", features = ["rt-multi-thread", "macros"] } toml = "0.8.10" uuid = { version = "1.7.0", features = ["serde"] } diff --git a/test-rustls-platform-verifier/Cargo.toml b/test-rustls-platform-verifier/Cargo.toml new file mode 100644 index 000000000..daea8117d --- /dev/null +++ b/test-rustls-platform-verifier/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "test-rustls-platform-verifier" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +homepage.workspace = true +repository.workspace = true +license-file.workspace = true +keywords.workspace = true + + +[lints] +workspace = true + +[dependencies] +reqwest = { version = "0.12.5", features = [ + "rustls-tls-manual-roots", +], default-features = false } +rustls-platform-verifier = "0.3.3" +tokio = { version = "1.39.2", features = ["rt-multi-thread", "macros"] } +env_logger = "0.11.5" diff --git a/test-rustls-platform-verifier/src/main.rs b/test-rustls-platform-verifier/src/main.rs new file mode 100644 index 000000000..95664f6e2 --- /dev/null +++ b/test-rustls-platform-verifier/src/main.rs @@ -0,0 +1,19 @@ +#[tokio::main] +async fn main() -> Result<(), Box> { + env_logger::init(); + + let client = reqwest::Client::builder() + .use_preconfigured_tls(rustls_platform_verifier::tls_config()) + .build() + .expect("Build should not fail"); + let request = client.get("https://httpbin.org/ip").build()?; + let response = client.execute(request).await?; + + let status_code = response.status(); + let content = response.text().await?; + + println!("status_code = {status_code:?}"); + println!("content = {content:?}"); + + Ok(()) +}