Fix iOS Certificate Validation Issue for Tendermint Balance Streaming#2674
Fix iOS Certificate Validation Issue for Tendermint Balance Streaming#2674onur-ozkan merged 4 commits intodevfrom
Conversation
|
Using webpki is a bad path for us because we don't update dependencies often, meaning, we will be stuck on the same roots for too long. Does this problem happen witg any RPC nodes, or is it specific to just a few ones? We need to avoid this change if an alternative exists. Worst case, this change should be strictly an iOS build-specific fix. |
Right now it could happen with any tendermint server using modern certs. Though I can downgrade the ones I operate, we cant reasonably expect the same from others. This change brings tendermint into line with existing cert handling for everything else following a similar update in 2021 for the same ios specific issue. |
|
To reduce the scope of potential issues, can you make the webpki change only for IOS platform? |
| .map(|ta| OwnedTrustAnchor::from_subject_spki_name_constraints(ta.subject, ta.spki, ta.name_constraints)), | ||
| .map(|ta| OwnedTrustAnchor::from_subject_spki_name_constraints( | ||
| ta.subject.to_vec(), | ||
| ta.subject_public_key_info.to_vec(), | ||
| ta.name_constraints.as_ref().map(|nc| nc.to_vec()) | ||
| )), |
| winapi.workspace = true | ||
|
|
||
| # iOS-specific dependencies to fix certificate validation issues | ||
| [target.'cfg(target_os = "ios")'.dependencies] |
There was a problem hiding this comment.
since we re adding this as a iOS specific override this means both are active since rustls-tls-native-roots is enabled by the gen dependency. so if we want to differentiate platform wise we d need "per target" sections for diff. between native and webpki.
alternatively (how i tested in a local fix): we just update it to webpki globally cc @onur-ozkan whats preferred / more solid from?
There was a problem hiding this comment.
If we must use webpki for IOS, I suggest doing it for IOS only and keep native roots for others (as we have no issues with it, at least so far?). Relying on OS roots are better than relying on the roots that are bundled with the dependency which will not be updated for a quite long time (we don't update our deps very often).
There was a problem hiding this comment.
thanks - will update this PR accordingly to handle it platform-specific shortly and keep the native everywhere else as there weren't any issues with it (yet)
|
|
|
Waiting for build pipelines to finish for merge. |

🐛 Problem
iOS devices were encountering
Invalid certificate: UnknownIssuererrors when connecting to Tendermint balance streaming WebSocket endpoints. This prevented proper functionality of balance streaming on iOS platforms.Error Details:
Root Cause: The current
tokio-tungstenite-wasmdependency was using an outdated certificate validation mechanism that doesn't recognize the newer Let's Encrypt ECDSA certificate chain (E7 → ISRG Root X1) used by modern servers.🔧 Solution
Updated the TLS certificate validation to use the embedded
webpki-rootscertificate store instead of native system roots, ensuring compatibility with the latest Let's Encrypt ECDSA certificates.📋 Changes Made
1. Updated tokio-tungstenite-wasm TLS Features
Cargo.toml(line 200)rustls-tls-native-roots→rustls-tls-webpki-roots2. Updated Coins Package Dependencies
mm2src/coins/Cargo.toml(line 121)rustls-tls-webpki-roots3. Updated webpki-roots Version
Cargo.toml(line 215)0.25→0.264. Fixed Rustls API Compatibility
mm2src/coins/utxo/rpc_clients/electrum_rpc/tcp_stream.rsspki→subject_public_key_info) and ownership issues5. Fixed mm2_p2p Dependency Configuration
mm2src/coins/Cargo.toml(line 88)applicationfeature tomm2_p2pdependency🧪 Testing
📚 Background
This follows the same pattern as the previous certificate fix (commit 76a34cc) which resolved similar issues with
hyper-rustlsby usingwebpki-tokiofeatures to avoid certificate validation problems on iOS.🎯 Expected Results
After this fix:
🔗 Related Issues
Fixes #2673 -
Invalid certificate: UnknownIssuerwith tendermint balance streaming on iOS📝 Notes
The
mm2_p2pdependency change was not directly related to the certificate fix but was an existing configuration issue exposed during the dependency updates. Theapplicationfeature is required for proper compilation of the coins package withmm2_p2p.Testing Instructions for Reviewers: