Skip to content

Commit 76e6ee3

Browse files
Refactored severity enum types, based on expected types outputted by WAF
1 parent dd8047f commit 76e6ee3

File tree

4 files changed

+56
-40
lines changed

4 files changed

+56
-40
lines changed

api/grpc/events/v1/security_violation.pb.go

Lines changed: 30 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/events/v1/security_violation.proto

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ enum RequestOutcomeReason {
139139

140140
enum Severity {
141141
SEVERITY_UNKNOWN = 0;
142-
SEVERITY_INFORMATIONAL = 1;
143-
SEVERITY_LOW = 2;
144-
SEVERITY_MEDIUM = 3;
145-
SEVERITY_HIGH = 4;
146-
SEVERITY_CRITICAL = 5;
142+
SEVERITY_EMERGENCY = 1;
143+
SEVERITY_ALERT = 2;
144+
SEVERITY_CRITICAL = 3;
145+
SEVERITY_ERROR = 4;
146+
SEVERITY_WARNING = 5;
147+
SEVERITY_NOTICE = 6;
148+
SEVERITY_INFORMATIONAL = 7;
147149
}

docs/proto/protos.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,13 @@ ViolationData represents individual violation details
272272
| Name | Number | Description |
273273
| ---- | ------ | ----------- |
274274
| SEVERITY_UNKNOWN | 0 | |
275-
| SEVERITY_INFORMATIONAL | 1 | |
276-
| SEVERITY_LOW | 2 | |
277-
| SEVERITY_MEDIUM | 3 | |
278-
| SEVERITY_HIGH | 4 | |
279-
| SEVERITY_CRITICAL | 5 | |
275+
| SEVERITY_EMERGENCY | 1 | |
276+
| SEVERITY_ALERT | 2 | |
277+
| SEVERITY_CRITICAL | 3 | |
278+
| SEVERITY_ERROR | 4 | |
279+
| SEVERITY_WARNING | 5 | |
280+
| SEVERITY_NOTICE | 6 | |
281+
| SEVERITY_INFORMATIONAL | 7 | |
280282

281283

282284

internal/collector/securityviolationsprocessor/csv_parser.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,20 @@ func parseIsTruncated(value string) bool {
121121
// parseSeverity converts string severity to Severity enum
122122
func parseSeverity(severity string) events.Severity {
123123
switch strings.ToLower(strings.TrimSpace(severity)) {
124-
case "informational":
125-
return events.Severity_SEVERITY_INFORMATIONAL
126-
case "low":
127-
return events.Severity_SEVERITY_LOW
128-
case "medium":
129-
return events.Severity_SEVERITY_MEDIUM
130-
case "high":
131-
return events.Severity_SEVERITY_HIGH
124+
case "emergency":
125+
return events.Severity_SEVERITY_EMERGENCY
126+
case "alert":
127+
return events.Severity_SEVERITY_ALERT
132128
case "critical":
133129
return events.Severity_SEVERITY_CRITICAL
130+
case "error":
131+
return events.Severity_SEVERITY_ERROR
132+
case "warning":
133+
return events.Severity_SEVERITY_WARNING
134+
case "notice":
135+
return events.Severity_SEVERITY_NOTICE
136+
case "informational":
137+
return events.Severity_SEVERITY_INFORMATIONAL
134138
default:
135139
return events.Severity_SEVERITY_UNKNOWN
136140
}

0 commit comments

Comments
 (0)