-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support chaitin-waf plugin #9838
Conversation
Signed-off-by: Ling Samuel (WSL) <lingsamuelgrace@gmail.com>
Signed-off-by: Ling Samuel (WSL) <lingsamuelgrace@gmail.com>
Signed-off-by: Ling Samuel (WSL) <lingsamuelgrace@gmail.com>
Signed-off-by: Ling Samuel (WSL) <lingsamuelgrace@gmail.com>
Signed-off-by: Ling Samuel (WSL) <lingsamuelgrace@gmail.com>
404 page not found | ||
``` | ||
|
||
当满足匹配条件时,正常请求依然可以触达: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
触达上游?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apisix/plugins/chaitin-waf.lua
Outdated
|
||
local function get_conf(conf, metadata) | ||
local t = { | ||
mode = "block", -- block or monitor or off, default off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default value is ’off‘ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
if conf.match then | ||
for _, match in ipairs(conf.match) do | ||
local exp, err = expr.new(match.vars) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we cache the result of expression compilation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will do it after this pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add TODO pls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apisix/plugins/chaitin-waf.lua
Outdated
config = { | ||
type = "object", | ||
properties = { | ||
-- connect timeout, in milliseconds, integer, default 1s (1000ms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annotation looks unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move it to the properties item desc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
type = "object", | ||
properties = { | ||
host = { | ||
type = "string", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to use a stricter schema definition. https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
t/plugin/chaitin-waf-reject.t
Outdated
- 9200 | ||
- "127.0.0.1:9201" | ||
plugins: | ||
- chaitin-waf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plugin has been enabled by default, there is no need to add it separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apisix/plugins/chaitin-waf.lua
Outdated
config = { | ||
type = "object", | ||
properties = { | ||
-- connect timeout, in milliseconds, integer, default 1s (1000ms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move it to the properties item desc?
{"code": 403, "success":false, "message": "blocked by Chaitin SafeLine Web Application Firewall", "event_id": "51a268653f2c4189bfa3ec66afbcb26d"} | ||
``` | ||
|
||
## Disable Plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Disable Plugin | |
## Delete Plugin |
This sections of all plugin docs (en/zh) have been corrected previously. Reference to the latest here: https://apisix.apache.org/docs/apisix/next/plugins/response-rewrite/#delete-plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
## Disable Plugin | ||
|
||
To disable the `chaitin-waf` plugin, remove the plugin configuration in the plugin configuration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To disable the `chaitin-waf` plugin, remove the plugin configuration in the plugin configuration: | |
To remove the `chaitin-waf` plugin, delete the the corresponding JSON configuration from the Plugin configuration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
{"code": 403, "success":false, "message": "blocked by Chaitin SafeLine Web Application Firewall", "event_id": "51a268653f2c4189bfa3ec66afbcb26d"} | ||
``` | ||
|
||
## 禁用插件 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## 禁用插件 | |
## 删除插件 |
| add_header | bool | false | true | Whether to add response headers | | ||
| add_debug_header | bool | false | false | Whether or not to add debugging headers, effective when `add_header` is `true`. | | ||
| config | object | false | | Configuration of the Chaitin SafeLine WAF service. When the route is not configured, the parameters configured in the metadata are used. | | ||
| config.connect_timeout | integer | false | | connect timeout, in milliseconds, integer | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| config.connect_timeout | integer | false | | connect timeout, in milliseconds, integer | | |
| config.connect_timeout | integer | false | | connect timeout, in milliseconds | |
Same for below. Remove all integer
from the description as the data types have already been specified in Type
.
Description
Fixes # (issue)
Checklist