Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Disable iOS backup for all AliasVault app shared data (#1497)

Leendert de Borst0bd662320174
diff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore.swift
index b1c812e4d..fe43407e6 100644
--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore.swift
@@ -40,6 +40,7 @@ public class VaultStore {
/// Initialize the VaultStore
public init() {
+ excludeSharedContainerFromBackup()
loadSavedSettings()
setupNotificationObservers()
}
@@ -55,6 +56,22 @@ public class VaultStore {
return encryptionKey != nil
}
+ /// Exclude the entire shared app group container from iCloud and iTunes backups.
+ /// All app data (encrypted vault database, UserDefaults plist with auth tokens and key
+ /// derivation parameters) is security-sensitive and device-bound. Note: actual encryption keys
+ /// are stored separately in the Keychain with ThisDeviceOnly accessibility.
+ private func excludeSharedContainerFromBackup() {
+ guard var containerURL = FileManager.default.containerURL(
+ forSecurityApplicationGroupIdentifier: VaultConstants.userDefaultsSuite
+ ) else {
+ return
+ }
+
+ var resourceValues = URLResourceValues()
+ resourceValues.isExcludedFromBackup = true
+ try? containerURL.setResourceValues(resourceValues)
+ }
+
private func loadSavedSettings() {
if userDefaults.object(forKey: VaultConstants.authMethodsKey) != nil {
let savedRawValue = userDefaults.integer(forKey: VaultConstants.authMethodsKey)