From 877fb9e19ab41953571fdf86e8a310cd216dab5d Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Mon, 29 Jun 2026 17:25:16 +0200 Subject: [PATCH] fix(portal): bind Active bans to /crowdsec/decisions count (2.2.2) --- packages/secubox-portal/debian/changelog | 8 ++++++++ packages/secubox-portal/www/portal/index.html | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/secubox-portal/debian/changelog b/packages/secubox-portal/debian/changelog index 8b77fcca..e110e3f7 100644 --- a/packages/secubox-portal/debian/changelog +++ b/packages/secubox-portal/debian/changelog @@ -1,3 +1,11 @@ +secubox-portal (2.2.2-1~bookworm1) bookworm; urgency=medium + + * fix(ui): 'Active bans' now reflects the live /crowdsec/decisions list + (includes CAPI community blocklist) instead of the local-only + health/summary.active_decisions; hero 'Bans active' kept consistent. + + -- Gerald KERMA Mon, 29 Jun 2026 21:00:00 +0200 + secubox-portal (2.2.1-1~bookworm1) bookworm; urgency=medium * fix(ui): reskin the portal to the standard SecuBox template — shared diff --git a/packages/secubox-portal/www/portal/index.html b/packages/secubox-portal/www/portal/index.html index 0cd7b5f2..8b5546bb 100644 --- a/packages/secubox-portal/www/portal/index.html +++ b/packages/secubox-portal/www/portal/index.html @@ -355,7 +355,12 @@ } function renderBans(h, decisions) { - const ban = h && h.crowdsec && h.crowdsec.active_decisions; + // Prefer the live /crowdsec/decisions list (includes CAPI community + // blocklist), falling back to health/summary's local-only count. + const decList = decisions && Array.isArray(decisions.decisions) ? decisions.decisions + : (Array.isArray(decisions) ? decisions : null); + const ban = decList ? decList.filter(d => (d.type || 'ban') === 'ban').length + : (h && h.crowdsec ? h.crowdsec.active_decisions : null); const alerts = h && h.crowdsec && h.crowdsec.alerts_today; const wafPct = h && h.waf && h.waf.blocked_pct; const wafCls = wafPct == null ? '' : (wafPct >= 25 ? 'crit' : wafPct >= 10 ? 'warn' : 'ok'); @@ -365,6 +370,8 @@ $('t-waf').textContent = wafPct != null ? wafPct + '%' : '—'; $('t-waf').className = 'v ' + wafCls; $('t-alerts').textContent = alerts != null ? alerts : '—'; + // Keep the hero "Bans active" consistent with the real blocked-IP count. + if (ban != null && $('hero-bans')) $('hero-bans').textContent = ban; } function renderVhosts(d) {