From fc8a0ee9d498aff319d45b863fb44736a0d8bc24 Mon Sep 17 00:00:00 2001 From: alteredCoder Date: Mon, 31 Jul 2023 15:06:42 +0200 Subject: [PATCH] update --- pkg/acquisition/modules/waf/waf.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/pkg/acquisition/modules/waf/waf.go b/pkg/acquisition/modules/waf/waf.go index f6a620e7f..7c513008f 100644 --- a/pkg/acquisition/modules/waf/waf.go +++ b/pkg/acquisition/modules/waf/waf.go @@ -399,7 +399,6 @@ func (r *WafRunner) processReqWithEngine(tx experimental.FullTransaction, parsed return in, tx, nil } - ct := parsedRequest.Headers.Get("content-type") if parsedRequest.Body != nil && len(parsedRequest.Body) != 0 { it, _, err := tx.WriteRequestBody(parsedRequest.Body) if err != nil { @@ -410,19 +409,8 @@ func (r *WafRunner) processReqWithEngine(tx experimental.FullTransaction, parsed //log.Infof("blocking rule id %d", in.RuleID) return it, nil, nil } - // from https://github.com/corazawaf/coraza/blob/main/internal/corazawaf/transaction.go#L419 - // urlencoded cannot end with CRLF - if ct != "application/x-www-form-urlencoded" { - it, _, err := tx.WriteRequestBody([]byte{'\r', '\n'}) - if err != nil { - return nil, nil, fmt.Errorf("cannot write to request body to buffer: %s", err.Error()) - } - - if it != nil { - return it, nil, nil - } - } } + in, err := tx.ProcessRequestBody() if err != nil { return nil, nil, errors.Wrap(err, "Cannot process request body")