Commit graph

879 commits

Author SHA1 Message Date
Torsten Grote
75d4c7d05c Don't use setUnlockedDeviceRequired() on the backup key
as importing it with Android 12 GSI fails. This key is only used to restore old backups anyway and the new one doesn't use this restriction.
2021-10-13 16:25:41 +05:30
Torsten Grote
579919d5e7 Code style and lint after Android 12 version bumps 2021-10-13 16:25:41 +05:30
Torsten Grote
e80d89f0a2 Use our transport flags when creating RestoreSets
This hopefully prevents apps skipping restore that require end-to-end encrypted backup transports.

3762670bb7
2021-10-13 16:25:41 +05:30
Torsten Grote
7f4b565d2a First version bumps for Android 12 2021-10-13 16:25:41 +05:30
Torsten Grote
b029b0b029 Improve behavior of @pm@ backups when we can't do backups
Before, we were faking a backup and just returned true, but remembering that next time, we need to do a fresh non-incremental @pm@ backup.
Now, we backup to local cache, but don't upload it. On next run, when we can do backups again, we will upload the updated cache. This simplifies things and reduces the special logic required.
2021-10-13 16:15:20 +05:30
Torsten Grote
36c35d6f98 Force backup initialization when we have no cached metadata
as it can happen after clearing app data
2021-10-13 16:15:20 +05:30
Torsten Grote
c59a006a00 Remove @pm@ optimization from BackupNotificationManager
as it shouldn't be needed anymore
2021-10-13 16:15:20 +05:30
Torsten Grote
b8b6882484 Don't try to clear data of NO_DATA system apps
This speeds up the backup quite a bit since there's many such apps
2021-10-13 16:15:20 +05:30
Torsten Grote
79777a7b6f Close K/V DB after restoring records
also don't log stack trace when not finding backup type
2021-10-13 16:15:20 +05:30
Torsten Grote
ef5d1c3bc8 Port auto restore optimization from legacy v0 code to new v1 code 2021-10-13 16:15:20 +05:30
Torsten Grote
3c5e4120c7 Refactor Storage Plugin API 2021-10-13 16:15:20 +05:30
Torsten Grote
50066f0317 Let ApkBackup and ApkRestore use the new storage plugin API 2021-10-13 16:15:20 +05:30
Torsten Grote
183e34afd2 Remove legacy backup plugin code 2021-10-13 16:15:20 +05:30
Torsten Grote
1885021c1c Move backup of APKs of opt-out apps to after uploading @pm@ DB 2021-10-13 16:15:20 +05:30
Torsten Grote
a0f3c6b45f K/V restore using single file 2021-10-13 16:15:20 +05:30
Torsten Grote
0c915e5eb8 K/V backup using single file
Tests are still broken until restore has also been implemented with single file approach
2021-10-13 16:15:20 +05:30
Torsten Grote
23bb385190 Use new storage API for full restore 2021-10-13 16:15:20 +05:30
Torsten Grote
674568ca11 Use new storage API for full backups 2021-10-13 16:15:20 +05:30
Torsten Grote
4bdaaa0ce9 Make RestoreCoordinator use the new storage API with salt and backup type
This breaks restores until all the other required changed have been implemented.
2021-10-13 16:15:20 +05:30
Torsten Grote
75cf014e5d Add crypto method to get salted names for package data and APKs
This will only hide installed apps from naive attackers as the APKs are still not encrypted and even then other attacks would be possible.

However, it allows us to simplify our storage plugin API.
2021-10-13 16:15:20 +05:30
Torsten Grote
793663acb5 Add salt and backup type to metadata 2021-10-13 16:15:20 +05:30
Torsten Grote
39cb0c6443 Factor getting secure random bytes into Crypto interface 2021-10-13 16:15:20 +05:30
Torsten Grote
a77d927624 Remove deprecated methods from BackupPlugin 2021-10-13 16:15:20 +05:30
Torsten Grote
db4103e752 Move code to get available backups from RestorePlugin to BackupPlugin 2021-10-13 16:15:20 +05:30
Torsten Grote
5d1e3debd1 Define new and simpler BackupPlugin API
leaving the old one in place still
2021-10-13 16:15:20 +05:30
Torsten Grote
2932af463c Check version of backup files against expected version from metadata
and throw security exception if it does not match
2021-10-13 16:15:20 +05:30
Torsten Grote
5523e57fe7 Add current metadata to RestoreCoordinator state
so we know which backup version we need to expect during restore
2021-10-13 16:15:20 +05:30
Torsten Grote
bcb245531c Refactor fetching of restorable backups
so that we don't go through the BackupManager API, but use RestoreCoordinator directly
2021-10-13 16:15:20 +05:30
Torsten Grote
aeafc80bb9 Clean up after moving all backup code to new v1 version 2021-10-13 16:15:20 +05:30
Torsten Grote
f4dc776ed3 Do full backups with new version 1 with new crypto
Restoring still supports version 0 with old crypto
2021-10-13 16:15:20 +05:30
Torsten Grote
0c3ea7679b Do K/V backup with new version 1 with new crypto
Restoring still supports version 0 with old crypto
2021-10-13 16:15:20 +05:30
Torsten Grote
3ffb79b04f Write metadata with new version 1
Reading still supports version 0
2021-10-13 16:15:20 +05:30
Torsten Grote
0f241f7d25 Ensure that we have the main key for v1 crypto
We ask the user to generate a new key, because actively asking for the old one is training bad security habits, but technically verifying the old key will also work.
2021-10-13 16:15:20 +05:30
Torsten Grote
7dceb98670 Add test for decrypting and reading version 0 metadata 2021-10-13 16:15:20 +05:30
Torsten Grote
b707d7f9d0 Add test for full and k/v restore of version 0 backups 2021-10-13 16:15:20 +05:30
Michael Bestas
1cae6dc60e Bump version to 11-2.3
Change-Id: I792a1b1039f2ffcf23301334914b9c1fc75244ef
2021-10-05 01:34:35 +05:30
Michael Bestas
bfdf69c2f0 Switch all translations references to github.com/seedvault-app
Change-Id: I400b831c64ca72aa07940e323885595e864b2745
2021-10-05 01:34:35 +05:30
Michael Bestas
dce3ad244d Fix translations after replacing novacrypt BIP39 library
Change-Id: Ie8fe00a8d870374ce86c3766307f954dc9d259ba
2021-10-05 01:34:35 +05:30
Torsten Grote
1a48d339d5
Merge pull request #321 from chirayudesai/android11-2.2-merge
Merge master into android11 (11-2.2)
2021-09-29 11:38:28 -03:00
Chirayu Desai
88f44a9f66 Merge branch 'master' of https://github.com/seedvault-app/seedvault into android11-11-2.2-merge
* 'master' of https://github.com/seedvault-app/seedvault: (50 commits)
  Bump version to 11-2.2
  Changelog: Update till 11-2.1
  Restrict exported components
  Allow launching restore through a dialer code
  Add expert settings with an option for unlimited quota
  Prevent screenshots of recovery code
  Use clearer more generic strings
  Ask for system authentication before storing a new recovery code
  Split up validating, verifying and storing of recovery code
  Disable Nextcloud restore when not installed and no store available
  Disable spell-checker on recovery code input
  Add warning for third-party tools to README
  document potential information leakage through the long-lived SQL caches
  Provide an overview over key derivations
  Compares kotlin-bip39 library with bitcoinj library
  Link FAQ in Readme to make it more discoverable
  Move LocalContactsBackup to product partition
  Add newline at the end of all files
  Improve .editorconfig setup
  Don't backup on metered networks
  ...

