diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp b/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp @@ -472,6 +472,9 @@ DatabaseManager::getQueryExecutor().copyContentFromDatabase( DatabaseManager::restoredConnectionManager->getSQLiteFilePath(), DatabaseManager::restoredConnectionManager->getBackupDataKey()); + // Copying is the final step of the restore, we don't need it anymore, so we + // should clean all the data. + DatabaseManager::clearRestoredDatabaseSensitiveData(); } } // namespace comm diff --git a/web/shared-worker/worker/shared-worker.js b/web/shared-worker/worker/shared-worker.js --- a/web/shared-worker/worker/shared-worker.js +++ b/web/shared-worker/worker/shared-worker.js @@ -542,6 +542,21 @@ SQLITE_RESTORE_DATABASE_PATH, null, ); + + // Copying is the final step of the restore, we don't need it anymore, so we + // should clean all the data. + const restoredSQLiteQueryExecutor = getSQLiteQueryExecutor( + databaseIdentifier.RESTORED, + ); + if (restoredSQLiteQueryExecutor) { + clearSensitiveData( + dbModule, + SQLITE_RESTORE_DATABASE_PATH, + restoredSQLiteQueryExecutor, + ); + setSQLiteQueryExecutor(null, databaseIdentifier.RESTORED); + } + await localforage.removeItem(RESTORED_SQLITE_CONTENT); } persistNeeded = true;