From ee54034ffda93ec4ad9542ca53de1b0726cdd145 Mon Sep 17 00:00:00 2001 From: SOC Analyst Date: Thu, 19 Mar 2026 18:15:14 +0100 Subject: [PATCH] fix: remplace les scores -1.00/0.00 sentinel par des badges textuels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les entrées ANUBIS_DENY et KNOWN_BOT ont des scores hardcodés (-1.0 et 0.0) qui ne sont pas calculés par l'IsolationForest mais servent de sentinels. Les afficher comme un score numérique est trompeur. ScoreBadge accepte maintenant threatLevel, botName et anubisAction: - ANUBIS_DENY / anubis_bot_action='DENY' → badge 'RÈGLE' (rouge) - KNOWN_BOT / bot_name non-vide → badge 'BOT' (vert) - Tout autre cas → score IF numérique [-1, 0] DetectionRow étendu avec threat_level? et bot_name? pour accéder aux champs retournés par l'API dans le rendu de la colonne Score. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- frontend/src/components/DetectionsList.tsx | 44 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/DetectionsList.tsx b/frontend/src/components/DetectionsList.tsx index d6962cb..72cbb33 100644 --- a/frontend/src/components/DetectionsList.tsx +++ b/frontend/src/components/DetectionsList.tsx @@ -23,6 +23,8 @@ interface DetectionRow { client_headers?: string; model_name: string; anomaly_score: number; + threat_level?: string; + bot_name?: string; hits?: number; hit_velocity?: number; asn_org?: string; @@ -281,7 +283,14 @@ export function DetectionsList() { label: col.label, sortable: true, align: 'right' as const, - render: (_, row) => , + render: (_, row) => ( + + ), }; case 'hits': return { @@ -539,7 +548,38 @@ function ModelBadge({ model }: { model: string }) { } // Composant ScoreBadge -function ScoreBadge({ score }: { score: number }) { +// Les scores non-IF (ANUBIS_DENY, KNOWN_BOT) sont stockés comme sentinels +// (-1.0 et 0.0) et doivent être affichés comme des badges textuels, +// pas comme des scores numériques calculés par l'IsolationForest. +function ScoreBadge({ + score, + threatLevel, + botName, + anubisAction, +}: { + score: number; + threatLevel?: string; + botName?: string; + anubisAction?: string; +}) { + // ANUBIS_DENY : menace identifiée par règle, pas par IF + if (threatLevel === 'ANUBIS_DENY' || anubisAction === 'DENY') { + return ( + + RÈGLE + + ); + } + // KNOWN_BOT : bot légitime identifié par dictionnaire ou Anubis ALLOW + if (threatLevel === 'KNOWN_BOT' || (botName && botName !== '')) { + return ( + + BOT + + ); + } + + // Score IF réel let color = 'text-threat-low'; if (score < -0.3) color = 'text-threat-critical'; else if (score < -0.15) color = 'text-threat-high';