fix linter

This commit is contained in:
alteredCoder 2023-08-24 12:11:44 +02:00
parent 4846701ed5
commit e0bd4dc928
2 changed files with 6 additions and 9 deletions

View file

@ -61,8 +61,6 @@ type WafSource struct {
outChan chan types.Event
InChan chan waf.ParsedRequest
inBandWaf coraza.WAF
outOfBandWaf coraza.WAF
RulesCollections []*waf.WafRulesCollection
WafRunners []WafRunner
@ -464,7 +462,7 @@ func (r *WafRunner) Run(t *tomb.Tomb) error {
switch t := res.(type) {
case bool:
if t == false {
if !t {
log.Infof("filter didnt match")
continue
}
@ -518,7 +516,7 @@ func (r *WafRunner) Run(t *tomb.Tomb) error {
switch t := res.(type) {
case bool:
if t == false {
if !t {
continue
}
default:
@ -569,6 +567,7 @@ func (r *WafRunner) Run(t *tomb.Tomb) error {
// Process outBand
outBandTx := r.outOfBandWaf.NewTransactionWithID(request.UUID)
expTx = outBandTx.(experimental.FullTransaction)
in, expTx, err = r.processReqWithEngine(expTx, request, OutOfBand)
if err != nil { //things went south
r.logger.Errorf("Error while processing request : %s", err)
@ -655,5 +654,4 @@ func (w *WafSource) wafHandler(rw http.ResponseWriter, r *http.Request) {
rw.Write(body)
}
return
}

View file

@ -2,7 +2,7 @@ package waf
import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
@ -78,12 +78,11 @@ type ParsedRequest struct {
}
func NewParsedRequestFromRequest(r *http.Request) (ParsedRequest, error) {
var body []byte
var err error
body := make([]byte, 0)
if r.Body != nil {
body = make([]byte, 0)
body, err = ioutil.ReadAll(r.Body)
body, err = io.ReadAll(r.Body)
if err != nil {
return ParsedRequest{}, fmt.Errorf("unable to read body: %s", err)
}