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 and defend wasm code using wasi platform #136

Merged
merged 1 commit into from
Sep 1, 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
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