From d1f2ae3ed415a6334a0b1c3bfceabd5c399b0d09 Mon Sep 17 00:00:00 2001 From: Alexander Whitestone <8633216+AlexanderWhitestone@users.noreply.github.com> Date: Wed, 4 Mar 2026 07:58:49 -0500 Subject: [PATCH] Security: fix XSS vulnerabilities in health and grok routes (#124) --- src/dashboard/routes/grok.py | 4 +- src/dashboard/routes/health.py | 7 +-- tests/security/test_xss_vulnerabilities.py | 50 ++++++++++++++++++++++ 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 tests/security/test_xss_vulnerabilities.py diff --git a/src/dashboard/routes/grok.py b/src/dashboard/routes/grok.py index cc76dca..c135d10 100644 --- a/src/dashboard/routes/grok.py +++ b/src/dashboard/routes/grok.py @@ -198,9 +198,11 @@ async def grok_stats(): def _render_toggle_card(active: bool) -> str: """Render the Grok Mode toggle card HTML.""" + import html color = "#00ff88" if active else "#666" state = "ACTIVE" if active else "STANDBY" glow = "0 0 20px rgba(0, 255, 136, 0.4)" if active else "none" + model_name = html.escape(settings.grok_default_model) return f"""