Skip to content

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

Add sanity check to vault reset query (#2413)

Leendert de Borsta75eba9f1b83
diff --git a/core/client/src/database/repositories/ImportExportRepository.ts b/core/client/src/database/repositories/ImportExportRepository.ts
index 734c97bc3..83ce329c3 100644
--- a/core/client/src/database/repositories/ImportExportRepository.ts
+++ b/core/client/src/database/repositories/ImportExportRepository.ts
@@ -523,12 +523,11 @@ export class ImportExportRepository extends BaseRepository {
*/
private *deleteAllRows(): DbOp<void> {
const personalManifestId = yield* this.personalManifestId();
+ if (!personalManifestId) {
+ throw new Error('This client has no personal manifest recorded yet; sync once before resetting the vault.');
+ }
for (const table of RESET_TABLES) {
- if (personalManifestId) {
- yield* this.execute(`DELETE FROM ${table} WHERE ManifestId = ?`, [personalManifestId]);
- } else {
- yield* this.execute(`DELETE FROM ${table}`);
- }
+ yield* this.execute(`DELETE FROM ${table} WHERE ManifestId = ?`, [personalManifestId]);
}
}
}