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.

security: fix notification SSRF bypass via user-writable setting (#3143)

LearningCircuit07a0b5003895
diff --git a/src/local_deep_research/notifications/manager.py b/src/local_deep_research/notifications/manager.py
index 79e4ec1020..75365b6006 100644
--- a/src/local_deep_research/notifications/manager.py
+++ b/src/local_deep_research/notifications/manager.py
@@ -9,6 +9,7 @@ import threading
from loguru import logger
+from ..settings.env_registry import get_env_setting
from .service import NotificationService
from .templates import EventType
from .exceptions import RateLimitError
@@ -82,10 +83,15 @@ class NotificationManager:
self._settings_snapshot = settings_snapshot
self._user_id = user_id
- # Get security settings for notification service
- # Default to False for security - only enable for development/testing
- allow_private_ips = self._get_setting(
- "notifications.allow_private_ips", default=False
+ # Security: read from server-side environment variable only — never from
+ # user-writable DB settings. Previously this was read via
+ # _get_setting("notifications.allow_private_ips"), which allowed any
+ # user to bypass SSRF protection through the settings API.
+ # Registered as env-only in settings/env_definitions/security.py
+ # so SettingsManager will always read LDR_NOTIFICATIONS_ALLOW_PRIVATE_IPS
+ # from the environment, never from the database.
+ allow_private_ips = get_env_setting(
+ "notifications.allow_private_ips", False
)
self.service = NotificationService(allow_private_ips=allow_private_ips)
diff --git a/src/local_deep_research/settings/env_definitions/security.py b/src/local_deep_research/settings/env_definitions/security.py
index 0bc6ec9c90..701bff3bde 100644
--- a/src/local_deep_research/settings/env_definitions/security.py
+++ b/src/local_deep_research/settings/env_definitions/security.py
@@ -6,7 +6,7 @@ and CORS origin restrictions.
"""
import os
-from ..env_settings import StringSetting
+from ..env_settings import BooleanSetting, StringSetting
# External environment variables (set by pytest, CI systems)
@@ -34,4 +34,13 @@ SECURITY_SETTINGS = [
),
default=None,
),
+ BooleanSetting(
+ key="notifications.allow_private_ips",
+ description=(
+ "Allow notification webhooks to target private/local IP addresses. "
+ "Environment-only to prevent SSRF bypass via the user-writable settings API. "
+ "Only enable this if your notification endpoints are on a trusted local network."
+ ),
+ default=False,
+ ),
]