mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
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.
This commit is contained in:
1 parent
61be34da4f
commit
2e672034d0
1 file changed
+9
-2
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user