flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.27k stars 27.51k forks source link

VideoPlayer doesn't accept self signed SSL certificates on HTTPS URLs on Android #75995

Open dantheman213 opened 3 years ago

dantheman213 commented 3 years ago

Steps to Reproduce

  1. Use VideoPlayer to load a HTTPS media asset that has a self signed certificate.

Expected results:

  1. https://localhost:8080/my/test/playlist.m3u8 would work in VideoPlayer

Actual results:

  1. https://localhost:8080/my/test/playlist.m3u8 causes exception because it is self signed.
PlatformException: Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error
dantheman213 commented 3 years ago

Stuff that's been tried:

  1. HTTP insecure .m3u8 and .mp4 assets work fine in Flutter app
  2. HTTPS assets tested with a CA signed (e.g. Let's Encrypt, Verisign, etc) HTTPS certificate work fine in Flutter app
  3. HTTPS assets that are using self-signed SSL works in VLC player and browsers but not in Flutter VideoPlayer widget.
darshankawar commented 3 years ago

@dantheman213 Can you provide flutter doctor -v ? Are you on Android or iOS ?

dantheman213 commented 3 years ago

Hi @darshankawar, thanks for reviewing. The error that I am currently receiving is when I'm testing in Android emulator or on a real device. Here's the error again for visibility:

PlatformException: Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error

This is an Android error with the underlying Flutter VideoPlayer's native asset. Looks like ExoPlayer is being used for Android. I imagine iOS will have the same problem as it's typical for default HTTPS to give off a warning or have its default config to reject self signed certificates.

Here is a summary from flutter doctor -v.

> flutter doctor -v

[✓] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
    • Flutter version 1.22.6 at D:\flutter
    • Framework revision 9b2d32b605 (3 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\danie\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[✓] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[✓] VS Code (version 1.53.2)
    • VS Code at C:\Users\danie\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.16.0

[✓] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.150
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 88.0.705.63

• No issues found!

I'm guessing the following files (along with the iOS counterpart) need to updated to have an option so you can configure the player to accept self signed certificates.

VideoPlayerPlugin.java

CustomSSLSocketFactory.java

To see the issue for yourself, just take the sample code and use any self signed HTTPS asset instead of the HTTP asset provided in example.

https://github.com/flutter/plugins/tree/master/packages/video_player/video_player#example

darshankawar commented 3 years ago

Thanks @dantheman213 for the details. I am able to replicate the issue which seems to occur on Android. iOS plays the video properly.

  1. Android:
Screenshot 2021-02-16 at 11 55 43 AM
Launching lib/main.dart on SM A260G in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Debug service listening on ws://127.0.0.1:52228/CsgS6FaEwDI=/ws
Syncing files to device SM A260G...
I/ExoPlayerImpl(11022): Init 1cfa707 [ExoPlayerLib/2.12.1] [a2corelte, SM-A260G, samsung, 27]
E/ExoPlayerImplInternal(11022): Playback error
E/ExoPlayerImplInternal(11022):   UnknownHostException (no network)
E/flutter (11022): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null)
E/flutter (11022): 
  1. iOS:
Screenshot 2021-02-16 at 11 53 11 AM

Recent related but closed issues:

https://github.com/flutter/flutter/issues/68094 https://github.com/flutter/flutter/issues/72696

flutter doctor -v ``` [✓] Flutter (Channel master, 1.27.0-2.0.pre.102, on Mac OS X 10.15.4 19E2269 darwin-x64, locale en-IN) • Flutter version 1.27.0-2.0.pre.102 at /Users/dhs/documents/Fluttersdk/flutter • Framework revision b2e05062b6 (22 hours ago), 2021-02-15 03:56:03 -0500 • Engine revision 1d537824d6 • Dart version 2.13.0 (build 2.13.0-30.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0) • Android SDK at /Users/dhs/Library/Android/sdk • Platform android-30, build-tools 30.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [!] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.3, Build version 12C33 ! CocoaPods 1.9.3 out of date (1.10.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.53.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.18.1 [✓] Connected device (4 available) • SM A260G (mobile) • 5200763ebcfa861f • android-arm • Android 8.1.0 (API 27) • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.150 ! Doctor found issues in 1 category. ```
dantheman213 commented 3 years ago

Thanks for the quick reply and your review @darshankawar.

Also, if iOS player works with no issues that may not be the ideal solution either. Self signed certificates SHOULD throw a warning but you should be able to configure the player to ignore it. Self signed SSL is more secure than HTTP but depending on how its deployed it has its own security issues as well. It should be up to the developer if they want to support self signed SSL certificates or not in their Flutter app.

Hmm, double checking myself I see in your screenshot you're using this URL:

https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4

This URL is using a VALID signed SSL certificate. Please see here:

Capture

When I check in Chrome tools I see this error:

GET https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4 net::ERR_CONNECTION_TIMED_OUT

Something else going on with this asset. You might want to try spinning up your own local nginx with a self signed SSL and some sample mp4 to test this out yourself.

What would be the next step? Any ballpark ETA for resolution available?

hamdikahloun commented 3 years ago

CustomSSLSocketFactory.java used only for enable TLSv1.1 & TLSv1.2 for API 19 and below.

For more information about security SSL: UnknownCa & SelfSigned

Caution: Many web sites describe a poor alternative solution which is to install a TrustManager that does nothing. If you do this you might as well not be encrypting your communication, because anyone can attack your users at a public Wi-Fi hotspot by using DNS tricks to send your users' traffic through a proxy of their own that pretends to be your server. The attacker can then record passwords and other personal data. This works because the attacker can generate a certificate and—without a TrustManager that actually validates that the certificate comes from a trusted source—your app could be talking to anyone. So don't do this, not even temporarily. You can always make your app trust the issuer of the server's certificate, so just do it.

dheerajbred commented 3 years ago

Same issue here also. Trying to play https://www04.cloud9xx.com/videos/hls/PPiRAsdEQIc0l0gNOAkZCA/1613693393/137943/0d2d81bdc13b93efd22f3583a4b9c0f0/ep.37.1604050682.360.m3u8

dantheman213 commented 3 years ago

Any idea when this issue would be resolved?

pratikbaid3 commented 3 years ago

I am getting the same issue. Any solution yet?

patthipati commented 3 years ago

hi @pratikbaid3 I also have the same issue, we resolved it by getting the proper CA Certificate and doing some Network security configuration in android folder, please check below link for Network security configuration https://developer.android.com/training/articles/security-config#CustomTrust

dantheman213 commented 3 years ago

The VideoPlayer widget should support self signed SSL. There's plenty of use cases for not having a CA signed certificate.

pratikbaid3 commented 3 years ago

@patthipati Thank you for the help so far, but wouldn't this mean that for each URL that we access, there would have to be a manual CA Certificate and Network Config?

francochau commented 3 years ago

Same error, couldn't play any video from network @darshankawar will there be any fix or way to workaround?

ronytesler commented 3 years ago

Any other package to play videos?

dantheman213 commented 3 years ago

Nope, but it'd be great if the maintainers of this repo would fix this issue. hard to consider this a mature video plugin if it can't accept videos from self signed HTTPS URLs.

dantheman213 commented 3 years ago

Hi Flutter team, any idea when this issue will be resolved? It's an issue on both iOS and Android and there's been no activity on this ticket for months now. Thanks.

dantheman213 commented 3 years ago

Created a PR to help deal with this issue. iOS still needs to be implemented and there may be some minor things required. Maintainers, what's the next step to get this PR moved into master?

SalahAdDin commented 3 years ago

I am having the same problem.

stcojo commented 2 years ago

Issue persists. Any ETA?

uropsm commented 2 years ago

Is there any workaround? any other package?

huycozy commented 2 years ago

Hi, I can reproduce this issue with my own self-signed certificates on the latest stable and master channel.

Tested environments: - Android Emulator (Pixel 4 API 30) - iOS Emulator (iPhone 13, iOS 15.2) - Local NodeJS server with self-signed certificate (TLS 1.3)
Sample code Official sample from: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player#example with your own https media file urls that have self-signed certificate. For eg: - Android: https://10.0.2.2:8080/files/Butterfly-209.mp4 - iOS: https://127.0.0.1:8080/files/Butterfly-209.mp4 - **Note**: For Android: Add this line into `network_security_config.xml`: ```xml 10.0.2.2 ```
Exception log: - Android: ```bash I/TetheringManager(18295): registerTetheringEventCallback:io.flutter.plugins.videoplayerexample E/ExoPlayerImplInternal(18295): Playback error E/ExoPlayerImplInternal(18295): com.google.android.exoplayer2.ExoPlaybackException: Source error E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:640) E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:612) E/ExoPlayerImplInternal(18295): at android.os.Handler.dispatchMessage(Handler.java:102) E/ExoPlayerImplInternal(18295): at android.os.Looper.loop(Looper.java:223) E/ExoPlayerImplInternal(18295): at android.os.HandlerThread.run(HandlerThread.java:67) E/ExoPlayerImplInternal(18295): Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:365) E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84) E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1009) E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412) E/ExoPlayerImplInternal(18295): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/ExoPlayerImplInternal(18295): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/ExoPlayerImplInternal(18295): at java.lang.Thread.run(Thread.java:923) E/ExoPlayerImplInternal(18295): Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:362) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.convertException(ConscryptEngine.java:1134) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1089) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:876) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:747) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:712) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:849) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.access$100(ConscryptEngineSocket.java:722) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngineSocket.doHandshake(ConscryptEngineSocket.java:238) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngineSocket.startHandshake(ConscryptEngineSocket.java:217) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:196) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:153) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:90) E/ExoPlayerImplInternal(18295): at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:30) E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:636) E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:533) E/ExoPlayerImplInternal(18295): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:359) E/ExoPlayerImplInternal(18295): ... 6 more E/ExoPlayerImplInternal(18295): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.TrustManagerImpl.verifyChain(TrustManagerImpl.java:677) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:554) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:510) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:428) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:356) E/ExoPlayerImplInternal(18295): at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94) E/ExoPlayerImplInternal(18295): at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:90) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngineSocket$2.checkServerTrusted(ConscryptEngineSocket.java:161) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:250) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.verifyCertificateChain(ConscryptEngine.java:1644) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.NativeCrypto.ENGINE_SSL_read_direct(Native Method) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.NativeSsl.readDirectByteBuffer(NativeSsl.java:568) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.readPlaintextDataDirect(ConscryptEngine.java:1095) E/ExoPlayerImplInternal(18295): at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1079) E/ExoPlayerImplInternal(18295): ... 28 more E/ExoPlayerImplInternal(18295): Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. E/ExoPlayerImplInternal(18295): ... 42 more E/flutter (18295): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null) E/flutter (18295): ``` - iOS: ```bash [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(VideoError, Failed to load video: Could not connect to the server., null, null) ```
Demo - Android: https://user-images.githubusercontent.com/104349824/166424746-06e7d62d-eee8-46e7-9503-cf13383f1e38.mp4 - iOS: https://user-images.githubusercontent.com/104349824/166425237-078b4f89-95a5-4d02-8f95-25115eb369d7.mp4
Build a local server with self-signed certificate: https://github.com/huycozy/local-server-self-signed-nodejs
flutter doctor -v ```bash [✓] Flutter (Channel stable, 2.10.5, on macOS 12.2.1 21D62 darwin-x64, locale en-VN) • Flutter version 2.10.5 at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5464c5bac7 (2 weeks ago), 2022-04-18 09:55:37 -0700 • Engine revision 57d3bac3dd • Dart version 2.16.2 • DevTools version 2.9.2 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) [✓] Android Studio (version 4.1) • Android Studio at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [✓] Android Studio • Android Studio at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-1/203.7185775/Android Studio Preview.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) [✓] IntelliJ IDEA Community Edition (version 2020.3.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code (version 1.62.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.28.0 [✓] Connected device (1 available) • Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ``` ```bash [✓] Flutter (Channel master, 2.13.0-0.0.pre.866, on macOS 12.2.1 21D62 darwin-x64, locale en-VN) • Flutter version 2.13.0-0.0.pre.866 at /Users/huynq/Documents/GitHub/flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 6246a09d0e (42 minutes ago), 2022-05-03 00:04:07 -0400 • Engine revision a00140cb28 • Dart version 2.18.0 (build 2.18.0-78.0.dev) • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) [✓] Android Studio (version 4.1) • Android Studio at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [!] Android Studio • Android Studio at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-1/203.7185775/Android Studio Preview.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio. [✓] IntelliJ IDEA Community Edition (version 2020.3.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code (version 1.62.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.28.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 12.2.1 21D62 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. ```
Gradergage commented 7 months ago

Any progress in this issue?

SalahAdDin commented 7 months ago

Up!

fuz12 commented 4 weeks ago

I still have this problem on ios. I tried using NSAppTransportSecurity in ios (https://developer.apple.com/news/?id=g9ejcf8y) similar to network-security-config in android (https://developer.android.com/privacy-and-security/security-config#TrustingAdditionalCas), but it didn't work. Is it possible to find a similar solution for ios which @patthipati suggested for android? Or can we set certificates in the ios native for all app and packages? In flutter, this can be achieved as follows:

final certificates = await rootBundle.load('public/assets/openssl/certificate.crt');
HttpOverrides.global = _AppHttpOverrides(certificates);

class _AppHttpOverrides extends HttpOverrides {
  _AppHttpOverrides(this.certificates);

  ByteData certificates;

  @OverRide
  HttpClient createHttpClient(SecurityContext? context) {
    final securityContext = SecurityContext();
    securityContext.setTrustedCertificatesBytes(certificates.buffer.asUint8List());

    return super.createHttpClient(securityContext);
  }
}