mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-29 20:00:24 +08:00
WAF规则中增加${requestURL}参数
This commit is contained in:
21
internal/waf/checkpoints/request_url.go
Normal file
21
internal/waf/checkpoints/request_url.go
Normal 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
|
||||||
|
}
|
||||||
@@ -40,17 +40,24 @@ var AllCheckpoints = []*CheckpointDefinition{
|
|||||||
{
|
{
|
||||||
Name: "请求URI",
|
Name: "请求URI",
|
||||||
Prefix: "requestURI",
|
Prefix: "requestURI",
|
||||||
Description: "包含URL参数的请求URI,比如/hello/world?lang=go",
|
Description: "包含URL参数的请求URI,类似于 /hello/world?lang=go",
|
||||||
HasParams: false,
|
HasParams: false,
|
||||||
Instance: new(RequestURICheckpoint),
|
Instance: new(RequestURICheckpoint),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "请求路径",
|
Name: "请求路径",
|
||||||
Prefix: "requestPath",
|
Prefix: "requestPath",
|
||||||
Description: "不包含URL参数的请求路径,比如/hello/world",
|
Description: "不包含URL参数的请求路径,类似于 /hello/world",
|
||||||
HasParams: false,
|
HasParams: false,
|
||||||
Instance: new(RequestPathCheckpoint),
|
Instance: new(RequestPathCheckpoint),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "请求URL",
|
||||||
|
Prefix: "requestURL",
|
||||||
|
Description: "完整的请求URL,包含协议、域名、请求路径、参数等,类似于 https://example.com/hello?name=lily",
|
||||||
|
HasParams: false,
|
||||||
|
Instance: new(RequestURLCheckpoint),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "请求内容长度",
|
Name: "请求内容长度",
|
||||||
Prefix: "requestLength",
|
Prefix: "requestLength",
|
||||||
|
|||||||
Reference in New Issue
Block a user