make Event viabl

This commit is contained in:
bui 2023-10-27 11:09:38 +02:00
parent 31a3b8a4ef
commit bb59d9852a

View file

@ -88,11 +88,11 @@ func EventFromRequest(r waf.ParsedRequest) (types.Event, error) {
evt.Line = types.Line{
Time: time.Now(),
//should we add some info like listen addr/port/path ?
Labels: map[string]string{"type": "coraza-waf"},
Labels: map[string]string{"type": "coraza-waap"},
Process: true,
Module: "waf",
Src: "waf",
Raw: "dummy-waf-data", //we discard empty Line.Raw items :)
Module: "waap",
Src: "waap",
Raw: "dummy-waap-data", //we discard empty Line.Raw items :)
}
evt.Waap = types.WaapEvent{}
@ -144,6 +144,9 @@ func (r *WaapRunner) AccumulateTxToEvent(evt *types.Event, req waf.ParsedRequest
if evt.Meta == nil {
evt.Meta = map[string]string{}
}
if evt.Parsed == nil {
evt.Parsed = map[string]string{}
}
if req.IsInBand {
evt.Meta["waap_interrupted"] = "true"
evt.Meta["waap_action"] = req.Tx.Interruption().Action