Security: disable backup to protect stored credentials#345
Conversation
SharedPreferences contain sensitive credentials (JWT secret, auth password, encryption passphrase, gateway token, FCM token). With allowBackup=true, ADB backup could extract all of these and restore to another device. Disable backup by default and add backup/extraction exclusion rules as defense-in-depth for cases where backup is re-enabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe changes disable automatic backups in the app manifest and add explicit backup and data extraction rules that exclude shared preferences from backup operations. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hello! Thank you for your PR. However, what is the real-world situation? Exploiting this vulnerability requires physical access to an unlocked device, at a minimum, to enable ADB. However, it's much easier to open the app and access the credentials directly. The only field that can't be accessed through the UI is the device authentication token, and yes, it can be used to clone the app. On the other hand, there's currently no way to recover an account if the username or password is lost. A backup might be useful in this case. So, I need additional feedback on this scenario. |
|
This PR is stale because it has been open for 7 days with no activity. |
Summary
android:allowBackup="false"to prevent credential extraction via ADB backupbackup_rules.xmlanddata_extraction_rules.xmlas defense-in-depthProblem
With
allowBackup="true"and no backup exclusion rules,adb backupcaptures all SharedPreferences containing:These can be restored to another device to impersonate the gateway.
Fix
allowBackup="false")fullBackupContentrules (Android 11 and below) excluding all SharedPreferencesdataExtractionRules(Android 12+) excluding SharedPreferences from both cloud backup and device transferThe exclusion rules serve as defense-in-depth — if backup is re-enabled for other reasons, credentials remain protected.
Test plan
adb backupproduces no usable SharedPreferences data🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes