From 26b8eecde69866943901c64fb6ae63c778b562c0 Mon Sep 17 00:00:00 2001 From: wtclaude Date: Mon, 20 Jul 2026 23:39:12 -0500 Subject: [PATCH] fix(security): declare explicit network security config to forbid cleartext The app is purely an HTTPS API client, but the manifest left usesCleartextTraffic implicit, which SonarQube S5332 flags (cleartext is implicitly permitted on older Android and a merged library manifest could re-enable it). Add an explicit network security config: - main/release: base-config cleartextTrafficPermitted="false" (no cleartext). - debug override (app/src/debug/res/xml): re-permits cleartext to loopback (127.0.0.1/localhost) only, for local dev against http://127.0.0.1:3000. This mirrors ServerUrl's rule (HTTPS required in release, HTTP allowed in debug via allowInsecureHttp = BuildConfig.DEBUG) at the platform socket layer. It also fixes a latent gap: at targetSdk 28+ the platform default already blocks cleartext, so the debug loopback path only actually works with the explicit domain-config now added. Docs updated in RunicGateway/docs (android/PLAN.md M1). Co-Authored-By: Claude --- .../debug/res/xml/network_security_config.xml | 20 +++++++++++++++++++ app/src/main/AndroidManifest.xml | 1 + .../main/res/xml/network_security_config.xml | 16 +++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 app/src/debug/res/xml/network_security_config.xml create mode 100644 app/src/main/res/xml/network_security_config.xml diff --git a/app/src/debug/res/xml/network_security_config.xml b/app/src/debug/res/xml/network_security_config.xml new file mode 100644 index 0000000..c4e12a0 --- /dev/null +++ b/app/src/debug/res/xml/network_security_config.xml @@ -0,0 +1,20 @@ + + + + + + + 127.0.0.1 + localhost + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 27b167e..78778d4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -20,6 +20,7 @@ android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" + android:networkSecurityConfig="@xml/network_security_config" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.RunicGateway"> diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..9aac908 --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,16 @@ + + + + + + -- 2.49.1