mirror of
https://github.com/alibaba/higress.git
synced 2026-05-11 22:37:32 +08:00
Fix log import (#1957)
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/alibaba/higress/plugins/wasm-go/pkg/log"
|
||||
"github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper"
|
||||
"github.com/corazawaf/coraza/v3"
|
||||
"github.com/corazawaf/coraza/v3/debuglog"
|
||||
@@ -32,7 +31,7 @@ type WafConfig struct {
|
||||
//tx ctypes.Transaction
|
||||
}
|
||||
|
||||
func parseConfig(json gjson.Result, config *WafConfig, log log.Log) error {
|
||||
func parseConfig(json gjson.Result, config *WafConfig, log wrapper.Log) error {
|
||||
var secRules []string
|
||||
var value gjson.Result
|
||||
value = json.Get("useCRS")
|
||||
@@ -69,7 +68,7 @@ func parseConfig(json gjson.Result, config *WafConfig, log log.Log) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func onHttpRequestHeaders(ctx wrapper.HttpContext, config WafConfig, log log.Log) types.Action {
|
||||
func onHttpRequestHeaders(ctx wrapper.HttpContext, config WafConfig, log wrapper.Log) types.Action {
|
||||
ctx.SetContext("skipwaf", false)
|
||||
|
||||
if ignoreBody() {
|
||||
@@ -149,7 +148,7 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config WafConfig, log log.Log
|
||||
return types.ActionContinue
|
||||
}
|
||||
|
||||
func onHttpRequestBody(ctx wrapper.HttpContext, config WafConfig, body []byte, log log.Log) types.Action {
|
||||
func onHttpRequestBody(ctx wrapper.HttpContext, config WafConfig, body []byte, log wrapper.Log) types.Action {
|
||||
if ctx.GetContext("interruptionHandled").(bool) {
|
||||
return types.ActionContinue
|
||||
}
|
||||
@@ -201,7 +200,7 @@ func onHttpRequestBody(ctx wrapper.HttpContext, config WafConfig, body []byte, l
|
||||
return types.ActionContinue
|
||||
}
|
||||
|
||||
func onHttpResponseHeaders(ctx wrapper.HttpContext, config WafConfig, log log.Log) types.Action {
|
||||
func onHttpResponseHeaders(ctx wrapper.HttpContext, config WafConfig, log wrapper.Log) types.Action {
|
||||
if ctx.GetContext("skipwaf").(bool) {
|
||||
return types.ActionContinue
|
||||
}
|
||||
@@ -258,7 +257,7 @@ func onHttpResponseHeaders(ctx wrapper.HttpContext, config WafConfig, log log.Lo
|
||||
return types.ActionContinue
|
||||
}
|
||||
|
||||
func onHttpResponseBody(ctx wrapper.HttpContext, config WafConfig, body []byte, log log.Log) types.Action {
|
||||
func onHttpResponseBody(ctx wrapper.HttpContext, config WafConfig, body []byte, log wrapper.Log) types.Action {
|
||||
if ctx.GetContext("interruptionHandled").(bool) {
|
||||
// At response body phase, proxy-wasm currently relies on emptying the response body as a way of
|
||||
// interruption the response. See https://github.com/corazawaf/coraza-proxy-wasm/issues/26.
|
||||
@@ -319,7 +318,7 @@ func onHttpResponseBody(ctx wrapper.HttpContext, config WafConfig, body []byte,
|
||||
return types.ActionContinue
|
||||
}
|
||||
|
||||
func onHttpStreamDone(ctx wrapper.HttpContext, config WafConfig, log log.Log) {
|
||||
func onHttpStreamDone(ctx wrapper.HttpContext, config WafConfig, log wrapper.Log) {
|
||||
if ctx.GetContext("skipwaf").(bool) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user