Skip to content

~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.

fix: Further harden path traversal protection

LearningCircuit8874fce7004e
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.py
index 231989d769..dc59368ffb 100644
--- a/src/local_deep_research/config/llm_config.py
+++ b/src/local_deep_research/config/llm_config.py
@@ -150,6 +150,7 @@ def is_llamacpp_available(settings_snapshot=None):
try:
from langchain_community.llms import LlamaCpp # noqa: F401
from .paths import get_data_directory
+ import stat
model_path = get_setting_from_snapshot(
"llm.llamacpp_model_path", settings_snapshot=settings_snapshot
@@ -197,7 +198,16 @@ def is_llamacpp_available(settings_snapshot=None):
)
return False
- return os.path.exists(model_path) and os.path.isfile(model_path)
+ # After validation, safely check if the file exists
+ # Use try-except to handle any filesystem access issues
+ try:
+ # Use os.stat instead of exists/isfile for better security
+ stat_info = os.stat(model_path)
+ # Verify it's a regular file, not a directory or special file
+ return stat.S_ISREG(stat_info.st_mode)
+ except (OSError, IOError):
+ # File doesn't exist or isn't accessible
+ return False
except (OSError, ValueError) as e:
logger.debug(f"Invalid model path: {e}")
return False