app_backup_allowed
Reports android:allowBackup="true" with no rule of what the backup holds. Name what may leave the device, or switch backup off.
- Kind
- project-file check
- Tier
- advisory
- Host
- command-line program only (
assay project-files) - Lowest preset
- every preset (on unless switched off)
- Fix
- none
- Security class
- CWE-530 · mobile risk M9 (insecure data storage) · severity 3.9
What it reports
Section titled “What it reports”android:allowBackup="true" on the <application> of a manifest that a release build is made of (android/app/src/main/AndroidManifest.xml, android/app/src/release/AndroidManifest.xml), where neither manifest names a rule of what the backup holds:
android:dataExtractionRules: the rules of cloud backups and of transfers to a new device, read by Android 12 and later;android:fullBackupContent: the rules of Auto Backup, read by Android 11 and earlier;android:backupAgent: a backup agent that writes the backup itself.
One of the three is enough, whatever its rules hold: a rule file that excludes nothing silences the check as well.
The result stands at the attribute: “android:allowBackup is true with no rule of what the backup holds: the backups of the device and its transfers to a new one copy every file of the app, the tokens it keeps among them.”
Where both manifests write allowBackup, a release build takes the release one’s: true in the main manifest and false in the release one is no result.
It does not report:
- an absent
allowBackup. The platform’s default istrue, but Flutter’s template writes none, so a result there would be a result of every app. Only what the project writes is judged. allowBackup="false", or a value that refers to a resource;- the manifests of the
debugandprofilesource sets.
Backups to the cloud and to a new phone copy the app’s files: its databases, its shared preferences, the files it writes. A token, a session or a cached server answer goes with them, and comes back on another device.
allowBackup="true" says the app wants that. Without a rule of what may go, everything goes. The rules keep the secrets out and the preferences in.
Example
Section titled “Example”<application android:label="shop" android:allowBackup="true"><application android:label="shop" android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules"><data-extraction-rules> <cloud-backup> <exclude domain="sharedpref" path="FlutterSecureStorage.xml"/> </cloud-backup> <device-transfer> <exclude domain="sharedpref" path="FlutterSecureStorage.xml"/> </device-transfer></data-extraction-rules>Or, where nothing of the app needs to come back, write android:allowBackup="false".
Configuration
Section titled “Configuration”Under assay.project_files of the project’s root analysis_options.yaml:
| Key | Default | Effect |
|---|---|---|
enabled |
true |
false (or the short form app_backup_allowed: false) switches the check off. |
exclude |
[] |
Path globs, from the project root, where the check places no result. |
How to run it
Section titled “How to run it”assay project-files runs it with the other project-file checks, and assay project-files app_backup_allowed runs it alone. The gate and the baseline commands run it too, as an advisory result that never fails the gate (see Project-file checks). assay check does not.
Security class
Section titled “Security class”In SARIF, the check’s descriptor carries the tags security, external/cwe/cwe-530 and external/owasp-mobile-2024/m9, and the security-severity 3.9. No other report changes.
Keeping a result
Section titled “Keeping a result”No suppression comment applies. If your app keeps no secret in its files and backs up everything on purpose, keep the result in the baseline.