From 2e672034d0a2a0f9d3f93a9cbd536ceb069a47f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=85=E8=86=80?= Date: Fri, 23 Oct 2026 23:21:59 +0800 Subject: [PATCH] fix(formatter): read security severity levels The scanner severity is not the security severity of an alert. Prefer the security level so critical and high alerts get the right label and color. --- server/lib/formatters/security.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/lib/formatters/security.ts b/server/lib/formatters/security.ts index 68f04ab..7ff9a6d 100644 --- a/server/lib/formatters/security.ts +++ b/server/lib/formatters/security.ts @@ -11,12 +11,19 @@ export function formatCodeScanningAlert( ): NeutralMessage { const action = (payload.action as string) ?? "created"; const alert = payload.alert as { - rule?: { id?: string; severity?: string; description?: string }; + rule?: { + id?: string; + severity?: string; + security_severity_level?: string; + description?: string; + }; most_recent_instance?: { location?: { path?: string } }; state?: string; }; - const severity = alert.rule?.severity ?? "warning"; + // The security severity (critical/high/medium/low) where the rule has one; + // `severity` is the tool's own level (error/warning/note). + const severity = alert.rule?.security_severity_level ?? alert.rule?.severity ?? "warning"; const colorKey = severity === "critical" ? "code_scanning_critical"