-
Notifications
You must be signed in to change notification settings - Fork 0
π Disable Auto Backup to prevent data leakage #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Devasy
wants to merge
3
commits into
main
Choose a base branch
from
jules-security-allow-backup-2068063299429963149
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π§© Analysis chain
π Web query:
According to the latest Android documentation, doesandroid:allowBackup="false"fully disable both cloud backup and device-to-device transfer on Android 12+? If not, what exact combination ofallowBackup,fullBackupContent, anddataExtractionRulesis recommended to guarantee no app data backup/transfer?π‘ Result:
No, according to the latest Android documentation, setting android:allowBackup="false" does not fully disable both cloud backup and device-to-device (D2D) transfer on Android 12+. On devices from some manufacturers, android:allowBackup="false" disables cloud backups (e.g., Google Drive) but does not disable D2D transfers. To guarantee no app data backup or transfer on Android 12+, use the following combination in the AndroidManifest.xml element: android:allowBackup="false" android:dataExtractionRules="@xml/data_extraction_rules" Create res/xml/data_extraction_rules.xml with excludes for all domains in both and : For compatibility with Android 11 and lower, also add android:fullBackupContent="@xml/backup_rules" with similar excludes in a backup_rules.xml file using syntax. This configuration explicitly excludes all app data from both cloud backups and D2D transfers while disabling legacy backups.
Citations:
Add explicit data extraction rules to fully disable backups on Android 12+.
Setting
android:allowBackup="false"alone does not prevent device-to-device transfers on some Android 12+ devices. Addandroid:dataExtractionRules="@xml/data_extraction_rules"with explicit excludes for all data domains, andandroid:fullBackupContent="@xml/backup_rules"for Android 11 compatibility.Manifest and configuration files required
Update AndroidManifest.xml:
<application android:label="RepForge" android:name="${applicationName}" android:icon="@mipmap/ic_launcher" - android:allowBackup="false"> + android:allowBackup="false" + android:fullBackupContent="@xml/backup_rules" + android:dataExtractionRules="@xml/data_extraction_rules">Create
res/xml/data_extraction_rules.xml:Create
res/xml/backup_rules.xml:π€ Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai is there any specific reason why we are disabling backups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Devasy, great question! Here are the key reasons why disablingandroid:allowBackupis a security best practice:Sensitive data exposure: Android's Auto Backup (enabled by default) automatically uploads app data β including databases, shared preferences, and files β to the user's Google Drive. If that Google account is compromised, an attacker could restore the backup onto another device and access all of your app's stored data (e.g., workout history, user credentials, session tokens).
Unintended data retention: Even after a user uninstalls the app, backed-up data can persist in the cloud and be restored when the app is reinstalled, potentially on a different device. This creates unintended data retention that may conflict with privacy expectations.
ADB backup attack vector: On older Android versions,
allowBackup="true"also enables backup via ADB (adb backup), meaning anyone with physical USB access to an unlocked device could extract app data β a significant risk for apps handling personal health/fitness data.Google Play compliance: Google's Privacy and Security guidelines recommend explicitly controlling backup behavior for apps that handle personal or sensitive data.
For a workout logger storing personal health/fitness data, disabling backups is the right call. However, as my review comment noted,
android:allowBackup="false"alone is not sufficient on Android 12+ β you also needandroid:dataExtractionRulesto block device-to-device transfers, andandroid:fullBackupContentfor Android 11 and below compatibility. The fix suggested in the review comment addresses all of these cases comprehensively.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can clarify this since I authored the change: We are disabling backups as a security measure to prevent potential data leakage. By default, Android automatically backs up application data to Google Drive, which could expose sensitive application data or user information if the user's backup account is compromised. Setting
android:allowBackup="false"ensures that the app's data stays securely on the device.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.