~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: Improve path traversal fix using os.path.commonpath
LearningCircuitce8297fc12ad
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.pyindex 5c98c34c68..231989d769 100644--- a/src/local_deep_research/config/llm_config.py+++ b/src/local_deep_research/config/llm_config.py@@ -160,8 +160,10 @@ def is_llamacpp_available(settings_snapshot=None):# Sanitize and validate the path to prevent path traversaltry:- # Resolve to absolute path- model_path = os.path.abspath(os.path.expanduser(model_path))+ # Resolve to absolute, normalized path+ model_path = os.path.normpath(+ os.path.abspath(os.path.expanduser(model_path))+ )# Get allowed base directories for modelsdata_dir = str(get_data_directory())@@ -170,16 +172,24 @@ def is_llamacpp_available(settings_snapshot=None):# Check if the path is within allowed directories# Models can be in data directory, home directory, or /usr/localallowed_prefixes = [- os.path.abspath(data_dir),- os.path.abspath(home_dir),- "/usr/local",- "/opt",+ os.path.normpath(os.path.abspath(data_dir)),+ os.path.normpath(os.path.abspath(home_dir)),+ os.path.normpath("/usr/local"),+ os.path.normpath("/opt"),]- # Verify the path is within an allowed directory- is_allowed = any(- model_path.startswith(prefix) for prefix in allowed_prefixes- )+ # Verify the path is within an allowed directory using os.path.commonpath+ is_allowed = False+ for prefix in allowed_prefixes:+ try:+ # commonpath returns the longest common sub-path+ common = os.path.commonpath([model_path, prefix])+ if common == prefix:+ is_allowed = True+ break+ except ValueError:+ # Raised if paths are on different drives (Windows)+ continueif not is_allowed:logger.warning(