~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: use env_registry for cipher_memory_security instead of raw os.environ
LearningCircuit507d0d35ea63
diff --git a/.gitleaks.toml b/.gitleaks.tomlindex 373270d62c..dae9bf7c2e 100644--- a/.gitleaks.toml+++ b/.gitleaks.toml@@ -118,6 +118,8 @@ paths = ['''src/local_deep_research/web/static/js/.*\.js$''',# Database session context uses password variable names (not actual secrets)'''src/local_deep_research/database/session_context\.py$''',+ # Environment setting definitions use key= parameter names (not actual secrets)+ '''src/local_deep_research/settings/env_definitions/.*\.py$''',# RAG routes and services use db_password variable names (not actual secrets)'''src/local_deep_research/research_library/routes/rag_routes\.py$''','''src/local_deep_research/research_library/services/library_rag_service\.py$'''diff --git a/src/local_deep_research/database/sqlcipher_utils.py b/src/local_deep_research/database/sqlcipher_utils.pyindex d27f7595e1..566643a944 100644--- a/src/local_deep_research/database/sqlcipher_utils.py+++ b/src/local_deep_research/database/sqlcipher_utils.py@@ -270,14 +270,9 @@ def apply_sqlcipher_pragmas(# cipher_memory_security is a runtime PRAGMA that does not affect stored# database format. ON (default) zeroes memory after use for security;# OFF improves performance at the cost of residual plaintext in memory.- mem_security = os.environ.get(- "LDR_DB_CIPHER_MEMORY_SECURITY", "ON"- ).upper()- if mem_security not in ("ON", "OFF"):- logger.warning(- f"Invalid LDR_DB_CIPHER_MEMORY_SECURITY value '{mem_security}', using 'ON'"- )- mem_security = "ON"+ from ..settings.env_registry import get_env_setting++ mem_security = get_env_setting("db_config.cipher_memory_security", "ON")cursor_or_conn.execute(f"PRAGMA cipher_memory_security = {mem_security}")diff --git a/src/local_deep_research/settings/env_definitions/db_config.py b/src/local_deep_research/settings/env_definitions/db_config.pyindex 956991daea..7d9132d452 100644--- a/src/local_deep_research/settings/env_definitions/db_config.py+++ b/src/local_deep_research/settings/env_definitions/db_config.py@@ -69,4 +69,12 @@ DB_CONFIG_SETTINGS = [description="HMAC algorithm for database integrity",default="HMAC_SHA512",),+ # Runtime security settings+ EnumSetting(+ key="db_config.cipher_memory_security",+ description="SQLCipher memory security (ON=clear memory after use, OFF=faster)",+ allowed_values={"ON", "OFF"},+ default="ON",+ case_sensitive=False,+ ),]diff --git a/tests/database/test_sqlcipher_utils.py b/tests/database/test_sqlcipher_utils.pyindex 63e633224a..84866ca384 100644--- a/tests/database/test_sqlcipher_utils.py+++ b/tests/database/test_sqlcipher_utils.py@@ -407,7 +407,7 @@ class TestCipherMemorySecurityEnvVar:mock_cursor = Mock()with patch.dict(os.environ, {}, clear=False):- os.environ.pop("LDR_DB_CIPHER_MEMORY_SECURITY", None)+ os.environ.pop("LDR_DB_CONFIG_CIPHER_MEMORY_SECURITY", None)apply_sqlcipher_pragmas(mock_cursor, creation_mode=True)call_args_list = [@@ -420,14 +420,16 @@ class TestCipherMemorySecurityEnvVar:assert "ON" in mem_calls[0]def test_respects_off_env_var(self):- """Test that LDR_DB_CIPHER_MEMORY_SECURITY=OFF is respected."""+ """Test that LDR_DB_CONFIG_CIPHER_MEMORY_SECURITY=OFF is respected."""from local_deep_research.database.sqlcipher_utils import (apply_sqlcipher_pragmas,)mock_cursor = Mock()- with patch.dict(os.environ, {"LDR_DB_CIPHER_MEMORY_SECURITY": "OFF"}):+ with patch.dict(+ os.environ, {"LDR_DB_CONFIG_CIPHER_MEMORY_SECURITY": "OFF"}+ ):apply_sqlcipher_pragmas(mock_cursor, creation_mode=True)call_args_list = [@@ -448,7 +450,7 @@ class TestCipherMemorySecurityEnvVar:mock_cursor = Mock()with patch.dict(- os.environ, {"LDR_DB_CIPHER_MEMORY_SECURITY": "INVALID"}+ os.environ, {"LDR_DB_CONFIG_CIPHER_MEMORY_SECURITY": "INVALID"}):apply_sqlcipher_pragmas(mock_cursor, creation_mode=True)