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: resolve 5 Bearer P0 SAST security alerts (#1934)

LearningCircuit6c2ff2bdda51
diff --git a/cookiecutter-docker/hooks/pre_prompt.py b/cookiecutter-docker/hooks/pre_prompt.py
index 6c4e53fdf8..8c1f39c377 100644
--- a/cookiecutter-docker/hooks/pre_prompt.py
+++ b/cookiecutter-docker/hooks/pre_prompt.py
@@ -6,11 +6,6 @@ from typing import Any, Dict
import cookiecutter.prompt
-def run_command(command: str):
- result = subprocess.run(command, shell=True, capture_output=True, text=True)
- return result.stdout.strip()
-
-
def config_ollama(context: Dict[str, Any]) -> None:
"""
Prompts the user for questions that are specific to Ollama. It is in a hook
@@ -37,7 +32,11 @@ def check_gpu_linux(context: Dict[str, Any]) -> None:
context: The context dictionary to update with GPU information.
"""
- gpu_info = run_command("lspci | grep -i 'vga'")
+ result = subprocess.run(["lspci"], capture_output=True, text=True)
+ vga_lines = [
+ line for line in result.stdout.splitlines() if "vga" in line.lower()
+ ]
+ gpu_info = "\n".join(vga_lines)
if "NVIDIA" in gpu_info:
print("Detected an Nvidia GPU.")
@@ -64,7 +63,12 @@ def check_gpu_windows(context: Dict[str, Any]) -> None:
context: The context dictionary to update with GPU information.
"""
- gpu_info = run_command("wmic path win32_VideoController get name")
+ result = subprocess.run(
+ ["wmic", "path", "win32_VideoController", "get", "name"],
+ capture_output=True,
+ text=True,
+ )
+ gpu_info = result.stdout.strip()
if "NVIDIA" in gpu_info.upper():
print("Detected an Nvidia GPU.")
diff --git a/src/local_deep_research/news/subscription_manager/storage.py b/src/local_deep_research/news/subscription_manager/storage.py
index 211c4969ac..98921864a0 100644
--- a/src/local_deep_research/news/subscription_manager/storage.py
+++ b/src/local_deep_research/news/subscription_manager/storage.py
@@ -147,6 +147,7 @@ class SQLSubscriptionStorage(SubscriptionStorage):
]
for field in updateable_fields:
if field in data:
+ # bearer:disable python_lang_code_injection
setattr(subscription, field, data[field])
# Recalculate next refresh if interval changed
diff --git a/src/local_deep_research/research_library/utils/__init__.py b/src/local_deep_research/research_library/utils/__init__.py
index b2af2858bf..08fd16c5f2 100644
--- a/src/local_deep_research/research_library/utils/__init__.py
+++ b/src/local_deep_research/research_library/utils/__init__.py
@@ -10,6 +10,7 @@ from flask import jsonify
from loguru import logger
from ...config.paths import get_library_directory
+from ...security.path_validator import PathValidator
def get_url_hash(url: str) -> str:
@@ -78,7 +79,9 @@ def open_file_location(file_path: str) -> bool:
True if successful, False otherwise
"""
try:
- folder = str(Path(file_path).parent)
+ # Validate path is safe (blocks system dirs, path traversal)
+ validated = PathValidator.validate_local_filesystem_path(file_path)
+ folder = str(validated.parent)
if sys.platform == "win32":
os.startfile(folder)
elif sys.platform == "darwin": # macOS
diff --git a/src/local_deep_research/security/module_whitelist.py b/src/local_deep_research/security/module_whitelist.py
index 10765f73f4..fb2ac96af1 100644
--- a/src/local_deep_research/security/module_whitelist.py
+++ b/src/local_deep_research/security/module_whitelist.py
@@ -216,6 +216,7 @@ def get_safe_module_class(
# Import the module
try:
+ # bearer:disable python_lang_code_injection
module = importlib.import_module(module_path, package=package)
except ModuleNotFoundError:
logger.exception(f"Failed to import whitelisted module {module_path}")