LedgerHQ / ledger-live-mobile

⛔️ DEPRECATED - Ledger Live (Mobile)
https://ledger.com/live
Apache License 2.0
381 stars 116 forks source link

Android - Allow cleartext communication by default in debug builds #2380

Closed ofreyssinet-ledger closed 2 years ago

ofreyssinet-ledger commented 2 years ago

TL;DR: build configuration to allow all cleartext HTTP traffic in Android debug builds, allowing devs to easily debug the app running on an emulator with a real nano (using the proxy), and allowing an easy wireless debugging experience.

On Android we need to whitelist IP adresses for which we want to allow cleartext HTTP (and not HTTPS) traffic. This happens in a network_security_config.xml resource file.

There are several issues with that for developer experience:

In both cases, the dev has to input an IP address manually in the configuration, rebuild the android app (first pain point), and also make sure to not push these changes to the security config (second pain point).

The solution here is to simply add a network_security_config.xml specific to debug builds (debug buildType) and that configuration will by default allow any cleartext HTTP traffic.

⚠️ One small downside of this solution: the debug environment will not reflect how the prod app behaves with HTTP traffic ... (it will not work by default in prod)

@grsoares21 you might be interested

Type

DX improvement

Context

Parts of the app affected / Test plan

github-actions[bot] commented 2 years ago

Thanks for your contribution. To be able to merge in develop branch, you need to: