Repository navigation
Conversation
allowBackup="false" turns off cloud backup, but on Android 12+ it does not turn off device-to-device transfer, and data_extraction_rules.xml was still the Android Studio template. So the database with every tag's private keys and location history, the Keystore-encrypted session and the Anisette identity were all eligible to be copied to a new phone. Exclude every domain in <device-transfer>, and in <cloud-backup> and the legacy backup_rules.xml too, so turning allowBackup on later does not start copying them. A new phone starts as a fresh install. The reasons for excluding everything rather than just the database are in the XML comment. KeepingAppDataOnThisPhoneTest pins the manifest attributes and every excluded domain on the JVM. Part of parawanderer#318 (audit S-05). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Sounds good, though I saw the emulator tests fail which is worth looking into/fixing. If you don't want to run those on your machine, it's completely doable to e.g. have an LLM fix it with the CI running them for you here (I did that on one of my laptops where I didn't want to install the android dev bloat). EDIT: I see it's something C++ and you did not realistically change anything here that should impact that. So I will look into it |
|
Looking it with an agent now: that failure is the time-of-day flake you identified in #313 and #314, not anything this changes: I've rerun the failed job.
|
Fixes audit finding S-05: app data was not excluded from Android 12+ device-to-device transfer.
android:allowBackup="false"turns off cloud backup, but for an app targeting API 31+ it does not turn off the phone-to-phone copy when someone sets up a new phone.data_extraction_rules.xmlwas still the Android Studio template with no<device-transfer>section, so everything the app stores was eligible to be copied, including the Room database with every tag's private keys and location history.What changes
data_extraction_rules.xml(Android 12+):<device-transfer>and<cloud-backup>both exclude every domain (root,file,database,sharedpref,externaland the fourdevice_*ones), each withpath=".", and nothing is included.backup_rules.xml(fullBackupContent, Android 11 and older): the same excludes. On those versionsallowBackup="false"already covers transfer too, so this only matters ifallowBackupis ever turned on.<cloud-backup>section isn't used whileallowBackupis false either. Both are filled in so that flippingallowBackuplater doesn't quietly start uploading the database.data_extraction_rules.xml, and AGENTS.md rule 1's "there is no backup" now mentions transfer too.Why everything, not just the database and
user_authThe audit and #318 suggest at least the database and the
user_authDataStore. I excluded everything, for these reasons:user_auth), the iCloud link and the extra sources' passwords are encrypted with Keystore keys. On a new phone they'd arrive as data nothing can decrypt. The app copes with that at each read (MembershipState.KEYS_GONE, "has to be entered again"), but those are error paths, and a new phone shouldn't start on one.files/anisette/and theanisette-identitypreferences moving would put the same machine identity on two phones.The cache,
code_cacheandno_backupdirectories are never backed up or transferred, so they don't need rules.Tests
KeepingAppDataOnThisPhoneTest(JVM, reads the source files likeTrustingApplesProvisioningHostsTest): the manifest keepsallowBackup="false"and points at both rule files;<device-transfer>,<cloud-backup>and<full-backup-content>each exclude exactly every domain, each as a whole (path="."), with no<include>.data_extraction_rules.xml, 2 of the 4 tests go red (device transfer and cloud backup).Verified
:app:testDebugUnitTest(578 tests, 0 failures, 1 skipped),check_java_imports.py.:app:lintDebug: no findings in either rule file or the manifest's backup attributes (lint validates the domains and paths). Lint's existing errors on main are unchanged and unrelated.Not verified
bmgrtooling could simulate a D2D transfer on an emulator, but I haven't done that either.<device-transfer>is up to the OEM. Google's documentation says it applies to D2D transfers on Android 12+.Relationship
Part of #318 (the first item under "Security hardening"). parawanderer agreed to this follow-up on #315. Independent of #313 and #315: branched from
main, and the only file it shares with either is AGENTS.md, where it edits rule 1 and #315 adds rule 23. It merges cleanly with both (git merge-tree).🤖 Generated with Claude Code