~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: remove TESTING special cases from security code
LearningCircuit6bdf099f5710
diff --git a/src/local_deep_research/security/security_headers.py b/src/local_deep_research/security/security_headers.pyindex 7b5f556f9e..41811f4fc1 100644--- a/src/local_deep_research/security/security_headers.py+++ b/src/local_deep_research/security/security_headers.py@@ -173,22 +173,13 @@ class SecurityHeaders:# Referrer Policy - control referrer informationresponse.headers["Referrer-Policy"] = "strict-origin-when-cross-origin"- # HSTS - enforce HTTPS connections (only when using HTTPS)- # Don't set HSTS in testing unless explicitly HTTPS- # For real requests, only set if secure- is_testing = self.app.config.get("TESTING", False)- if is_testing:- # In testing, only set HSTS if wsgi.url_scheme was explicitly set to https- if request.environ.get("wsgi.url_scheme") == "https":- response.headers["Strict-Transport-Security"] = (- "max-age=31536000; includeSubDomains"- )- else:- # In production, set HSTS for all secure requests- if request.is_secure:- response.headers["Strict-Transport-Security"] = (- "max-age=31536000; includeSubDomains"- )+ # HSTS - enforce HTTPS connections (only when request is secure)+ # request.is_secure checks wsgi.url_scheme == 'https'+ # ProxyFix (configured in app_factory) handles X-Forwarded-Proto for reverse proxies+ if request.is_secure:+ response.headers["Strict-Transport-Security"] = (+ "max-age=31536000; includeSubDomains"+ )# Add CORS headers for API requests if enabledif self._is_api_route(request.path) and self.app.config.get(diff --git a/src/local_deep_research/web/app_factory.py b/src/local_deep_research/web/app_factory.pyindex f536b02170..c6d3c6cf9d 100644--- a/src/local_deep_research/web/app_factory.py+++ b/src/local_deep_research/web/app_factory.py@@ -119,11 +119,8 @@ def create_app():)app.config["SESSION_COOKIE_SAMESITE"] = "Lax" # CSRF protectionapp.config["PERMANENT_SESSION_LIFETIME"] = 7200 # 2 hours in seconds- # Only set PREFERRED_URL_SCHEME in production, not in testing- # This prevents test requests from incorrectly appearing as HTTPS- # Check both TESTING config and environment variable (set by pytest)- if not (app.config.get("TESTING", False) or os.environ.get("TESTING")):- app.config["PREFERRED_URL_SCHEME"] = "https"+ # PREFERRED_URL_SCHEME affects URL generation (url_for), not request.is_secure+ app.config["PREFERRED_URL_SCHEME"] = "https"# File upload security limits - calculated from FileUploadValidator constantsapp.config["MAX_CONTENT_LENGTH"] = (