~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: address critical security issues in PDF upload
LearningCircuit10df4386e44b
diff --git a/src/local_deep_research/security/rate_limiter.py b/src/local_deep_research/security/rate_limiter.pyindex 1dfa7ae6c1..8bca80ee6d 100644--- a/src/local_deep_research/security/rate_limiter.py+++ b/src/local_deep_research/security/rate_limiter.py@@ -87,16 +87,31 @@ def upload_rate_limit(f):Returns:Decorated function with rate limiting++ Note:+ If the rate limiter is not initialized (e.g., flask_limiter not installed),+ this decorator will pass through without rate limiting. This is intentional+ to allow the application to run without optional dependencies, but rate+ limiting should be enabled in production environments."""- # Get the limiter and apply the decorator- # This will be called when the decorator is appliedtry:limiter = get_rate_limiter()# Use Flask-Limiter's limit decoratorreturn limiter.limit("10 per minute;100 per hour")(f)+ except RuntimeError:+ # Rate limiter not initialized - this is expected if flask_limiter+ # is not installed or init_rate_limiter was not called+ logger.warning(+ f"Rate limiting disabled for {f.__name__}: "+ "limiter not initialized. Install flask_limiter for rate limiting."+ )+ return fexcept Exception:- logger.exception("Rate limiter initialization error")- # If limiter fails to initialize, return undecorated function+ # Unexpected error - log it but don't break the application+ logger.exception(+ f"Unexpected error applying rate limit to {f.__name__}. "+ "Rate limiting disabled for this endpoint."+ )return fdiff --git a/src/local_deep_research/web/app_factory.py b/src/local_deep_research/web/app_factory.pyindex a6fc98a09b..a01c3e93ff 100644--- a/src/local_deep_research/web/app_factory.py+++ b/src/local_deep_research/web/app_factory.py@@ -93,6 +93,10 @@ def create_app():app.config["PERMANENT_SESSION_LIFETIME"] = 7200 # 2 hours in secondsapp.config["PREFERRED_URL_SCHEME"] = "https"+ # File upload security limits+ # 100 files * 10MB = 1GB max total request size+ app.config["MAX_CONTENT_LENGTH"] = 100 * 10 * 1024 * 1024 # 1GB max request+# Initialize CSRF protectionCSRFProtect(app)# Exempt Socket.IO from CSRF protectiondiff --git a/src/local_deep_research/web/routes/research_routes.py b/src/local_deep_research/web/routes/research_routes.pyindex f807f09980..9f7d1ee2b7 100644--- a/src/local_deep_research/web/routes/research_routes.py+++ b/src/local_deep_research/web/routes/research_routes.py@@ -1515,6 +1515,14 @@ def upload_pdf():return jsonify({"error": "Not authenticated"}), 401try:+ # Early request size validation (before reading any files)+ # This prevents memory exhaustion from chunked encoding attacks+ max_request_size = 100 * 10 * 1024 * 1024 # 1GB (100 files * 10MB)+ if request.content_length and request.content_length > max_request_size:+ return jsonify({+ "error": f"Request too large. Maximum size is {max_request_size // (1024*1024)}MB"+ }), 413+# Check if files are present in the requestif "files" not in request.files:return jsonify({"error": "No files provided"}), 400