~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: post-release-audit hardening for chat send_message and news time-ago (#4369)
LearningCircuit3dadd5cd17b7
diff --git a/changelog.d/+chat-send-message-require-json-body.bugfix.md b/changelog.d/+chat-send-message-require-json-body.bugfix.mdnew file mode 100644index 0000000000..0b2fe540b7--- /dev/null+++ b/changelog.d/+chat-send-message-require-json-body.bugfix.md@@ -0,0 +1 @@+The chat ``send_message`` endpoint now uses the shared ``@require_json_body`` decorator like the other state-changing chat POSTs. It was the only one validating the body inline, so a non-JSON content type slipped past the consistent 400 contract; requiring an ``application/json`` body also hardens CSRF on the heaviest chat endpoint (it launches a research run). Behavior for valid requests is unchanged.diff --git a/changelog.d/+news-time-ago-null-timestamp.bugfix.md b/changelog.d/+news-time-ago-null-timestamp.bugfix.mdnew file mode 100644index 0000000000..542e3e80af--- /dev/null+++ b/changelog.d/+news-time-ago-null-timestamp.bugfix.md@@ -0,0 +1 @@+News feed time-ago formatting no longer logs a full traceback for every item with a missing timestamp. ``_format_time_ago`` now returns a neutral "Recently" label for empty/``None`` values up front, and downgrades genuinely unparseable timestamps to a single warning line, so a feed of legacy rows can't bury real errors in the log.diff --git a/src/local_deep_research/chat/routes.py b/src/local_deep_research/chat/routes.pyindex 84c93e96c3..e63a577adc 100644--- a/src/local_deep_research/chat/routes.py+++ b/src/local_deep_research/chat/routes.py@@ -718,6 +718,10 @@ def get_messages(session_id):# run, so this is the heaviest chat endpoint; shared-IP users sharing the# bucket would lock each other out.@limiter.limit("10 per minute", key_func=_get_api_user_key)+@require_json_body(+ error_format="success",+ error_message="Request body must be a JSON object",+)def send_message(session_id):"""Send a message in a chat session.@@ -746,19 +750,11 @@ def send_message(session_id):"""try:username = session.get("username")+ # @require_json_body has already guaranteed a dict body and rejected+ # non-JSON content types (which also hardens CSRF, matching the other+ # state-changing chat POSTs). Flask caches the parse, so this is free.data = request.get_json(silent=True)- # Reject non-object JSON bodies (e.g. arrays, scalars) cleanly with- # 400 — otherwise data.get(...) below would raise AttributeError and- # produce a 500 on input the client provided.- if data is not None and not isinstance(data, dict):- return jsonify(- {- "success": False,- "error": "Request body must be a JSON object",- }- ), 400-if not data or not data.get("content"):return jsonify({diff --git a/src/local_deep_research/news/api.py b/src/local_deep_research/news/api.pyindex dfb346a1d6..5e68f01814 100644--- a/src/local_deep_research/news/api.py+++ b/src/local_deep_research/news/api.py@@ -588,9 +588,14 @@ def get_subscription_history(def _format_time_ago(timestamp: str) -> str:"""Format timestamp as 'X hours ago' string."""+ # ResearchHistory.created_at can be empty/None on legacy rows. A missing+ # timestamp isn't an error worth a full traceback per news item — return a+ # neutral label instead of letting parser.parse(None) raise into the+ # except below (which logged a stack trace for every such row).+ if not timestamp:+ return "Recently"try:from dateutil import parser- from loguru import loggerdt = parser.parse(timestamp)@@ -611,7 +616,9 @@ def _format_time_ago(timestamp: str) -> str:return f"{minutes} minute{'s' if minutes > 1 else ''} ago"return "Just now"except Exception:- logger.exception(f"Error parsing timestamp '{timestamp}'")+ # Unparseable but non-empty value — note it without a traceback so a+ # feed full of bad timestamps can't bury real errors in the log.+ logger.warning(f"Could not parse news timestamp '{timestamp}'")return "Recently"