Skip to content

Commit a62fd8d

Browse files
Update pkg/output/stats/waf/waf.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent d7156dc commit a62fd8d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/output/stats/waf/waf.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ func NewWafDetector() *WafDetector {
4242
if waf.Regex == "" {
4343
continue
4444
}
45-
store.regexCache[id] = regexp.MustCompile(waf.Regex)
45+
compiled, err := regexp.Compile(waf.Regex)
46+
if err != nil {
47+
log.Printf("invalid WAF regex for %s: %v", id, err)
48+
continue
49+
}
50+
store.regexCache[id] = compiled
4651
}
4752
return store
4853
}

0 commit comments

Comments
 (0)