Skip to content

~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.

fix: targeted security hardening — credential exposure vectors (#2886)

LearningCircuit1f8fb136997d
diff --git a/src/local_deep_research/database/sqlcipher_utils.py b/src/local_deep_research/database/sqlcipher_utils.py
index 4b40bd9244..a19234343b 100644
--- a/src/local_deep_research/database/sqlcipher_utils.py
+++ b/src/local_deep_research/database/sqlcipher_utils.py
@@ -161,7 +161,7 @@ def get_key_from_password(
password: str, db_path: Optional[Union[str, Path]] = None
) -> bytes:
"""
- Wrapper that gets salt and settings, then calls the cached key derivation.
+ Wrapper that gets salt and settings, then calls the key derivation.
Args:
password: The password.
diff --git a/src/local_deep_research/settings/logger.py b/src/local_deep_research/settings/logger.py
index 45f4db4efb..0f8845bfbd 100644
--- a/src/local_deep_research/settings/logger.py
+++ b/src/local_deep_research/settings/logger.py
@@ -6,7 +6,7 @@ Environment variable LDR_LOG_SETTINGS controls the verbosity:
- "none" or "false": No settings logging at all (default)
- "summary" or "info": Only log count and summary of settings
- "debug" or "full": Log complete settings (with sensitive keys redacted)
-- "debug_unsafe": REMOVED for security — maps to "none" with a deprecation warning
+- "debug_unsafe"/"unsafe"/"raw": REMOVED for security — maps to "none" with a deprecation warning
"""
import os
@@ -57,7 +57,7 @@ def log_settings(
- "none": No output
- "summary": Log count and basic info at INFO level
- "debug": Log full settings at DEBUG level (sensitive keys redacted)
- - "debug_unsafe": REMOVED — maps to "none" with a deprecation warning
+ - "debug_unsafe"/"unsafe"/"raw": REMOVED — maps to "none" with a deprecation warning
"""
log_level = force_level or SETTINGS_LOG_LEVEL
diff --git a/src/local_deep_research/web/auth/routes.py b/src/local_deep_research/web/auth/routes.py
index 290b97c071..2733b6a156 100644
--- a/src/local_deep_research/web/auth/routes.py
+++ b/src/local_deep_research/web/auth/routes.py
@@ -604,7 +604,7 @@ def change_password():
# is architecturally unnecessary.
# Clean up stale credentials before clearing session
- # (mirrors logout handler cleanup steps 1–4)
+ # (mirrors logout handler cleanup steps 1–5).
session_id = session.get("session_id")
# 1. Unregister from scheduler (removes stale credential)
@@ -623,6 +623,8 @@ def change_password():
)
# 2. Close database connection (disposes old-password engine)
+ # change_password() already closes in its finally block, but
+ # an explicit close here is defensive — harmless if redundant.
db_manager.close_user_database(username)
# 3. Destroy session record + clear password store
diff --git a/tests/settings/test_settings_logger.py b/tests/settings/test_settings_logger.py
index af80fb63ff..b921a316bd 100644
--- a/tests/settings/test_settings_logger.py
+++ b/tests/settings/test_settings_logger.py
@@ -379,11 +379,15 @@ class TestLogLevelMapping:
)
def test_log_level_mapping(self, env_value, expected):
"""Test that various env values map to correct log levels."""
+ import warnings
+
with patch.dict(os.environ, {"LDR_LOG_SETTINGS": env_value}):
import importlib
from local_deep_research.settings import logger as settings_logger
- importlib.reload(settings_logger)
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ importlib.reload(settings_logger)
result = settings_logger.get_settings_log_level()