From d857702d70a80c3168ae164c7261701703b77c20 Mon Sep 17 00:00:00 2001 From: Kotha Dhakshin <179742818+Dhakshin2007@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:24:53 +0530 Subject: [PATCH 01/12] security: disable allowBackup and add explicit exported flags - Set android:allowBackup="false" to prevent sensitive user data (Firebase auth tokens, survey responses, GPS data) from being extracted via adb backup or cloud backup on compromised devices. - Add android:fullBackupContent and android:dataExtractionRules attributes pointing to new XML resource files (added in follow-up commits) to give fine-grained control over what gets backed up on Android 12+ (API 31+) and older versions respectively. - Add android:exported="false" to SettingsActivity which previously had no explicit exported attribute, defaulting to exported=true on devices running Android < 12 when targetSdk < 31, allowing any app on the device to start the Settings screen. --- app/src/main/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index da7a80e4c8..a5cb6941ee 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -36,7 +36,7 @@ Date: Wed, 22 Apr 2026 16:25:56 +0530 Subject: [PATCH 02/12] security: add backup_rules.xml to exclude sensitive data from backup Adds fullBackupContent rules (Android 11 and below) to exclude sharedpref, database, file, and external storage from adb and cloud backup. This prevents extraction of Firebase auth tokens, survey responses, and GPS coordinates from compromised devices. --- app/src/main/res/xml/backup_rules.xml | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app/src/main/res/xml/backup_rules.xml diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000000..9b87cb01a4 --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + From b15a2d94f0cf6874a9e39fc0684fb815d4acec2c Mon Sep 17 00:00:00 2001 From: Kotha Dhakshin <179742818+Dhakshin2007@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:26:42 +0530 Subject: [PATCH 03/12] security: add data_extraction_rules.xml for Android 12+ backup protection Adds dataExtractionRules (Android 12+/API 31+) to exclude all app data domains from both cloud backup and device-to-device transfer. Prevents extraction of Firebase auth tokens, survey data, and GPS coordinates on modern Android devices. Completes the backup security hardening started in the previous commit alongside backup_rules.xml (Android 11 and below). --- .../main/res/xml/data_extraction_rules.xml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/src/main/res/xml/data_extraction_rules.xml diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000000..bff0aeb9f3 --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + From f7a3ace295c30708f49b442a311081f462a2c69c Mon Sep 17 00:00:00 2001 From: Kotha Dhakshin <179742818+Dhakshin2007@users.noreply.github.com> Date: Wed, 22 Apr 2026 18:56:45 +0530 Subject: [PATCH 04/12] fix: add blank line after XML declaration to pass Checkstyle RegexpHeader --- app/src/main/res/xml/backup_rules.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml index 9b87cb01a4..bcf789f4b6 100644 --- a/app/src/main/res/xml/backup_rules.xml +++ b/app/src/main/res/xml/backup_rules.xml @@ -1,4 +1,5 @@ - + + From 26e9e1963c10b883b745ae2811f69d4097ef18a3 Mon Sep 17 00:00:00 2001 From: Kotha Dhakshin <179742818+Dhakshin2007@users.noreply.github.com> Date: Wed, 22 Apr 2026 20:35:33 +0530 Subject: [PATCH 08/12] Apply suggestion from @andreia-ferreira Co-authored-by: Andreia Ferreira <51242456+andreia-ferreira@users.noreply.github.com> --- app/src/main/res/xml/backup_rules.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml index 70f54ff564..5afb70c489 100644 --- a/app/src/main/res/xml/backup_rules.xml +++ b/app/src/main/res/xml/backup_rules.xml @@ -1,7 +1,7 @@