datatheorem / datatheorem/TrustKit-Android
TrustKit throws IllegalArgumentException
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 604
- Forks
- 90
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 2
Description
Hello!
Describe the bug
I'm seeing one crash in Google play console:
java.lang.IllegalArgumentException:
at com.datatheorem.android.trustkit.config.TrustKitConfiguration.getPolicyForHostname (TrustKitConfiguration.java:90)
at com.datatheorem.android.trustkit.pinning.TrustManagerBuilder.getTrustManager (TrustManagerBuilder.java:67)
at com.datatheorem.android.trustkit.TrustKit.getTrustManager (TrustKit.java:390)
To Reproduce
Unfortunately I cannot reproduce it. It happens to just two users.
I just enabled certificate pinning for one default server (and user can use their own server for which pining is not enabled).
It looks like server url is not valid, but I validate server url with:
https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/HttpUrl.java#L903
before creating http client:
okhttp3.OkHttpClient.Builder httpClient = new okhttp3.OkHttpClient.Builder();
X509TrustManager[] trustManagers = { TrustKit.getInstance().getTrustManager(backendUrl) };
so I'm confused why TrustKit throws exception.
Expected behavior
App would not crash.
Or please, let me know how should I handle this exception?
TrustKit configuration
<domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="true">*******.***</domain>
<pin-set>
<pin digest="SHA-256">********************************************</pin>
<pin digest="SHA-256">********************************************</pin>
</pin-set>
<trustkit-config enforcePinning="true" disableDefaultReportUri="true">
</trustkit-config>
</domain-config>
App details:
- App target SDK: 28
- App language: Java
- Android version to reproduce the bug: 7.1 and 8
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Start with TrustKitConfiguration.java around line 90 and trace the call from TrustManagerBuilder.java:67 through TrustKit.java:390. Compare the value passed from backendUrl with the HttpUrl validation described in the report; the work is complete when the crash path has a defined non-crashing behavior or a clear handling recommendation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100