~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
refactor(security): log notification URL-parse failure at WARNING + real-input test (follow-up to #4835) (#4838)
LearningCircuit0fde4ce088ee
diff --git a/src/local_deep_research/security/notification_validator.py b/src/local_deep_research/security/notification_validator.pyindex 219850c811..6dfa175e4c 100644--- a/src/local_deep_research/security/notification_validator.py+++ b/src/local_deep_research/security/notification_validator.py@@ -279,12 +279,14 @@ class NotificationURLValidator:try:parsed = urlparse(url)except Exception:- # Log the parser exception (with traceback) server-side for- # debugging, but never echo it back to the caller: this error+ # Never echo the parser exception back to the caller: this error# string is surfaced to the user by the test-URL endpoint, and the# exception text can carry parser internals / stack-trace fragments- # (CWE-209, py/stack-trace-exposure).- logger.exception("Failed to parse service URL")+ # (CWE-209, py/stack-trace-exposure). Log at WARNING without a+ # traceback to match the sibling LocationParseError handler below+ # — a malformed URL is benign user input, not a server fault, so an+ # ERROR-level stack trace would only add noise.+ logger.warning("Failed to parse service URL")return False, "Invalid URL format"# Check for schemediff --git a/tests/security/test_notification_validator.py b/tests/security/test_notification_validator.pyindex 649e94c02e..66ac7161ed 100644--- a/tests/security/test_notification_validator.py+++ b/tests/security/test_notification_validator.py@@ -160,6 +160,18 @@ class TestValidateServiceUrl:assert secret_marker not in errorassert error == "Invalid URL format"+ def test_parse_error_real_input_does_not_leak(self):+ """Real-input companion to the mocked test: an unbalanced IPv6+ bracket makes the stdlib urlparse raise ``ValueError: Invalid IPv6+ URL``, which must surface as the generic message. Guards the reachable+ path against a refactor that stops calling urlparse (or a future+ CPython that stops raising) — something the mocked test cannot catch."""+ is_valid, error = NotificationURLValidator.validate_service_url(+ "http://[::1"+ )+ assert is_valid is False+ assert error == "Invalid URL format"+def test_file_scheme_blocked(self):"""Should block file:// scheme."""is_valid, error = NotificationURLValidator.validate_service_url(diff --git a/tests/web/routes/test_settings_routes_gaps_coverage.py b/tests/web/routes/test_settings_routes_gaps_coverage.pyindex 584fa82e9c..7db15f4268 100644--- a/tests/web/routes/test_settings_routes_gaps_coverage.py+++ b/tests/web/routes/test_settings_routes_gaps_coverage.py@@ -686,6 +686,42 @@ class TestApiTestNotificationUrl:)assert resp.status_code == 400+ def test_service_exception_text_is_not_leaked_to_client(self):+ """Response boundary must stay generic when test_service raises.++ SendError carries the underlying exception text (service.py+ ``raise SendError(f"Failed to send notification: {str(e)}")``). It is+ not reachable by this endpoint today, but this guards the response+ boundary — the right layer for CWE-209 defence — so that if anything+ in the test-URL flow ever raises with sensitive detail, the endpoint's+ ``except`` keeps returning a generic message instead of echoing it.+ Fails if someone changes the handler to surface ``str(e)``."""+ from local_deep_research.notifications.exceptions import SendError++ secret = "SMTP-PASSWORD-do-not-leak-12345"+ app = _create_test_app()+ mock_svc = Mock()+ mock_svc.test_service.side_effect = SendError(+ f"Failed to send notification: {secret}"+ )++ with _authenticated_client(app) as client:+ with patch(+ "local_deep_research.notifications.service.NotificationService",+ return_value=mock_svc,+ ):+ resp = client.post(+ "/settings/api/notifications/test-url",+ json={"service_url": "ntfy://topic"},+ content_type="application/json",+ )++ assert resp.status_code == 500+ assert secret not in resp.get_data(as_text=True)+ data = resp.get_json()+ assert data["success"] is False+ assert secret not in data["error"]+# ===========================================================================# api_get_available_models — cache path