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: wasm compilation errors #122

Closed
wants to merge 4 commits into from
Closed
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
23 changes: 13 additions & 10 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-unknown-unknown
cargo clippy-ci --target wasm32-unknown-unknown

clippy-msrv:
name: Clippy (MSRV)
Expand Down Expand Up @@ -112,7 +111,11 @@ jobs:
rustup target add x86_64-apple-ios
cargo clippy-msrv-ci --target x86_64-apple-ios

# TODO: Consider WASM. See note on "clippy" job.
- name: Clippy (WASM)
if: matrix.os == 'ubuntu-latest'
run: |
rustup target add wasm32-unknown-unknown
cargo clippy-msrv-ci --target wasm32-unknown-unknown

test:
name: Test
Expand Down Expand Up @@ -186,7 +189,7 @@ jobs:
/Users/runner/work/rustls-platform-verifier/rustls-platform-verifier/android/rustls-platform-verifier/build/outputs/androidTest-results/connected/test-result.pb

# TODO: Test iOS in CI too.

test-freebsd:
name: Test (FreeBSD)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -222,7 +225,7 @@ jobs:
components: rustfmt

- run: cargo fmt --all -- --check

android_fmt:
name: Ktlint
runs-on: ubuntu-latest
Expand All @@ -243,7 +246,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Verify release artifact
run: ./ci/verify_android_release.sh

Expand Down
72 changes: 72 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions rustls-platform-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ 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 }
ring = { version = "0.17.7", features = ["wasm32_unknown_unknown_js"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is correct. We just recently removed an issue where this crate unconditionally depended on ring regardless of rustls's set cryptography provider (#102).

May I ask what led to needing to enabling this feature in production builds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @complexspaces ,

My apologies for the late response, I was inactive over the weekend.

If I remember, adding it as a conditional dev-dependency would appease clippy-ci, but not clippy-msrv-ci.

But you're right, it was a very poor choice to promote it to a production dependency 😓


# BSD targets require webpki-roots for the real-world verification tests.
[target.'cfg(target_os = "freebsd")'.dev-dependencies]
Expand Down
8 changes: 1 addition & 7 deletions rustls-platform-verifier/src/verification/others.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,7 @@ 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.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
};

WebPkiServerVerifier::builder_with_provider(
Expand Down
Loading