Conflicts:
	app/src/main/res/values-de/strings.xml
	app/src/main/res/values-es/strings.xml
	app/src/main/res/values-pt/strings.xml
	app/src/main/res/values-zh-rCN/strings.xml

Conflicts resolved by simply checking out translations from android11,
since they are not modified in master at all.

Change-Id: I0a83c72dbc78b38985b46f9b75ce92e27acd2e03
2021-09-29 19:52:03 +05:30
Torsten Grote
d1b8ec82c1
Merge pull request #320 from chirayudesai/11-2.2
Bump version to 11-2.2
2021-09-29 11:20:27 -03:00
Chirayu Desai
08abcb63d7 Bump version to 11-2.2
User-facing changes:
* Don't backup on metered networks
* Disable spell-checker on recovery code input
* Disable Nextcloud restore when not installed and no store available
* Ask for system authentication before storing a new recovery code
* Prevent screenshots of recovery code
* Add expert settings with an option for unlimited quota
* Allow launching restore through a dialer code
* Restrict exported components

Others:
* Improve .editorconfig setup
* Move LocalContactsBackup to product partition
* Link FAQ in Readme to make it more discoverable
* Compares kotlin-bip39 library with bitcoinj library
* Provide an overview over key derivations
* document potential information leakage through the long-lived SQL caches
* Add warning for third-party tools to README

Change-Id: I095af13d0ff010c9602bc323267c074ce7d019a2
2021-09-29 19:33:45 +05:30
Chirayu Desai
746abba63e Changelog: Update till 11-2.1
* Not full, but better than not having anything here

Change-Id: If80d19882aab607e0598851d2e2ca1b5c7f3cead
2021-09-29 19:33:08 +05:30
Torsten Grote
92d1f4d5f5
Merge pull request #319 from chirayudesai/restore-dialer
Allow launching restore through a dialer code
2021-09-29 10:45:18 -03:00
flawedworld
b2cd3c76a3 Restrict exported components
Change-Id: I30e5f530b6814acd4d3940279de6100f82e68445
2021-09-29 18:57:14 +05:30
Chirayu Desai
38f01765ec Allow launching restore through a dialer code
* We don't show Restore in menu by default since it's
  not the best idea to restore a running system
* However, at the same time, it's good to have a way to do
  that for those who'd like to restore anyway, and the only
  current way is adb, which is not ideal
* Dialing "*#*#RESTORE#*#*" will launch the restore activity

Change-Id: I258fead82f7e916a4de0b314e1840d7aa4b3746c
2021-09-29 18:57:14 +05:30
Torsten Grote
a5a3a85c6c Add expert settings with an option for unlimited quota
Change-Id: Iebaea41ce4e69912f7cb723bd92e94e4396aa657
2021-09-28 22:02:04 +05:30
Torsten Grote
d2a748c34a Prevent screenshots of recovery code
This is may be inconvenient for some people, but it is way more secure as screenshots can be accessed by malicious apps that look our for BIP39 codes. Better to store the code on paper.
2021-09-24 02:55:56 +05:30
Torsten Grote
3b1a4e3881 Use clearer more generic strings 2021-09-24 02:55:56 +05:30
Torsten Grote
6e838978e3 Ask for system authentication before storing a new recovery code
This will help to prevent data extraction via seedvault when somebody gets hold of an unlocked phone. However, it will not help against someone able to force you to provide fingerprints or other device secrets.
2021-09-24 02:55:56 +05:30