创建误报屏蔽规则
功能介绍
创建误报屏蔽规则
URI
POST /v1/edgesec/configuration/http/policies/{policy_id}/ignore-rule
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| policy_id | 是 | String | 策略id |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | String | auth token |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| name | 否 | String | 规则名称 |
| description | 否 | String | 规则描述,最长512字符 |
| url | 否 | String | 误报路径 |
| rule | 是 | String | 规则编号 |
| mode | 是 | Integer | 误报屏蔽模式,默认为0即旧模式 |
| domains | 是 | Array of strings | 域名列表 |
| url_logic | 否 | String | 屏蔽规则url类型(前缀:prefix,等于:equal) |
| advanced | 否 | HttpIgnoreRuleCondition object | 条件列表参数较为复杂,存在级联关系,建议同时使用控制台上的添加误报屏蔽规则,单击F12键查看路径后缀为/ignore-rule,方法为POST的请求参数,便于理解参数的填写 |
| conditions | 是 | Array of HttpIgnoreRuleCondition objects | 命中条件 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| category | 是 | String | 字段类型,可选值有ip、url、params、cookie、header |
| index | 否 | String | 字段类型为ip且子字段为客户端ip时,不需要传index参数;子字段类型为X-Forwarded-For时,值为x-forwarded-for;字段类型为params、header、cookie并且子字段为自定义时,index的值为自定义子字段 |
| contents | 是 | Array of strings | 内容列表 |
| logic_operation | 是 | String | 匹配逻辑,匹配逻辑根据字段类型变化,字段类型为ip时,匹配逻辑支持(equal:等于,not_equal:不等于),字段类型为url、header、params、cookie时,匹配逻辑支持(equal:等于,not_equal:不等于,contain:包含,not_contain:不包含,prefix:前缀为,not_prefix:前缀不为,suffix:后缀为,not_suffix:后缀不为,regular_match:正则匹配,regular_not_match:正则不匹配) |
| value_list_id | 否 | String | 引用表id |
| size | 否 | Long | 若防护规则涉及阈值,即使用该字段 |
| check_all_indexes_logic | 否 | Integer | 1.所有子字段/2.任意子字段 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 规则id |
| name | String | 规则名称 |
| policy_id | String | 规则所在策略id |
| policy_name | String | 规则所在策略名称 |
| timestamp | Long | 创建规则时间戳 |
| description | String | 规则描述 |
| status | Integer | 规则开关状态 |
| url | String | 误报路径 |
| rule | String | 规则编号 |
| mode | Integer | 误报屏蔽模式,默认为0即旧模式 |
| domains | Array of strings | 域名列表 |
| url_logic | String | 屏蔽规则url类型(前缀:prefix,等于:equal) |
| advanced | HttpIgnoreRuleCondition object | 条件列表参数较为复杂,存在级联关系,建议同时使用控制台上的添加误报屏蔽规则,单击F12键查看路径后缀为/ignore-rule,方法为POST的请求参数,便于理解参数的填写 |
| conditions | Array of HttpIgnoreRuleCondition objects | 命中条件 |
| hit_num | Integer | 命中次数 |
| update_time | Long | 最后更新时间戳 |
| clear_time | Long | 上一次命中次数清零时间戳 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| category | String | 字段类型,可选值有ip、url、params、cookie、header |
| index | String | 字段类型为ip且子字段为客户端ip时,不需要传index参数;子字段类型为X-Forwarded-For时,值为x-forwarded-for;字段类型为params、header、cookie并且子字段为自定义时,index的值为自定义子字段 |
| contents | Array of strings | 内容列表 |
| logic_operation | String | 匹配逻辑,匹配逻辑根据字段类型变化,字段类型为ip时,匹配逻辑支持(equal:等于,not_equal:不等于),字段类型为url、header、params、cookie时,匹配逻辑支持(equal:等于,not_equal:不等于,contain:包含,not_contain:不包含,prefix:前缀为,not_prefix:前缀不为,suffix:后缀为,not_suffix:后缀不为,regular_match:正则匹配,regular_not_match:正则不匹配) |
| value_list_id | String | 引用表id |
| size | Long | 若防护规则涉及阈值,即使用该字段 |
| check_all_indexes_logic | Integer | 1.所有子字段/2.任意子字段 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 标准化错误码:服务名.八位数字编码 |
| error_msg | String | 清晰的错误信息 |
| encoded_authorization_message | String | 对接IAM5.0的服务,拒绝访问时需要返回IAM的相关响应 |
状态码:401
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 标准化错误码:服务名.八位数字编码 |
| error_msg | String | 清晰的错误信息 |
| encoded_authorization_message | String | 对接IAM5.0的服务,拒绝访问时需要返回IAM的相关响应 |
状态码:500
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 标准化错误码:服务名.八位数字编码 |
| error_msg | String | 清晰的错误信息 |
| encoded_authorization_message | String | 对接IAM5.0的服务,拒绝访问时需要返回IAM的相关响应 |
请求示例
创建误报屏蔽规
POST https://esa.cn-north-4.myhuaweicloud.com/v1/edgesec/configuration/http/policies/a7bd0ca4b2ac48cfb8c59deebf6b64e0/ignore-rule
{
"name" : "ignore1",
"description" : "test",
"url" : "/aaa",
"rule" : "rule1",
"mode" : 0,
"domains" : [ "aaa.com", "bbb.com" ],
"url_logic" : "prefix",
"advanced" : {
"category" : "cookie",
"index" : "test",
"contents" : [ "aaa", "bbb" ],
"logic_operation" : "contain",
"value_list_id" : "a7bd0ca4b2ac48cfb8c59deebf6b64e4",
"size" : 3,
"check_all_indexes_logic" : 2,
"description" : "test"
},
"conditions" : [ {
"category" : "cookie",
"index" : "test",
"contents" : [ "aaa", "bbb" ],
"logic_operation" : "contain",
"value_list_id" : "a7bd0ca4b2ac48cfb8c59deebf6b64e4",
"size" : 3,
"check_all_indexes_logic" : 2,
"description" : "test"
} ]
} 响应示例
状态码:200
OK
{
"id" : "a5bd0ca4b2ac48cfb8c59deebf6b64e8",
"name" : "ignore1",
"policy_id" : "a7bd0ca4b2ac48cfb8c59deebf6b64e0",
"policy_name" : "policy_test1",
"timestamp" : 1731427500000,
"description" : "test",
"status" : 1,
"url" : "/aaa",
"rule" : "rule1",
"mode" : 0,
"domains" : [ "aaa.com", "bbb.com" ],
"url_logic" : "prefix",
"advanced" : {
"category" : "cookie",
"index" : "test",
"contents" : [ "aaa", "bbb" ],
"logic_operation" : "contain",
"value_list_id" : "a7bd0ca4b2ac48cfb8c59deebf6b64e4",
"size" : 3,
"check_all_indexes_logic" : 2,
"description" : "test"
},
"conditions" : [ {
"category" : "cookie",
"index" : "test",
"contents" : [ "aaa", "bbb" ],
"logic_operation" : "contain",
"value_list_id" : "a7bd0ca4b2ac48cfb8c59deebf6b64e4",
"size" : 3,
"check_all_indexes_logic" : 2,
"description" : "test"
} ],
"hit_num" : 10,
"update_time" : 1731427500000,
"clear_time" : 1731227500000
} 状态码
| 状态码 | 描述 |
|---|---|
| 200 | OK |
| 400 | 请求失败 |
| 401 | token权限不足 |
| 500 | 服务器内部错误 |
错误码
请参见错误码。