~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): don't log the user's submitted path on a RAG path-validation failure (#4825)
LearningCircuit1cdd3a47b9ec
diff --git a/changelog.d/4825.security.md b/changelog.d/4825.security.mdnew file mode 100644index 0000000000..78ff0c32df--- /dev/null+++ b/changelog.d/4825.security.md@@ -0,0 +1 @@+**Local-folder RAG indexing no longer logs the path you submitted when it's rejected.** A failed path validation on the local-folder indexing endpoint logged the raw submitted path (which can contain a username); it now logs a generic "Path validation failed" message instead. The `Invalid path` response is unchanged.diff --git a/src/local_deep_research/research_library/routes/rag_routes.py b/src/local_deep_research/research_library/routes/rag_routes.pyindex bb9ecb3d1f..3aed5a4241 100644--- a/src/local_deep_research/research_library/routes/rag_routes.py+++ b/src/local_deep_research/research_library/routes/rag_routes.py@@ -1252,7 +1252,10 @@ def index_local_library():# Re-sanitize for static analyzer recognition (CodeQL)path = PathValidator.sanitize_for_filesystem_ops(validated_path)except ValueError:- logger.warning(f"Path validation failed for '{folder_path}'")+ # Don't log the raw user-submitted path — it can contain a username.+ # A static message keeps operator visibility without leaking the input+ # (project policy disallows exception variables in logger.warning).+ logger.warning("Path validation failed")return jsonify({"success": False, "error": "Invalid path"}), 400# Check path exists and is a directorydiff --git a/tests/research_library/routes/test_rag_routes_indexing.py b/tests/research_library/routes/test_rag_routes_indexing.pyindex 69cebd05f3..4d31fa1a18 100644--- a/tests/research_library/routes/test_rag_routes_indexing.py+++ b/tests/research_library/routes/test_rag_routes_indexing.py@@ -39,6 +39,42 @@ class TestIndexLocalLibrary:data = response.get_json()assert data["success"] is False+ @patch(+ "local_deep_research.research_library.routes.rag_routes.PathValidator"+ )+ def test_invalid_path_does_not_log_submitted_path(+ self, mock_validator, authenticated_client+ ):+ """On a path-validation failure the submitted path must not reach the+ logs (it can contain a username); only the generic reason is logged."""+ from loguru import logger++ mock_validator.validate_local_filesystem_path.side_effect = ValueError(+ "Cannot access system directories"+ )+ secret_path = "/home/alice-secret-9f3a/private"++ # The package disables loguru by default; enable it so the warning+ # emitted from the route reaches our sink.+ logger.enable("local_deep_research")+ logged: list[str] = []+ sink_id = logger.add(+ lambda m: logged.append(m.record["message"]), level="WARNING"+ )+ try:+ response = authenticated_client.get(+ f"{RAG_PREFIX}/api/rag/index-local?path={secret_path}"+ )+ finally:+ logger.remove(sink_id)+ logger.disable("local_deep_research")++ assert response.status_code == 400+ failed = [m for m in logged if "Path validation failed" in m]+ assert failed, "expected a path-validation-failure log"+ # the submitted path (which can contain a username) is never logged+ assert all("alice-secret-9f3a" not in m for m in failed)+@patch("local_deep_research.research_library.routes.rag_routes.PathValidator")