Skip to content

fix(sdk): use bundled webpki roots for ICANN TLS instead of platform verifier - #430

Open
jvsena42 wants to merge 3 commits into
pubky:mainfrom
jvsena42:fix/icann-webpki-roots
Open

fix(sdk): use bundled webpki roots for ICANN TLS instead of platform verifier#430
jvsena42 wants to merge 3 commits into
pubky:mainfrom
jvsena42:fix/icann-webpki-roots

Conversation

@jvsena42

Copy link
Copy Markdown

Problem

PubkyHttpClient builds its icann_http client with reqwest::Client::builder() and no explicit TLS config, so reqwest defaults to rustls-platform-verifier. On targets where that verifier isn't initialized — notably Android and iOS without the native verifier component — the first standard-TLS request panics:

panicked at rustls-platform-verifier-0.7.0/src/android.rs:90:
Expect rustls-platform-verifier to be initialized

Because the panic happens inside the background auth-relay polling task, the task is torn down, its channel sender drops, and the awaiting caller receives AuthError::RequestExpired. The visible symptom: Pubky Ring sign-in never completes on mobile — Ring approves successfully, but the requesting app errors out ~500 ms after start_auth_flow with "the provided auth request has expired or was cancelled", before approval even happens.

This was diagnosed end-to-end against a real device/emulator: Ring reaches the relay (it uses the OS HTTP stack), but the SDK's icann_http request to httprelay.pubky.app panics in the platform verifier.

Fix

Build icann_http with bundled webpki roots and an explicit ring CryptoProvider, via use_preconfigured_tls. This:

  • works on every platform with no native verifier component and no process-default crypto provider (which is itself ambiguous when both ring and aws-lc-rs are in the tree);
  • only affects ICANN-host TLS — pubky-host TLS still goes through pkarr's RawPublicKey verifier (ClientBuilder::from(pkarr)), unchanged.

Adds rustls (ring) and webpki-roots to the non-wasm deps.

Test

  • Builds clean; the SDK compiles into a UniFFI Android library.
  • Verified on an Android emulator: with this change, httprelay.pubky.app TLS succeeds, the relay poller stays alive, and a full Pubky Ring sign-in completes (token decrypted → session exchange → hydrated session). Without it, the verifier panic reproduces 100%.

🤖 Generated with Claude Code

andrei-21 and others added 3 commits May 27, 2026 13:16
…verifier

The icann_http client was built with reqwest's default rustls config, which uses
rustls-platform-verifier. On targets where the verifier isn't initialized (e.g.
Android/iOS without the native component) the first standard-TLS request panics
('Expect rustls-platform-verifier to be initialized'), killing background tasks —
the auth-relay poller dies and surfaces as RequestExpired, so Pubky Ring sign-in
can never complete on mobile.

Pin bundled webpki roots with an explicit ring CryptoProvider for the ICANN client
(pubky-host TLS via pkarr's RawPublicKey verifier is unchanged). Works on every
platform with no native verifier component or process-default provider.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jvsena42 added a commit to jvsena42/pubky-core-ffi-fork that referenced this pull request Jun 13, 2026
…ANN TLS

- route the pubky SDK's tracing events to Android logcat (init_logging +
  paranoid-android) so relay/TLS failures are diagnosable; install a panic hook
  that logs to the same sink (Rust panics otherwise vanish on Android)
- install a process-wide ring CryptoProvider (defensive: both ring and aws-lc-rs
  are in the tree)
- [patch.crates-io] pubky -> local pubky-core (fix/icann-webpki-roots) so the
  ICANN-TLS platform-verifier panic fix is in effect until it lands upstream
  (pubky/pubky-homeserver#430). Drop the patch once pubky 0.9.2 is released.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants