Skip to content

Commit

Permalink
Fix and defend wasm code using wasi platform
Browse files Browse the repository at this point in the history
  • Loading branch information
ctz authored and complexspaces committed Sep 1, 2024
1 parent 8080972 commit 4c758e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ jobs:
rustup target add x86_64-apple-ios
cargo clippy-ci --target x86_64-apple-ios
# TODO: Should WASM be checked in CI? If so, with what tooling?
# - name: Clippy (WASM)
# if: matrix.os == 'ubuntu-latest'
# run: |
# rustup target add wasm32-unknown-unknown
# cargo clippy-ci --target wasm32-unknown-unknown
- name: Clippy (WASM)
if: matrix.os == 'ubuntu-latest'
run: |
rustup target add wasm32-wasip1
cargo clippy-ci --target wasm32-wasip1
clippy-msrv:
name: Clippy (MSRV)
Expand Down
1 change: 1 addition & 0 deletions rustls-platform-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ android_logger = { version = "0.13", optional = true } # Only used during testin

[target.'cfg(target_arch = "wasm32")'.dependencies]
webpki-roots = "0.26"
webpki = { package = "rustls-webpki", version = "0.102", default-features = false }

# BSD targets require webpki-roots for the real-world verification tests.
[target.'cfg(target_os = "freebsd")'.dev-dependencies]
Expand Down
10 changes: 3 additions & 7 deletions rustls-platform-verifier/src/verification/others.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,9 @@ impl Verifier {

#[cfg(target_arch = "wasm32")]
{
root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|root| {
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
root.subject,
root.spki,
root.name_constraints,
)
}));
root_store
.roots
.extend_from_slice(webpki_roots::TLS_SERVER_ROOTS);
};

WebPkiServerVerifier::builder_with_provider(
Expand Down

0 comments on commit 4c758e1

Please sign in to comment.