Skip to content

Enabling backup when the ClientSideEncryption is enabled #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tunnel/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
}
namespace = "${pkg}.tunnel"
defaultConfig {
minSdk = 21
minSdk = 23
}
externalNativeBuild {
cmake {
Expand Down
2 changes: 1 addition & 1 deletion ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
namespace = pkg
defaultConfig {
applicationId = pkg
minSdk = 21
minSdk = 23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Can't these just be conditioned on having the right sdk value? clientSideEncryption, for example, is only available in API 28 and higher.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below, this ensures that client encryption is enforced. Android 5 supports the backup keys, however it doesn't look at the clientSideEncryption setting, so it just ignores it and backs up anyway, which I think is undesirable behaviour.

targetSdk = 36
versionCode = providers.gradleProperty("wireguardVersionCode").get().toInt()
versionName = providers.gradleProperty("wireguardVersionName").get()
Expand Down
3 changes: 2 additions & 1 deletion ui/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@

<application
android:name=".Application"
android:allowBackup="false"
android:allowBackup="true"
android:fullBackupContent="@xml/backup"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works for API ≤30. For API ≥31, you need android:dataExtractionRules and a different file. See https://developer.android.com/identity/data/autobackup for details.

android:banner="@mipmap/banner"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher"
Expand Down
6 changes: 6 additions & 0 deletions ui/src/main/res/xml/backup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="sharedpref" path="." requireFlags="clientSideEncryption" />
<include domain="database" path="." requireFlags="clientSideEncryption" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this app use that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check, it was part of my default set for <include />

<include domain="file" path="." requireFlags="clientSideEncryption" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want the deviceToDeviceTransfer requirement?

Copy link
Author

@mintsoft mintsoft Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would prevent anything seedvault-y (i.e. my nightly backups) from backing up the app; defeating the purpose imo.

</full-backup-content>