@@ -1839,15 +1845,20 @@ def serve_webui(request: Request = None):
anomaly_rows = []
for an in anomalies:
afp, srv, sev, msg, rc, ls = an
+ esc_srv = html.escape(str(srv))
+ esc_sev = html.escape(str(sev))
+ esc_msg = html.escape(str(msg))
+ esc_ls = html.escape(str(ls[:19]))
sev_cls = "badge-error" if sev in ("ERROR", "CRITICAL", "FATAL") else "badge-warning"
short_msg = msg[:80] + "..." if len(msg) > 80 else msg
+ esc_short_msg = html.escape(str(short_msg))
anomaly_rows.append(f"""
- | {sev} |
- {srv} |
- {rc} runs |
- {short_msg} |
- {ls[:19]} |
+ {esc_sev} |
+ {esc_srv} |
+ {int(rc)} runs |
+ {esc_short_msg} |
+ {esc_ls} |
""")
anomalies_html = "".join(anomaly_rows) if anomaly_rows else '
| No verified anomalies currently reported. |
'
@@ -1856,19 +1867,24 @@ def serve_webui(request: Request = None):
token_rows = []
for tk in hermes_tokens:
tok, tname, tcreated, tlast, tstatus = tk
+ esc_tok = html.escape(str(tok))
+ esc_tname = html.escape(str(tname))
+ esc_tstatus = html.escape(str(tstatus))
+ esc_tcreated = html.escape(str(tcreated[:19]))
+ esc_tlast = html.escape(str(tlast[:19])) if tlast else 'Never'
tbadge = "badge-active" if tstatus == "active" else "badge-revoked"
- masked = tok[:10] + "••••••••" + tok[-4:]
- tok_action = f'
' if tstatus == "active" else f'
'
+ masked = esc_tok[:10] + "••••••••" + esc_tok[-4:]
+ tok_action = f'
' if tstatus == "active" else f'
'
token_rows.append(f"""
- | {tname} |
- {masked} |
- {tstatus.upper()} |
- {tcreated[:19]} |
- {tlast[:19] if tlast else 'Never'} |
+ {esc_tname} |
+ {masked} |
+ {esc_tstatus.upper()} |
+ {esc_tcreated} |
+ {esc_tlast} |
-
+
{tok_action}
|