Bug 1903064 - Prevent recovery from backups created from an application with a newer appVersion. r=backup-reviewers,sthompson,kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D215004
This commit is contained in:
Mike Conley
2024-06-28 15:50:31 +00:00
parent b420e6f986
commit b4a1bad483
3 changed files with 58 additions and 0 deletions

View File

@@ -2091,6 +2091,14 @@ export class BackupService extends EventTarget {
);
}
if (
Services.vc.compare(AppConstants.MOZ_APP_VERSION, meta.appVersion) < 0
) {
throw new Error(
`Cannot recover a backup created on version ${meta.appVersion} in ${AppConstants.MOZ_APP_VERSION}`
);
}
// Okay, we have a valid backup-manifest.json. Let's create a new profile
// and start invoking the recover() method on each BackupResource.
let profileSvc = Cc["@mozilla.org/toolkit/profile-service;1"].getService(