Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / email / src / main / res / xml / data_extraction_rules.xml

data_extraction_rules.xml77 lines · 4.8 KiBRaw
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 Allowlist. Overrides the permissive include-everything default in the shared :library
4 module. Both sections use <include>, so anything not named here is excluded.
5
6 ALLOWED: shared_prefs/email_settings.xml
7 Holds one key, "load_remote_images" (EmailSettings.kt). It is an app-wide privacy
8 preference with no account scope, no PII and no crypto dependency, and it is the one
9 setting a user would notice silently reverting after a restore. The cloud-backup
10 section sets disableIfNoEncryptionCapabilities="true" so even this only leaves the
11 device under Google's client-side end-to-end encryption.
12
13 EXCLUDED (by omission from the allowlist):
14
15 databases/email-db (+ -wal/-shm/-journal), databases/email-db_temp
16 The EmailAccount table holds accessToken and refreshToken as PLAINTEXT columns
17 (EmailModels.kt:88-89) alongside passwordEncrypted/passwordIv wrapped by the
18 AndroidKeyStore alias "email_account_pw". The same table holds every account's
19 server config, and the EmailMessage table holds all cached message bodies. Account
20 config cannot be separated from the tokens: they are columns on the same row, in
21 the same file. The file is SQLCipher-encrypted under a passphrase wrapped by
22 "db_no_auth_key", and neither Keystore alias survives cloud backup or D2D, so a
23 restored database is unreadable as well as unsafe. email-db_temp is the plaintext
24 staging file from the plaintext->SQLCipher migration.
25 shared_prefs/secure_prefs.xml
26 Wrapped SQLCipher passphrase + IV. Restoring it without its Keystore key leaves
27 DatabaseHelper.isKeyGenerated() reporting a key that no longer exists.
28 shared_prefs/outlook_oauth.xml
29 In-flight PKCE "verifier" and "state" plus "emailHint". A restored verifier/state
30 pair is a stale CSRF token for an authorization request that no longer exists, and
31 emailHint is an account address. No value, real risk.
32 shared_prefs/email_notif_last_seen.xml
33 Keys are literally "<accountEmail>::<folderName>", so the file enumerates the
34 user's email addresses. The only benefit is suppressing one burst of duplicate
35 notifications, and since the accounts database is not restored there is nothing
36 for those UIDs to line up against.
37 shared_prefs/email_idle_state.xml
38 "idle_restart_pending" is transient runtime state. Restoring it true would enqueue
39 an IMAP IDLE restart on a device with no configured accounts.
40 files/outbox/<entryId>/ and files/outbox/<entryId>/inline/
41 Attachment and inline-image payloads for queued outgoing mail, stored as plaintext
42 files. Unsent user mail content; must not be uploaded.
43 files/ Glance widget state
44 androidx.glance.appwidget writes per-widget-id state files under files/. Widget ids
45 are not stable across installs, so the state is meaningless after a restore, and
46 the widget caches message subjects and senders. Regenerable.
47 databases/androidx.work.workdb (+ sidecars)
48 WorkManager scheduling state, including serialized worker input data. Regenerable.
49 cache/cid/, cache/eml_cid/, cache/inline/, cache/eml_attachments/
50 Decoded inline images and attachments from received mail. The framework never
51 backs up cacheDir, but they are named here so the audit is complete.
52
53 Device transfer carries the same single preference. It is not widened relative to cloud
54 backup, because D2D does not migrate AndroidKeyStore material and the accounts database
55 would arrive unopenable.
56
57 SCOPE: email declares android:backupAgent=".platform.AppBackupAgent" and does NOT set
58 android:fullBackupOnly, so Android uses key/value backup and the <cloud-backup> section
59 below is NOT consulted for cloud backup. Cloud content is exactly what AppBackupAgent
60 stages: the email_settings preferences plus one sanitized payload
61 (files/email_backup/accounts.json) holding account server config, addresses, folders
62 and blocked senders with every secret field stripped (no passwordEncrypted/passwordIv,
63 no accessToken/refreshToken — see data/EmailBackup.kt). Restored accounts carry empty
64 credential fields and prompt for the app password on first launch. The rules below
65 govern <device-transfer>, and are the correct control if the backupAgent is ever
66 removed: the raw database and the sealed secrets must still never be file-copied.
67 files/email_backup/accounts.json is agent staging only; it is not named here, so a
68 file-based transfer does not carry it raw.
69-->
70<data-extraction-rules>
71 <cloud-backup disableIfNoEncryptionCapabilities="true">
72 <include domain="sharedpref" path="email_settings.xml" />
73 </cloud-backup>
74 <device-transfer>
75 <include domain="sharedpref" path="email_settings.xml" />
76 </device-transfer>
77</data-extraction-rules>