~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
security: escape HTML in PDF pipeline title and metadata (#3082)
LearningCircuit0148fa265a3d
diff --git a/src/local_deep_research/web/services/pdf_service.py b/src/local_deep_research/web/services/pdf_service.pyindex 6ec68301c6..309c7be955 100644--- a/src/local_deep_research/web/services/pdf_service.py+++ b/src/local_deep_research/web/services/pdf_service.py@@ -10,6 +10,7 @@ production Flask applications due to:"""import io+from html import escapefrom typing import Optional, Dict, Anyimport markdown # type: ignore[import-untyped]from weasyprint import HTML, CSS@@ -169,11 +170,13 @@ class PDFService:html_parts.append('<meta charset="utf-8">')if title:- html_parts.append(f"<title>{title}</title>")+ html_parts.append(f"<title>{escape(title)}</title>")if metadata:for key, value in metadata.items():- html_parts.append(f'<meta name="{key}" content="{value}">')+ html_parts.append(+ f'<meta name="{escape(str(key))}" content="{escape(str(value))}">'+ )html_parts.append("</head><body>")diff --git a/tests/web/services/test_pdf_service.py b/tests/web/services/test_pdf_service.pyindex cf2e9c6c8f..a77ad35feb 100644--- a/tests/web/services/test_pdf_service.py+++ b/tests/web/services/test_pdf_service.py@@ -63,6 +63,32 @@ class TestMarkdownToHTML:assert "<title>Test Title</title>" in html+ def test_markdown_to_html_escapes_html_in_title(self):+ """Test that HTML special characters in title are escaped."""+ from local_deep_research.web.services.pdf_service import PDFService++ service = PDFService()++ html = service._markdown_to_html(+ "content", title='<script>alert("xss")</script>'+ )++ assert "<script>" not in html+ assert "<script>" in html++ def test_markdown_to_html_escapes_html_in_metadata(self):+ """Test that HTML special characters in metadata are escaped."""+ from local_deep_research.web.services.pdf_service import PDFService++ service = PDFService()+ metadata = {"<b>key</b>": '<img src="x" onerror="alert(1)">'}++ html = service._markdown_to_html("content", metadata=metadata)++ assert "<b>key</b>" not in html+ assert "<b>key</b>" in html+ assert 'onerror="alert(1)"' not in html+def test_markdown_to_html_with_metadata(self):"""Test conversion with metadata."""from local_deep_research.web.services.pdf_service import PDFService