Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Require TLS in mobile app release builds (#1495)

Leendert de Borst83aaafd7d7a5
diff --git a/apps/mobile-app/android/app/build.gradle b/apps/mobile-app/android/app/build.gradle
index 561b96802..c7468c360 100644
--- a/apps/mobile-app/android/app/build.gradle
+++ b/apps/mobile-app/android/app/build.gradle
@@ -116,12 +116,15 @@ android {
buildTypes {
debug {
signingConfig signingConfigs.debug
+ // Debug builds may reach a local dev API over http://; release builds require TLS.
+ manifestPlaceholders = [networkSecurityConfig: "network_security_config_debug"]
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
+ manifestPlaceholders = [networkSecurityConfig: "network_security_config"]
shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
diff --git a/apps/mobile-app/android/app/src/main/AndroidManifest.xml b/apps/mobile-app/android/app/src/main/AndroidManifest.xml
index 133dff472..d35a7f7cc 100644
--- a/apps/mobile-app/android/app/src/main/AndroidManifest.xml
+++ b/apps/mobile-app/android/app/src/main/AndroidManifest.xml
@@ -12,7 +12,7 @@
<data android:scheme="https"/>
</intent>
</queries>
- <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:fullBackupContent="false" android:dataExtractionRules="@xml/data_extraction_rules" android:theme="@style/AppTheme" android:supportsRtl="true" android:usesCleartextTraffic="true" android:localeConfig="@xml/locales_config" android:networkSecurityConfig="@xml/network_security_config">
+ <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:fullBackupContent="false" android:dataExtractionRules="@xml/data_extraction_rules" android:theme="@style/AppTheme" android:supportsRtl="true" android:localeConfig="@xml/locales_config" android:networkSecurityConfig="@xml/${networkSecurityConfig}">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
diff --git a/apps/mobile-app/android/app/src/main/res/xml/network_security_config.xml b/apps/mobile-app/android/app/src/main/res/xml/network_security_config.xml
index aa41ac819..13fd77b7e 100644
--- a/apps/mobile-app/android/app/src/main/res/xml/network_security_config.xml
+++ b/apps/mobile-app/android/app/src/main/res/xml/network_security_config.xml
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
-<network-security-config>
- <base-config cleartextTrafficPermitted="true">
+<!-- Release builds require TLS; user-installed CAs are trusted so self-hosted servers with a private CA work. Debug builds use network_security_config_debug.xml (selected in build.gradle). -->
+<network-security-config xmlns:tools="http://schemas.android.com/tools">
+ <base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system"/>
- <certificates src="user"/> <!-- opt-in to user-installed CAs -->
+ <certificates src="user" tools:ignore="AcceptsUserCertificates"/>
</trust-anchors>
</base-config>
</network-security-config>
diff --git a/apps/mobile-app/android/app/src/main/res/xml/network_security_config_debug.xml b/apps/mobile-app/android/app/src/main/res/xml/network_security_config_debug.xml
new file mode 100644
index 000000000..686be1081
--- /dev/null
+++ b/apps/mobile-app/android/app/src/main/res/xml/network_security_config_debug.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Debug builds only (selected in build.gradle): same as network_security_config.xml plus http:// to a local dev API. -->
+<network-security-config>
+ <base-config cleartextTrafficPermitted="true">
+ <trust-anchors>
+ <certificates src="system"/>
+ <certificates src="user"/>
+ </trust-anchors>
+ </base-config>
+</network-security-config>
diff --git a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
index 9cf91ed45..52ef4affe 100644
--- a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
+++ b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
@@ -699,6 +699,7 @@
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
+ CE3AE6012F1E0A0100E7745E /* Allow local networking in Debug */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
CEE9098C2DA548C7008D568F /* Embed Foundation Extensions */,
CEE480A12DBE86DD00F4A367 /* Embed Frameworks */,
@@ -860,6 +861,7 @@
CEE9097A2DA548C7008D568F /* Sources */,
CEE9097B2DA548C7008D568F /* Frameworks */,
CEE9097C2DA548C7008D568F /* Resources */,
+ CE3AE6022F1E0A0100E7745E /* Allow local networking in Debug */,
CEE480B02DBE88AB00F4A367 /* Embed Frameworks */,
CE3AE50F2DC7FB5500E7745E /* ShellScript */,
);
@@ -1030,6 +1032,44 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ CE3AE6012F1E0A0100E7745E /* Allow local networking in Debug */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ name = "Allow local networking in Debug";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Debug builds may reach a local dev API over http://; release builds require TLS.\nif [ \"${CONFIGURATION}\" = \"Debug\" ]; then\n /usr/libexec/PlistBuddy -c \"Set :NSAppTransportSecurity:NSAllowsLocalNetworking true\" \"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\nfi\n";
+ };
+ CE3AE6022F1E0A0100E7745E /* Allow local networking in Debug */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ name = "Allow local networking in Debug";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Debug builds may reach a local dev API over http://; release builds require TLS.\nif [ \"${CONFIGURATION}\" = \"Debug\" ]; then\n /usr/libexec/PlistBuddy -c \"Set :NSAppTransportSecurity:NSAllowsLocalNetworking true\" \"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\nfi\n";
+ };
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
diff --git a/apps/mobile-app/ios/AliasVault/Info.plist b/apps/mobile-app/ios/AliasVault/Info.plist
index 4cdae7866..6e13137d0 100644
--- a/apps/mobile-app/ios/AliasVault/Info.plist
+++ b/apps/mobile-app/ios/AliasVault/Info.plist
@@ -88,7 +88,7 @@
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSAllowsLocalNetworking</key>
- <true/>
+ <false/>
</dict>
<key>NSCameraUsageDescription</key>
<string>AliasVault supports scanning QR codes for logging into your vault on web or desktop without re-entering your master password.</string>
diff --git a/apps/mobile-app/ios/Autofill/Info.plist b/apps/mobile-app/ios/Autofill/Info.plist
index cacc1cdc0..bd6d38938 100644
--- a/apps/mobile-app/ios/Autofill/Info.plist
+++ b/apps/mobile-app/ios/Autofill/Info.plist
@@ -25,6 +25,13 @@
<string>uk</string>
<string>zh</string>
</array>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <false/>
+ <key>NSAllowsLocalNetworking</key>
+ <false/>
+ </dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>