diefferson / http_certificate_pinning

Https Certificate pinning for Flutter
Apache License 2.0
84 stars 71 forks source link

Android exception when headerHttp parameter is omitted from HttpCertificatePinning.check() #14

Closed guymclean closed 2 years ago

guymclean commented 3 years ago

It is perhaps worth making headerHttp a required field or fixing this issue. Error logs below.

E/AndroidRuntime(11163): kotlin.TypeCastException: null cannot be cast to non-null type kotlin.collections.Map<kotlin.String, kotlin.String>
E/AndroidRuntime(11163):    at diefferson.http_certificate_pinning.HttpCertificatePinningPlugin.handleCheckEvent(HttpCertificatePinningPlugin.kt:73)
E/AndroidRuntime(11163):    at diefferson.http_certificate_pinning.HttpCertificatePinningPlugin.access$handleCheckEvent(HttpCertificatePinningPlugin.kt:28)
E/AndroidRuntime(11163):    at diefferson.http_certificate_pinning.HttpCertificatePinningPlugin$onMethodCall$1.run(HttpCertificatePinningPlugin.kt:56)
E/AndroidRuntime(11163):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(11163):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(11163):    at java.lang.Thread.run(Thread.java:923)
thiepwong commented 2 years ago

Hi! I need to pinning the ssl to my app and I use HttpCertificatePinning.check() method to check certificate, I tested it with a proxy, the result always returns CONNECTION_SECURE, other apps, or websites cannot be access but my app. Can somebody help me? Thank so much!

diefferson commented 2 years ago

Issue resolved in version 2.0.3 @guymclean

diefferson commented 2 years ago

@thiepwong Just a proxy in the middle not result in an insecure validation, you need to force another certificate int the proxy to try decrypt te body of https messages.