WAF规则中增加${requestURL}参数

This commit is contained in:
GoEdgeLab
2022-06-09 19:44:11 +08:00
parent 0304170751
commit fb5029bad1
2 changed files with 30 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
package checkpoints
import (
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
"github.com/iwind/TeaGo/maps"
)
type RequestURLCheckpoint struct {
Checkpoint
}
func (this *RequestURLCheckpoint) RequestValue(req requests.Request, param string, options maps.Map) (value interface{}, sysErr error, userErr error) {
return req.Format("${requestURL}"), nil, nil
}
func (this *RequestURLCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map) (value interface{}, sysErr error, userErr error) {
if this.IsRequest() {
return this.RequestValue(req, param, options)
}
return
}

View File

@@ -40,17 +40,24 @@ var AllCheckpoints = []*CheckpointDefinition{
{
Name: "请求URI",
Prefix: "requestURI",
Description: "包含URL参数的请求URI比如/hello/world?lang=go",
Description: "包含URL参数的请求URI类似于 /hello/world?lang=go",
HasParams: false,
Instance: new(RequestURICheckpoint),
},
{
Name: "请求路径",
Prefix: "requestPath",
Description: "不包含URL参数的请求路径比如/hello/world",
Description: "不包含URL参数的请求路径类似于 /hello/world",
HasParams: false,
Instance: new(RequestPathCheckpoint),
},
{
Name: "请求URL",
Prefix: "requestURL",
Description: "完整的请求URL包含协议、域名、请求路径、参数等类似于 https://example.com/hello?name=lily",
HasParams: false,
Instance: new(RequestURLCheckpoint),
},
{
Name: "请求内容长度",
Prefix: "requestLength",