mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-03 22:06:37 +08:00
WAF检查项增加“所有报头名称”
This commit is contained in:
32
internal/waf/checkpoints/request_header_names.go
Normal file
32
internal/waf/checkpoints/request_header_names.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package checkpoints
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/waf/utils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type RequestHeaderNamesCheckpoint struct {
|
||||
Checkpoint
|
||||
}
|
||||
|
||||
func (this *RequestHeaderNamesCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
|
||||
var headerNames = []string{}
|
||||
for k := range req.WAFRaw().Header {
|
||||
headerNames = append(headerNames, k)
|
||||
}
|
||||
value = strings.Join(headerNames, "\n")
|
||||
return
|
||||
}
|
||||
|
||||
func (this *RequestHeaderNamesCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
|
||||
if this.IsRequest() {
|
||||
return this.RequestValue(req, param, options, ruleId)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *RequestHeaderNamesCheckpoint) CacheLife() utils.CacheLife {
|
||||
return utils.CacheShortLife
|
||||
}
|
||||
Reference in New Issue
Block a user