Skip to content

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

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 is true, 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 debug and profile source 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.

Violating
<application android:label="shop" android:allowBackup="true">
Correctedsay what the backup holds, leaving the secrets out
<application android:label="shop"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules">
android/app/src/main/res/xml/data_extraction_rules.xml
<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".

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.

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.

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.

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.