~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 OWASP ZAP security warnings for Server header and Content-Type
LearningCircuit0267170e0d14
diff --git a/src/local_deep_research/web/app_factory.py b/src/local_deep_research/web/app_factory.pyindex 2e36171fed..bc3d18cee7 100644--- a/src/local_deep_research/web/app_factory.py+++ b/src/local_deep_research/web/app_factory.py@@ -193,6 +193,32 @@ def create_app():# Wrap the app with our cookie security middlewareapp.wsgi_app = SecureCookieMiddleware(app.wsgi_app, app)+ # WSGI middleware to remove Server header+ # This must be the outermost wrapper to catch headers added by Werkzeug+ class ServerHeaderMiddleware:+ """WSGI middleware to remove Server header from all responses.++ Prevents information disclosure about the underlying web server.+ Must be outermost middleware to catch headers added by WSGI layer.+ """++ def __init__(self, wsgi_app):+ self.wsgi_app = wsgi_app++ def __call__(self, environ, start_response):+ def custom_start_response(status, headers, exc_info=None):+ filtered_headers = [+ (name, value)+ for name, value in headers+ if name.lower() != "server"+ ]+ return start_response(status, filtered_headers, exc_info)++ return self.wsgi_app(environ, custom_start_response)++ # Apply ServerHeaderMiddleware as outermost wrapper+ app.wsgi_app = ServerHeaderMiddleware(app.wsgi_app)+# App configuration# Generate or load a unique SECRET_KEY per installationimport secretsdiff --git a/tests/security/test_security_headers.py b/tests/security/test_security_headers.pyindex 3db3ec941f..4312cdfcb5 100644--- a/tests/security/test_security_headers.py+++ b/tests/security/test_security_headers.py@@ -433,3 +433,46 @@ class TestIsApiRoute:assert SecurityHeaders._is_api_route("/") is Falseassert SecurityHeaders._is_api_route("/dashboard") is Falseassert SecurityHeaders._is_api_route("/static/js/app.js") is False+++class TestServerHeaderRemoval:+ """Test that Server header is removed from responses."""++ def test_server_header_not_present(self, client):+ """Server header should not leak version information."""+ response = client.get("/")+ assert "Server" not in response.headers++ def test_server_header_not_present_on_api(self, client):+ """Server header should not be present on API responses."""+ response = client.get("/api/health")+ assert "Server" not in response.headers++ def test_server_header_not_present_on_login(self, client):+ """Server header should not be present on login page."""+ response = client.get("/auth/login")+ assert "Server" not in response.headers+++class TestContentTypeHeaders:+ """Test Content-Type headers are properly set for HTML routes."""++ def test_login_page_has_html_content_type(self, client):+ """Login page should have proper Content-Type."""+ response = client.get("/auth/login")+ content_type = response.headers.get("Content-Type", "")+ assert "text/html" in content_type++ def test_root_page_has_html_content_type(self, client):+ """Root page should have proper Content-Type when redirecting."""+ response = client.get("/")+ # Either redirect (302) or HTML response (200)+ if response.status_code == 200:+ content_type = response.headers.get("Content-Type", "")+ assert "text/html" in content_type++ def test_api_endpoint_has_json_content_type(self, client):+ """API endpoints should have proper Content-Type."""+ response = client.get("/api/health")+ content_type = response.headers.get("Content-Type", "")+ assert "application/json" in content_type