Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(security): sanitize error context before Socket.IO broadcasts
Adam Eivyc24e9cdd5841
diff --git a/server/lib/errorHandler.js b/server/lib/errorHandler.jsindex 9698ae6edf..ed608ff7a8 100644--- a/server/lib/errorHandler.js+++ b/server/lib/errorHandler.js@@ -103,12 +103,29 @@ function getErrorCode(status) {return codeMap[status] || 'INTERNAL_ERROR';}+/**+ * Strip sensitive fields from error context before broadcasting to clients.+ * Full context is still available in server-side console logs.+ */+function sanitizeContext(context) {+ if (!context || typeof context !== 'object') return context;+ const sensitive = ['apiKey', 'token', 'secret', 'password', 'credential', 'authorization', 'bearer', 'envVars', 'secretEnvVars'];+ const sanitized = {};+ for (const [key, value] of Object.entries(context)) {+ if (sensitive.some(s => key.toLowerCase().includes(s))) continue;+ sanitized[key] = value;+ }+ return sanitized;+}+/*** Emit error event via Socket.IO to alert UI*/export function emitErrorEvent(io, error) {errorEvents.emit('error', error);+ const safeContext = sanitizeContext(error.context);+// Broadcast to all connected clientsio.emit('error:occurred', {message: error.message,@@ -116,7 +133,7 @@ export function emitErrorEvent(io, error) {status: error.status,severity: error.severity,timestamp: error.timestamp,- context: error.context,+ context: safeContext,canAutoFix: error.canAutoFix});@@ -126,7 +143,7 @@ export function emitErrorEvent(io, error) {message: error.message,code: error.code,timestamp: error.timestamp,- context: error.context+ context: safeContext});}}