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: stricter production detection in SafeLogger

LearningCircuite80a709058de
diff --git a/src/local_deep_research/web/static/js/security/safe-logger.js b/src/local_deep_research/web/static/js/security/safe-logger.js
index 4f7469d826..fdd3d4b90e 100644
--- a/src/local_deep_research/web/static/js/security/safe-logger.js
+++ b/src/local_deep_research/web/static/js/security/safe-logger.js
@@ -6,10 +6,10 @@
* through client-side logs.
*
* SECURITY MODEL:
- * - Development Mode (localhost, 127.0.0.1, .local, .dev, non-standard ports):
+ * - Development Mode (localhost, 127.0.0.1, .local TLD, file: protocol):
* Full logging with all dynamic data visible for debugging
*
- * - Production Mode (https, real domain, standard ports):
+ * - Production Mode (everything else - safe default):
* Only static message strings are logged; all dynamic data is redacted
* This protects user search queries, API responses, tokens, and other
* potentially sensitive information from being exposed in logs.
@@ -31,41 +31,31 @@
/**
* Detect if running in production mode
* Production is assumed for any environment that doesn't match
- * known development indicators.
+ * known development indicators. We use a strict allowlist to avoid
+ * accidentally treating production as development.
*
* @returns {boolean} True if in production mode
*/
function isProductionEnvironment() {
const hostname = window.location.hostname.toLowerCase();
- const port = window.location.port;
- const protocol = window.location.protocol;
- // Development indicators - localhost and loopback
+ // Only explicit localhost indicators are development
if (hostname === 'localhost' || hostname === '127.0.0.1') {
return false;
}
- // Development TLDs
- if (hostname.endsWith('.local') || hostname.endsWith('.dev')) {
+ // .local TLD is reserved for local network (mDNS/Bonjour)
+ if (hostname.endsWith('.local')) {
return false;
}
- // Common development/staging indicators in hostname
- if (hostname.includes('staging') || hostname.includes('test')) {
+ // File protocol is local development
+ if (window.location.protocol === 'file:') {
return false;
}
- // Non-standard ports typically indicate development
- if (port && !['80', '443', ''].includes(port)) {
- return false;
- }
-
- // File protocol is development
- if (protocol === 'file:') {
- return false;
- }
-
- // Default to production for safety
+ // Everything else: assume production (safe default)
+ // This includes non-standard ports, staging servers, etc.
return true;
}