diff --git a/internal/waf/checkpoints/request_url.go b/internal/waf/checkpoints/request_url.go new file mode 100644 index 0000000..88c8727 --- /dev/null +++ b/internal/waf/checkpoints/request_url.go @@ -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 +} diff --git a/internal/waf/checkpoints/utils.go b/internal/waf/checkpoints/utils.go index 120d1aa..23aa7e2 100644 --- a/internal/waf/checkpoints/utils.go +++ b/internal/waf/checkpoints/utils.go @@ -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",