From c85aa09f105ec75c8d635db46934fa1e613953ec Mon Sep 17 00:00:00 2001 From: Thomas Avery Date: Tue, 13 Aug 2024 11:55:30 -0500 Subject: [PATCH] test min reproduce --- .../build-test-rustls-platform-verifier.yml | 32 ++++++++ Cargo.lock | 73 +++++++++++++++++++ Cargo.toml | 2 +- test-rustls-platform-verifier/Cargo.toml | 20 +++++ test-rustls-platform-verifier/src/main.rs | 18 +++++ 5 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-test-rustls-platform-verifier.yml create mode 100644 test-rustls-platform-verifier/Cargo.toml create mode 100644 test-rustls-platform-verifier/src/main.rs 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..c4786a1ca --- /dev/null +++ b/.github/workflows/build-test-rustls-platform-verifier.yml @@ -0,0 +1,32 @@ +--- + name: Build Test rustls-platform-verifier + + on: + pull_request: + push: + branches: + - "main" + - "rc" + - "hotfix-rc" + workflow_dispatch: + + defaults: + run: + shell: bash + + jobs: + build-windows: + name: Build Windows + runs-on: windows-2022 + steps: + - name: Checkout repo + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Build + run: cargo build -p test-rustls-platform-verifier --release --target=x86_64-pc-windows-msvc + + - name: Upload artifact + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: test-rustls-platform-verifier + path: ./target/release/test-rustls-platform-verifier.exe diff --git a/Cargo.lock b/Cargo.lock index 1b477a98b..eabdc7a95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -847,6 +847,12 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.0" @@ -1010,6 +1016,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "comfy-table" version = "7.1.1" @@ -2148,6 +2164,26 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "js-sys" version = "0.3.69" @@ -3265,6 +3301,33 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +[[package]] +name = "rustls-platform-verifier" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93bda3f493b9abe5b93b3e7e3ecde0df292f2bd28c0296b90586ee0055ff5123" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-roots", + "winapi", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + [[package]] name = "rustls-webpki" version = "0.102.6" @@ -3403,6 +3466,7 @@ dependencies = [ "core-foundation", "core-foundation-sys", "libc", + "num-bigint", "security-framework-sys", ] @@ -3828,6 +3892,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "test-rustls-platform-verifier" +version = "0.5.0" +dependencies = [ + "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/test-rustls-platform-verifier/Cargo.toml b/test-rustls-platform-verifier/Cargo.toml new file mode 100644 index 000000000..77cbc29c7 --- /dev/null +++ b/test-rustls-platform-verifier/Cargo.toml @@ -0,0 +1,20 @@ +[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 + +[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"] } + +[lints] +workspace = true diff --git a/test-rustls-platform-verifier/src/main.rs b/test-rustls-platform-verifier/src/main.rs new file mode 100644 index 000000000..74ee80db1 --- /dev/null +++ b/test-rustls-platform-verifier/src/main.rs @@ -0,0 +1,18 @@ +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::builder() + .use_preconfigured_tls(rustls_platform_verifier::tls_config()) + .build() + .expect("Build should not fail"); + + let resp = client + .get("https://httpbin.org/ip") + .send() + .await? + .text() + .await?; + + println!("body = {resp:?}"); + + Ok(()) +}