~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
test(backup): verify refreshed backup password security (#5328)
LearningCircuit8c30910ea9c4
diff --git a/tests/database/backup/test_backup_service.py b/tests/database/backup/test_backup_service.pyindex 297351de98..e437a74456 100644--- a/tests/database/backup/test_backup_service.py+++ b/tests/database/backup/test_backup_service.py@@ -1,6 +1,7 @@"""Tests for backup service functionality."""from contextlib import closing+from datetime import UTC, datetimeimport osimport threadingimport time@@ -4879,7 +4880,7 @@ class TestPasswordChangeBackupSecurity:info = db_with_backup- # Rekey the source DB to new password (simulating password change)+ # Given a password-rekeyed source databaseconn = info["sqlcipher"].connect(str(info["db_path"]))cursor = conn.cursor()set_sqlcipher_key(cursor, info["old_pw"])@@ -4887,7 +4888,12 @@ class TestPasswordChangeBackupSecurity:set_sqlcipher_rekey(cursor, info["new_pw"], db_path=info["db_path"])conn.close()- # Purge and refresh with new password+ timestamp = info["backup_path"].stem.removeprefix("ldr_backup_")+ refresh_time = datetime.strptime(timestamp, "%Y%m%d_%H%M%S").replace(+ tzinfo=UTC+ )++ # When purge and refresh reuse the old backup's timestampwith (patch("local_deep_research.database.backup.backup_service"@@ -4904,7 +4910,12 @@ class TestPasswordChangeBackupSecurity:".get_user_backup_directory",return_value=info["backup_dir"],),+ patch(+ "local_deep_research.database.backup.backup_service.datetime",+ wraps=datetime,+ ) as mock_datetime,):+ mock_datetime.now.return_value = refresh_timesvc = BackupService(username="pwtest",password=info["new_pw"],@@ -4913,12 +4924,11 @@ class TestPasswordChangeBackupSecurity:)result = svc.purge_and_refresh()+ # Then the replacement reuses the path and only accepts the new passwordassert result.success+ assert result.backup_path == info["backup_path"]+ assert result.backup_path.exists()- # Old backup should be gone- assert not info["backup_path"].exists()-- # New backup should be readable with new passwordconn = info["sqlcipher"].connect(str(result.backup_path))cursor = conn.cursor()set_sqlcipher_key(cursor, info["new_pw"])@@ -4927,6 +4937,16 @@ class TestPasswordChangeBackupSecurity:assert cursor.fetchone()[0] == "secret"conn.close()+ conn = info["sqlcipher"].connect(str(result.backup_path))+ cursor = conn.cursor()+ set_sqlcipher_key(cursor, info["old_pw"])+ apply_sqlcipher_pragmas(cursor, creation_mode=False)++ with pytest.raises(Exception):+ cursor.execute("SELECT val FROM data WHERE id = 1")++ conn.close()+class TestBackupCorruptionDetection:"""Tests for backup integrity verification against corrupted files.