Skip to content

feat: support chaitin-waf plugin#9838

Merged
juststillthinking merged 21 commits into
apache:masterfrom
lingsamuel:chaitin-waf
Aug 1, 2023
Merged

feat: support chaitin-waf plugin#9838
juststillthinking merged 21 commits into
apache:masterfrom
lingsamuel:chaitin-waf

Conversation

@lingsamuel

Copy link
Copy Markdown
Member

Description

Fixes # (issue)

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Signed-off-by: Ling Samuel (WSL) <[email protected]>
@lingsamuel
lingsamuel marked this pull request as draft July 14, 2023 10:59
Signed-off-by: Ling Samuel (WSL) <[email protected]>
@lingsamuel
lingsamuel marked this pull request as ready for review July 28, 2023 06:57
Comment thread docs/zh/latest/plugins/chaitin-waf.md Outdated
404 page not found
```

当满足匹配条件时,正常请求依然可以触达:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

触达上游?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread apisix/plugins/chaitin-waf.lua Outdated

local function get_conf(conf, metadata)
local t = {
mode = "block", -- block or monitor or off, default off

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value is ’off‘ ?

Copy link
Copy Markdown
Contributor

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)

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add TODO pls

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread apisix/plugins/chaitin-waf.lua Outdated
config = {
type = "object",
properties = {
-- connect timeout, in milliseconds, integer, default 1s (1000ms)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annotation looks unnecessary

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread t/plugin/chaitin-waf-reject.t Outdated
- 9200
- "127.0.0.1:9201"
plugins:
- chaitin-waf

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread apisix/plugins/chaitin-waf.lua Outdated
Comment thread apisix/plugins/chaitin-waf.lua Outdated
config = {
type = "object",
properties = {
-- connect timeout, in milliseconds, integer, default 1s (1000ms)

Copy link
Copy Markdown
Member

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?

Comment thread apisix/plugins/chaitin-waf.lua
Comment thread docs/en/latest/plugins/chaitin-waf.md Outdated
{"code": 403, "success":false, "message": "blocked by Chaitin SafeLine Web Application Firewall", "event_id": "51a268653f2c4189bfa3ec66afbcb26d"}
```

## Disable Plugin

@kayx23 kayx23 Aug 1, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread docs/en/latest/plugins/chaitin-waf.md Outdated

## Disable Plugin

To disable the `chaitin-waf` plugin, remove the plugin configuration in the plugin configuration:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread docs/zh/latest/plugins/chaitin-waf.md Outdated
{"code": 403, "success":false, "message": "blocked by Chaitin SafeLine Web Application Firewall", "event_id": "51a268653f2c4189bfa3ec66afbcb26d"}
```

## 禁用插件

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 禁用插件
## 删除插件

Comment thread docs/en/latest/plugins/chaitin-waf.md Outdated
| 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 |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| 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.

@juststillthinking
juststillthinking merged commit 455d5bf into apache:master Aug 1, 2023
kldcty pushed a commit to kldcty/apisix that referenced this pull request Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants