~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(security): force diagnose=False on the file sink too (#4182) (#4568)
LearningCircuit33f410ed3d85
diff --git a/changelog.d/+file-sink-diagnose-off.security.md b/changelog.d/+file-sink-diagnose-off.security.mdnew file mode 100644index 0000000000..ec21a9973d--- /dev/null+++ b/changelog.d/+file-sink-diagnose-off.security.md@@ -0,0 +1 @@+Completed the #4182 logging chokepoint: the optional file sink (`LDR_ENABLE_FILE_LOGGING`) now also runs with `diagnose=False`, matching the database and frontend sinks. Previously it still honored `LDR_LOGURU_DIAGNOSE`, so an operator with debug + diagnose + file logging all enabled could persist frame-local credentials (including the unrecoverable SQLCipher master password — TRUST.md §5) into an unencrypted log file. Frame-local exception dumps now render only to the ephemeral stderr sink; no persisted or shipped sink (DB, browser, file) ever renders them. See #4182.diff --git a/src/local_deep_research/utilities/log_utils.py b/src/local_deep_research/utilities/log_utils.pyindex 76519ee03e..061b235be3 100644--- a/src/local_deep_research/utilities/log_utils.py+++ b/src/local_deep_research/utilities/log_utils.py@@ -598,7 +598,12 @@ def config_logger(name: str, debug: bool = False) -> None:rotation="10 MB",retention="7 days",compression="zip",- diagnose=diagnose,+ # diagnose=False: the file sink is persistent and unencrypted,+ # so — like the DB and frontend sinks — it must never render+ # frame-local credentials, even under LDR_LOGURU_DIAGNOSE.+ # Frame-local dumps go only to the ephemeral stderr sink, which+ # is what the policy comment above describes (#4182).+ diagnose=False,)logger.warning(f"File logging enabled - logs will be written to {log_file}. "diff --git a/tests/utilities/test_log_utils_extended.py b/tests/utilities/test_log_utils_extended.pyindex f0737ef7d0..24bb76e26e 100644--- a/tests/utilities/test_log_utils_extended.py+++ b/tests/utilities/test_log_utils_extended.py@@ -617,18 +617,18 @@ class TestConfigLoggerExtended:assert by_sink[module.database_sink] is Falseassert by_sink[module.frontend_progress_sink] is False- def test_diagnose_propagates_to_file_sink(self):- """File sink follows the diagnose opt-in like the local stderr sink.-- Regression guard: with LDR_ENABLE_FILE_LOGGING=true the file sink is the- 4th logger.add() call. When the opt-in is off it must be diagnose=False;- when on it tracks the opt-in (it is a local operator-enabled sink). The- persisted DB sink and the browser-facing frontend sink are forced- diagnose=False in both cases (#4182).+ def test_file_sink_never_gets_diagnose(self):+ """The file sink must never render frame locals — it is persistent+ and unencrypted, so (like the DB and frontend sinks) it is forced+ diagnose=False regardless of the opt-in. Only the ephemeral stderr+ sink ever honors LDR_LOGURU_DIAGNOSE (#4182)."""+ import sys+ from pathlib import Pathfrom local_deep_research.utilities.log_utils import config_loggerimport local_deep_research.utilities.log_utils as module+ # Opt-in OFF: every sink is diagnose=False.with patch.dict(os.environ,{"LDR_ENABLE_FILE_LOGGING": "true", "LDR_LOGURU_DIAGNOSE": ""},@@ -640,6 +640,8 @@ class TestConfigLoggerExtended:for add_call in mock_logger.add.call_args_list:assert add_call[1].get("diagnose") is False+ # Opt-in ON: only stderr renders frame locals; DB, frontend, AND+ # the file sink stay diagnose=False.with patch.dict(os.environ,{"LDR_ENABLE_FILE_LOGGING": "true", "LDR_LOGURU_DIAGNOSE": "true"},@@ -648,23 +650,17 @@ class TestConfigLoggerExtended:config_logger("test_app", debug=True)assert mock_logger.add.call_count == 4- import sys- from pathlib import Path-by_sink = {c.args[0]: c.kwargs.get("diagnose")for c in mock_logger.add.call_args_list}- # stderr and the file sink honor the opt-in; the persisted- # DB sink and browser-facing frontend sink never do.- # Keyed by sink identity (not call order) for robustness.assert by_sink[sys.stderr] is Trueassert by_sink[module.database_sink] is Falseassert by_sink[module.frontend_progress_sink] is Falsefile_diagnose = [d for s, d in by_sink.items() if isinstance(s, Path)]- assert file_diagnose == [True]+ assert file_diagnose == [False]def test_diagnose_off_when_debug_without_optin(self):"""debug=True alone must NOT enable diagnose (localvar leak, issue #4185).