~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
fix: skip user_exists DB query when validation already failed and initialize auth DB in rate limiting tests (#2543)
LearningCircuit1d59098236ec
diff --git a/src/local_deep_research/web/auth/routes.py b/src/local_deep_research/web/auth/routes.pyindex dd770ad4aa..f62007ad0a 100644--- a/src/local_deep_research/web/auth/routes.py+++ b/src/local_deep_research/web/auth/routes.py@@ -318,7 +318,7 @@ def register():# 3. Local database query timing is minimal (no network calls)# 4. Better UX with immediate feedback outweighs minor timing risk# See: https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html- if username and db_manager.user_exists(username):+ if not errors and username and db_manager.user_exists(username):errors.append("Registration failed. Please try a different username.")if errors:diff --git a/tests/auth_tests/test_auth_rate_limiting.py b/tests/auth_tests/test_auth_rate_limiting.pyindex c7f2d20c17..4fb10fd690 100644--- a/tests/auth_tests/test_auth_rate_limiting.py+++ b/tests/auth_tests/test_auth_rate_limiting.py@@ -3,6 +3,10 @@ Tests for authentication rate limiting (login and registration endpoints).Tests that brute force protection is working correctly."""+import shutil+import tempfile+from pathlib import Path+import pytest@@ -10,11 +14,30 @@ class TestAuthRateLimiting:"""Test rate limiting on authentication endpoints."""@pytest.fixture- def app(self):+ def temp_data_dir(self):+ """Create a temporary data directory for testing."""+ temp_dir = tempfile.mkdtemp()+ yield Path(temp_dir)+ shutil.rmtree(temp_dir)++ @pytest.fixture+ def app(self, temp_data_dir, monkeypatch):"""Create a test Flask app with rate limiting."""+ monkeypatch.setenv("LDR_DATA_DIR", str(temp_data_dir))++ from local_deep_research.database.auth_db import init_auth_database+ from local_deep_research.database.encrypted_db import db_managerfrom local_deep_research.web.app_factory import create_appfrom local_deep_research.web.utils.rate_limiter import limiter+ # Reset db_manager state+ db_manager.connections.clear()+ db_manager.data_dir = temp_data_dir / "encrypted_databases"+ db_manager.data_dir.mkdir(parents=True, exist_ok=True)++ # Initialize auth database+ init_auth_database()+app, _ = create_app()app.config["TESTING"] = Trueapp.config["WTF_CSRF_ENABLED"] = False # Disable CSRF for testing@@ -33,6 +56,7 @@ class TestAuthRateLimiting:# Restore original statelimiter.enabled = True+ db_manager.connections.clear()@pytest.fixturedef client(self, app):@@ -309,11 +333,28 @@ class TestRateLimitReset:"""Test that rate limits reset after the time window."""@pytest.fixture- def app(self):+ def temp_data_dir(self):+ """Create a temporary data directory for testing."""+ temp_dir = tempfile.mkdtemp()+ yield Path(temp_dir)+ shutil.rmtree(temp_dir)++ @pytest.fixture+ def app(self, temp_data_dir, monkeypatch):"""Create a test Flask app with rate limiting."""+ monkeypatch.setenv("LDR_DATA_DIR", str(temp_data_dir))++ from local_deep_research.database.auth_db import init_auth_database+ from local_deep_research.database.encrypted_db import db_managerfrom local_deep_research.web.app_factory import create_appfrom local_deep_research.web.utils.rate_limiter import limiter+ db_manager.connections.clear()+ db_manager.data_dir = temp_data_dir / "encrypted_databases"+ db_manager.data_dir.mkdir(parents=True, exist_ok=True)++ init_auth_database()+app, _ = create_app()app.config["TESTING"] = Trueapp.config["WTF_CSRF_ENABLED"] = False@@ -323,8 +364,11 @@ class TestRateLimitReset:limiter.enabled = Truelimiter.init_app(app)limiter.reset()+yield app+ db_manager.connections.clear()+@pytest.fixturedef client(self, app):"""Create a test client."""