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';