Skip to content

Commit bafac21

Browse files
authored
waf: format as CRS match only if anomaly score is not 0 (#4230)
1 parent 5e1ac1d commit bafac21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/acquisition/modules/appsec/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ func AppsecEventGeneration(inEvt pipeline.Event, request *http.Request) (*pipeli
221221

222222
// This is a modsec rule match
223223
if scenarioName == "" && len(sevRules) > 0 {
224-
// If from CRS (TX scores are set), use that as the name
224+
// If from CRS (TX scores are set, and the global score is not 0), use that as the name
225225
// If from a custom rule, use the log message from the 1st highest severity rule
226-
if _, ok := inEvt.Appsec.Vars["TX.anomaly_score"]; ok {
226+
if score, ok := inEvt.Appsec.Vars["TX.anomaly_score"]; ok && score != "0" {
227227
scenarioName = formatCRSMatch(inEvt.Appsec.Vars, inEvt.Appsec.HasInBandMatches, inEvt.Appsec.HasOutBandMatches)
228228
} else {
229229
if msg, msgOk := sevRules[0]["msg"].(string); msgOk {

0 commit comments

Comments
 (0)