feat: add request block regular matching and modify block_ Urls are e… (#517)

This commit is contained in:
yingjianjian
2023-09-25 16:48:38 +08:00
committed by GitHub
parent 945787f7dc
commit 64ccbab29c
5 changed files with 88 additions and 7 deletions

View File

@@ -50,6 +50,42 @@ var WasmPluginsRequestBlock = suite.ConformanceTest{
},
},
},
{
Meta: http.AssertionMeta{
TargetBackend: "infra-backend-v1",
TargetNamespace: "higress-conformance-infra",
},
Request: http.AssertionRequest{
ActualRequest: http.Request{
Host: "foo.com",
Path: "/env/info",
UnfollowRedirect: true,
},
},
Response: http.AssertionResponse{
ExpectedResponse: http.Response{
StatusCode: 403,
},
},
},
{
Meta: http.AssertionMeta{
TargetBackend: "infra-backend-v1",
TargetNamespace: "higress-conformance-infra",
},
Request: http.AssertionRequest{
ActualRequest: http.Request{
Host: "foo.com",
Path: "/web/info",
UnfollowRedirect: true,
},
},
Response: http.AssertionResponse{
ExpectedResponse: http.Response{
StatusCode: 403,
},
},
},
}
t.Run("WasmPlugins request-block", func(t *testing.T) {
for _, testcase := range testcases {

View File

@@ -42,4 +42,8 @@ spec:
defaultConfig:
block_urls:
- "swagger.html"
block_regexp_urls:
- "/env.*"
block_exact_urls:
- "/web/info"
url: file:///opt/plugins/wasm-go/extensions/request-block/plugin.wasm