`CertificateVerifier.verifyCertificateChain` on Android can cause `NetworkOnMainThreadException`
Nobody has claimed this yet.
- #259 by @FrankenApps — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- mobile-dev, security
Research direction
Start with CertificateVerifier.kt at the linked verifyCertificateChain implementation around line 182, then trace how rustls-platform-verifier-android 0.2.0 invokes it. Reproduce the revocation-check path that raises NetworkOnMainThreadException and inspect how results return to the Rust library. Done means certificate verification no longer performs network work on Android's main thread and still reports its result correctly.
Written by the indexing model from the issue text.
Description
After migrating to 0.2.0 for the rustls-platform-verifier-android dependency in our project and adapting our code to it, we realised sometimes the certification verification failed with some Revoked errors and then after a while it fixed itself.
What we consistently saw in the logs were NetworkOnMainThreadException whenever this happened. It turns out the request was done by Rust in a different thread, but then the verification is done in the main thread. As that code under the hood opens URL connections, the Android system interprets that as a 'no network requests on main thread' rule violation and the revocation checks fail.
Could this verification step can be moved to a coroutine or a different thread and provide the results via a callback to the Rust library to ensure it never runs in the main thread?
- Dominant language
- Rust
- Stars
- 162
- Forks
- 67
- Avg merge
- 5d 14h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rustls/rustls-platform-verifier
-
O-Android
Difficulty 5/5 Over a week Newbie friendliness 12/100
rustls/rustls-platform-verifier#260 · 4 comments ·
-
O-Android
Difficulty 3/5 1-2 days Newbie friendliness 43/100
rustls/rustls-platform-verifier#247 · 4 comments ·
-
Windows: revocation check blocks up to 10s with no effect on verification outcomePossibly taken @djc claimed this 129 days ago. OpenO-Windows
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
rustls/rustls-platform-verifier#230 · 2 comments ·
-
O-Android
Difficulty 3/5 1-2 days Newbie friendliness 45/100
rustls/rustls-platform-verifier#228 · 3 comments ·
All issues in rustls/rustls-platform-verifier
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Eyevinn/open-live-ingest#36 · 1 comment ·
Maintainers usually reply within 1 day
-
app
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug bug jury peripheral:i2s
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
esp-rs/esp-hal#6828 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
ライブラリを追加Openpriority middle
Difficulty 1/5 Under an hour Newbie friendliness 62/100
KATO-Hiro/AtCoderClans#13015 ·
Maintainers usually reply within 1 day