Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / games / hub / src / main / res / xml / data_extraction_rules.xml
data_extraction_rules.xml77 lines · 4.1 KiBRaw
| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- |
| 3 | Games Hub. Audited state: |
| 4 | * databases/games-hub-db — Room DB (GamesHubDatabase) with play sessions, |
| 5 | achievement progress, player profile and a cross-app activity feed |
| 6 | aggregated from the other eight games. |
| 7 | * secure_prefs.xml — the SQLCipher passphrase for that DB. |
| 8 | * filesDir/datastore_default.preferences_pb — UI settings. |
| 9 | |
| 10 | games-hub-db is excluded from BOTH sections, for a correctness reason before |
| 11 | a privacy one. It is built via library:room buildDatabase(), so it is |
| 12 | SQLCipher-encrypted with a random passphrase that DatabaseHelper wraps using |
| 13 | an AndroidKeystore key (alias db_no_auth_key). Keystore keys are hardware-bound |
| 14 | and are never backed up or transferred. On a restored device the alias is |
| 15 | gone, so DatabaseHelper.isKeyGenerated() returns false, buildDatabase() |
| 16 | generates a fresh key and a brand-new passphrase, and |
| 17 | encryptExistingDatabase() sees a non-plaintext header and leaves the file |
| 18 | alone — Room then opens the restored ciphertext with the wrong key and throws |
| 19 | SQLiteNotADatabaseException. Shipping the raw file doesn't restore the user's |
| 20 | data, it bricks first launch. |
| 21 | |
| 22 | Migration is handled properly by the app's own BackupAgent instead: it uses |
| 23 | SqlCipherDbCodec to sqlcipher_export() to plaintext at backup time and |
| 24 | re-encrypt under the new device's key at restore time. |
| 25 | |
| 26 | secure_prefs.xml goes with it — it holds only the Keystore-wrapped ciphertext |
| 27 | of the passphrase, which is undecryptable off-device and is regenerated on |
| 28 | first launch anyway. |
| 29 | |
| 30 | SCOPE — READ BEFORE RELYING ON THE <cloud-backup> SECTION BELOW. |
| 31 | hub declares android:backupAgent=".util.AppBackupAgent" and does NOT set |
| 32 | android:fullBackupOnly, so Android uses key/value backup for this app and the |
| 33 | <cloud-backup> section here is NOT consulted. What actually leaves the device |
| 34 | for cloud is whatever AppBackupAgent lists: dbConfigs (games-hub-db, exported |
| 35 | by SqlCipherDbCodec) and datastoreNames (datastore_default). The rules below |
| 36 | govern <device-transfer>, and they are the correct control if the backupAgent |
| 37 | is ever removed. |
| 38 | |
| 39 | Privacy note, corrected: hub's DB is a cross-app behavioural profile (what the |
| 40 | user plays and for how long, across eight apps). An earlier version of this |
| 41 | comment claimed the exclusion below keeps that profile off Google's servers. |
| 42 | That is WRONG. Because this app is key/value, the agent ships games-hub-db to |
| 43 | cloud regardless of this file — and SqlCipherDbCodec.exportDatabase() |
| 44 | sqlcipher_export()s it to PLAINTEXT inside the backup payload first. If that |
| 45 | profile should not leave the device, the fix is to drop DB_NAME from |
| 46 | AppBackupAgent.dbConfigs, not to edit this XML. |
| 47 | --> |
| 48 | <data-extraction-rules> |
| 49 | <!-- Not consulted while android:backupAgent is declared; see SCOPE above. |
| 50 | Kept correct so behaviour is right if the agent is ever removed. --> |
| 51 | <cloud-backup> |
| 52 | <include domain="root" path="." /> |
| 53 | <include domain="file" path="." /> |
| 54 | <include domain="database" path="." /> |
| 55 | <exclude domain="database" path="games-hub-db" /> |
| 56 | <exclude domain="database" path="games-hub-db-wal" /> |
| 57 | <exclude domain="database" path="games-hub-db-shm" /> |
| 58 | <exclude domain="database" path="games-hub-db-journal" /> |
| 59 | <include domain="sharedpref" path="." /> |
| 60 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 61 | <include domain="external" path="." /> |
| 62 | </cloud-backup> |
| 63 | <device-transfer> |
| 64 | <include domain="root" path="." /> |
| 65 | <include domain="file" path="." /> |
| 66 | <include domain="database" path="." /> |
| 67 | <!-- Same Keystore problem applies to D2D: the wrapping key does not |
| 68 | leave the source device either. --> |
| 69 | <exclude domain="database" path="games-hub-db" /> |
| 70 | <exclude domain="database" path="games-hub-db-wal" /> |
| 71 | <exclude domain="database" path="games-hub-db-shm" /> |
| 72 | <exclude domain="database" path="games-hub-db-journal" /> |
| 73 | <include domain="sharedpref" path="." /> |
| 74 | <exclude domain="sharedpref" path="secure_prefs.xml" /> |
| 75 | <include domain="external" path="." /> |
| 76 | </device-transfer> |
| 77 | </data-extraction-rules> |