seedvault-app / seedvault

A backup application for the Android Open Source Project.
1.19k stars 73 forks source link

Auto-disable apps that cancel the entire backup #635

Closed grote closed 2 months ago

grote commented 3 months ago

This can happen when the app process gets killed while its BackupAgent is running. There are several qcom apps in the wild that have this issue. These are DoSing our backups and are non-free, so we are defending ourselves against them.

Fixes #491

theimpulson commented 2 months ago

@grote this seems to have a merge conflict but seems good otherwise.

stevesoltys commented 2 months ago

Quite interested in how Google's backup service handles this one.

Regardless, still worth preventing this from happening in subsequent backups..

grote commented 2 months ago

Quite interested in how Google's backup service handles this one.

Me too. Actually, with my test app https://gitlab.com/grote/backupagentcrasher we should be able to find out. Maybe @t-m-w still has a stock phone to try?

grote commented 2 months ago

just rebased and pushed

t-m-w commented 2 months ago

Quite interested in how Google's backup service handles this one.

Me too. Actually, with my test app https://gitlab.com/grote/backupagentcrasher we should be able to find out. Maybe @t-m-w still has a stock phone to try?

Stock fails on the crasher and the whole process is interrupted, just as with Seedvault. A toast appears with the message: "Couldn’t back up data. Try again later." 37 apps are backed up. Try again, same thing. If I uninstall the crasher and try again, there is no error, and 39 apps are backed up.

Logcat snippet ``` I Backup : [GmsBackupTransport] Attempt to do full backup on de.grobox.backupagentcrasher I Backup : [CryptoEnableCheck] Should not encrypt backups: device has no lock screen. I Backup : [FullBackupSession] Using unencrypted processor for de.grobox.backupagentcrasher I Backup : [FullBackupPackageWrapper] create full backup for : de.grobox.backupagentcrasher I Backup : [FullBackupPackageWrapper] Start scotty uploading. I Backup : [CryptoEnableCheck] Should not encrypt backups: device has no lock screen. D BackupManagerService: [UserID:0] awaiting agent for ApplicationInfo{7d9ae74 de.grobox.backupagentcrasher} E CrashingBackupAgent: onCreate: About to crash backup agent! W BackupManagerService: agentDisconnected: the backup agent for de.grobox.backupagentcrasher died: cancel current operations I BackupManagerService: [UserID:0] got agent null W BackupManagerService: Unable to bind to full agent for de.grobox.backupagentcrasher I Backup : [GmsBackupTransport] Arbitrarily cancel full backup transfer. W Backup : [FullBackupPackageWrapper] Scotty transfer exception. fetf I Backup : [CryptoEnableCheck] Should not encrypt backups: device has no lock screen. W PFTBT : Backup cancelled. package=de.grobox.backupagentcrasher, cancelAll=true I Backup : [BackUpNowOperation] Backup done for de.grobox.backupagentcrasher, success: -2003 V BackupManagerService: [UserID:0] Released wakelock:*backup*-0-2982 W Backup : [BackUpNowOperation] Backup cancelled for unknown reason. I Backup : [BackUpNowOperation] Running custom backups W Backup : [MmsAgent] No existing backup W Backup : aemi: Parse Proto Exception. - status:404 W Backup : at aehg.c(:com.google.android.gms@241017038@24.10.17 (190400-617915183):157) W Backup : at aehg.b(:com.google.android.gms@241017038@24.10.17 (190400-617915183):18) W Backup : at aefy.c(:com.google.android.gms@241017038@24.10.17 (190400-617915183):16) W Backup : at agbg.f(:com.google.android.gms@241017038@24.10.17 (190400-617915183):217) W Backup : at agbj.run(:com.google.android.gms@241017038@24.10.17 (190400-617915183):230) W Backup : at alok.c(:com.google.android.gms@241017038@24.10.17 (190400-617915183):50) W Backup : at alok.run(:com.google.android.gms@241017038@24.10.17 (190400-617915183):76) W Backup : at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) W Backup : at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) W Backup : at alty.run(:com.google.android.gms@241017038@24.10.17 (190400-617915183):8) W Backup : at java.lang.Thread.run(Thread.java:1012) I Backup : [MmsAgent] Periodic backup progress update is scheduled. I Backup : [MmsAgent] Periodic backup progress update is shut down. I Backup : [BackUpNowOperation] Backup done for all packages, result code: 29001 ```
grote commented 2 months ago

wow thanks for testing! backup DoS app here we come! Nice we are even going beyond play services here.

stevesoltys commented 2 months ago

Nice find. Wonder if we can report this upstream somehow.

chirayudesai commented 2 months ago

Nice find. Wonder if we can report this upstream somehow.

issuetracker.google.com :)