~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): log folder/file basenames (not full paths) in RAG local indexing (#4831)
LearningCircuitd24c79df1f0d
diff --git a/changelog.d/4831.security.md b/changelog.d/4831.security.mdnew file mode 100644index 0000000000..772d279622--- /dev/null+++ b/changelog.d/4831.security.md@@ -0,0 +1 @@+**Local-folder RAG indexing logs the folder/file name instead of the full path.** The "indexing complete" log and the per-file indexing-error log now record only the folder/file basename rather than the full filesystem path (which can contain a username), while keeping the same diagnostic detail.diff --git a/src/local_deep_research/research_library/routes/rag_routes.py b/src/local_deep_research/research_library/routes/rag_routes.pyindex 3aed5a4241..6fb09d672f 100644--- a/src/local_deep_research/research_library/routes/rag_routes.py+++ b/src/local_deep_research/research_library/routes/rag_routes.py@@ -1325,13 +1325,16 @@ def index_local_library():results["errors"].append({"file": file_name, "error": "Failed to index file"})- logger.exception(f"Error indexing file {file_path}")+ # Log the file name only — the full path can contain a+ # username.+ logger.exception(f"Error indexing file {file_name}")# Send completion statusyield f"data: {json.dumps({'type': 'complete', 'results': results})}\n\n"+ # Log the folder name only — the full path can contain a username.logger.info(- f"Local library indexing complete for {path}: "+ f"Local library indexing complete for {path.name}: "f"{results['successful']} successful, "f"{results['skipped']} skipped, "f"{results['failed']} failed"diff --git a/tests/research_library/routes/test_rag_routes_indexing.py b/tests/research_library/routes/test_rag_routes_indexing.pyindex 4d31fa1a18..b613544e37 100644--- a/tests/research_library/routes/test_rag_routes_indexing.py+++ b/tests/research_library/routes/test_rag_routes_indexing.py@@ -75,6 +75,63 @@ class TestIndexLocalLibrary:# the submitted path (which can contain a username) is never loggedassert all("alice-secret-9f3a" not in m for m in failed)+ def test_indexing_complete_log_uses_folder_basename(+ self, authenticated_client, loguru_caplog_full, tmp_path+ ):+ """The success "indexing complete" log names the folder by basename,+ never the full path (which can contain a username)."""+ folder = tmp_path / "alice-secret-9f3a" / "mydocs"+ folder.mkdir(parents=True)+ (folder / "report.txt").write_text("hello", encoding="utf-8")++ rag_service = MagicMock()+ rag_service.index_local_file.return_value = {"status": "success"}++ with (+ loguru_caplog_full.at_level("DEBUG"),+ patch(+ "local_deep_research.research_library.routes.rag_routes.get_rag_service",+ return_value=rag_service,+ ),+ ):+ response = authenticated_client.get(+ f"{RAG_PREFIX}/api/rag/index-local?path={folder}&recursive=false"+ )+ response.get_data() # drive the SSE generator++ assert response.status_code == 200+ text = loguru_caplog_full.text+ assert "alice-secret-9f3a" not in text+ assert "indexing complete for mydocs" in text++ def test_indexing_error_log_uses_file_basename(+ self, authenticated_client, loguru_caplog_full, tmp_path+ ):+ """A per-file indexing error logs the file's basename, never its full+ path (the exception block is captured too via loguru_caplog_full)."""+ folder = tmp_path / "bob-secret-1c2d" / "papers"+ folder.mkdir(parents=True)+ (folder / "thesis.txt").write_text("x", encoding="utf-8")++ rag_service = MagicMock()+ rag_service.index_local_file.side_effect = RuntimeError("boom")++ with (+ loguru_caplog_full.at_level("DEBUG"),+ patch(+ "local_deep_research.research_library.routes.rag_routes.get_rag_service",+ return_value=rag_service,+ ),+ ):+ response = authenticated_client.get(+ f"{RAG_PREFIX}/api/rag/index-local?path={folder}&recursive=false"+ )+ response.get_data()++ text = loguru_caplog_full.text+ assert "bob-secret-1c2d" not in text+ assert "Error indexing file thesis.txt" in text+@patch("local_deep_research.research_library.routes.rag_routes.PathValidator")