Querying Protection Policies¶
Function¶
This API is used to query the list of protection policies.
URI¶
GET /v1/{project_id}/waf/policy
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID |
Parameter | Mandatory | Type | Description |
---|---|---|---|
page | No | Integer | Page. Default value: 1 Default: 1 |
pagesize | No | Integer | Number of records on each page. The maximum value is 100. If this parameter is not specified, the default value -1 is used. All policies are queried regardless of the value of Page. |
name | No | String | Policy name. Fuzzy search is supported. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
Content-Type | No | String | Content type. Default value: application/json;charset=utf8 Default: application/json;charset=utf8 |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
total | Integer | Total number of policies |
items | Array of ListPolicyResponse objects | Array of policies. Each item in the array includes details of a specific policy. |
Parameter | Type | Description |
---|---|---|
id | String | Policy ID. This is the unique identifier generated by WAF. |
name | String | Policy name. |
action | PolicyAction object | PolicyAction |
options | PolicyOption object | PolicyOption |
level | Integer | Protection level. A low protection level may result in a lower false-positive rate, but also a lower attack detection rate. A high protection level may result in a higher attack detection rate, but also a higher false-positive rate. A medium protection level can balance both. Protection levels:
|
full_detection | Boolean | Detection mode in the precise protection rule
|
bind_host | Array of BindHost objects | Array of protected domain names for which the policy is used. Each policy can be used to one or more domain names. You can specify a policy for a domain name when you add the domain name to WAF by calling the API Adding a Protected Domain Name. |
hosts | Array of strings | Array of IDs of protected domain names. The ID of a protected domain name is unique and generated by WAF when you add the domain name to WAF. To obtain the IDs, call the API Querying Domain Names Protected by Dedicated WAF Engines. To add a domain name to WAF, call the API Adding a Protected Domain Name. |
extend | PolicyExtend object | Switch for enabling or disabling Deep Inspection and Header Inspection in Basic Web Protection. |
share_info | ShareInfo object | Whether to share a policy. This parameter is reserved and can be ignored currently. |
modulex_options | ModulexOptions object | Whether to enabling intelligent CC protection. This parameter is reserved and can be ignored currently. |
timestamp | Long | Time the policy is created. The value is a 13-digit timestamp, in ms. |
Parameter | Type | Description |
---|---|---|
category | String | Protection level. The value can be:
Enumeration values:
|
Parameter | Type | Description |
---|---|---|
webattack | Boolean | Basic web protection includes many specific checks under Advanced Settings, and there is a specific parameter allocated for each check, for example, common for General Check. To enable any of these checks, keep this parameter enabled first. The value can be:
|
common | Boolean | Whether general check is enabled. The value can be:
|
anticrawler | Boolean | Whether to enable the JavaScript anti-crawler function.
|
crawler_engine | Boolean | Whether the search engine is enabled. The value can be:
|
crawler_scanner | Boolean | Whether the scanner check in anti-crawler detection is enabled. The value can be:
|
crawler_script | Boolean | Whether the JavaScript anti-crawler is enabled. The value can be:
|
crawler_other | Boolean | Whether other crawler check is enabled. The value can be:
|
webshell | Boolean | Whether webshell check is enabled. The value can be:
|
cc | Boolean | Whether the CC attack protection rule is enabled. The value can be:
|
custom | Boolean | Whether precise protection is enabled. The value can be:
|
whiteblackip | Boolean | Whether blacklist and whitelist protection is enabled. The value can be:
|
geoip | Boolean | Whether geolocation access control is enabled. The value can be:
|
ignore | Boolean | Whether false alarm masking is enabled. The value can be:
|
privacy | Boolean | Whether data masking is enabled. The value can be:
|
antitamper | Boolean | Whether the web tamper protection is enabled. The value can be:
|
antileakage | Boolean | Whether the information leakage prevention is enabled. The value can be:
|
followed_action | Boolean | Whether the Known Attack Source protection is enabled.. The value can be:
|
bot_enable | Boolean | Feature-based anti-crawler. This feature includes many specific anti-crawler checks, such as crawler_engine, crawler_scanner, crawler_script, and crawler_other. To enable any of these checks, keep anti-crawler protection enabled. The value can be:
|
crawler | Boolean | This parameter is reserved and can be ignored currently. |
precise | Boolean | This parameter is reserved and can be ignored currently. |
modulex_enabled | Boolean | This parameter is reserved and can be ignored currently. Enumeration values:
|
Parameter | Type | Description |
---|---|---|
id | String | Domain name ID. It is the unique identifier generated by WAF for a domain name when you add the domain name to WAF |
hostname | String | Domain name |
waf_type | String | WAF mode of the domain name. The value is premium. |
Parameter | Type | Description |
---|---|---|
extend | String | Protection statuses for advanced settings in basic web protection. By default, this parameter is left blank, and the Deep Inspection and Header Inspection are disabled.
|
Parameter | Type | Description |
---|---|---|
share_count | Integer | Total number of the users who share the address group. |
accept_count | Integer | Number of users who accept the sharing |
process_status | Integer | Status |
Parameter | Type | Description |
---|---|---|
global_rate_enabled | Boolean | Status of the global rate limiting function (counting requests to all WAF instances when limiting traffic).
|
global_rate_mode | String | Protection mode of the global rate limiting function. WAF logs the event only.
Enumeration values:
|
precise_rules_enabled | Boolean | Status of the intelligent precise protection.
|
precise_rules_mode | String | Protection mode of the intelligent precise protection.
Enumeration values:
|
precise_rules_managed_mode | String | Management mode of the intelligent precise protection.
Enumeration values:
|
precise_rules_aging_mode | String | Aging mode of the intelligent precise protection.
Enumeration values:
|
precise_rules_retention | Integer | Maximum age of the intelligent precise protection. |
cc_rules_enabled | Boolean | Status of the intelligent CC attack protection.
|
cc_rules_mode | String | Protection mode of the intelligent CC attack protection rule.
Enumeration values:
|
cc_rules_managed_mode | String | Management mode of the intelligent CC attack protection.
Enumeration values:
|
cc_rules_aging_mode | String | Aging mode of the intelligent CC attack protection.
Enumeration values:
|
cc_rules_retention | Integer | Maximum age of the intelligent CC attack protection. |
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | Error code |
error_msg | String | Error message |
Status code: 401
Parameter | Type | Description |
---|---|---|
error_code | String | Error code |
error_msg | String | Error message |
Status code: 500
Parameter | Type | Description |
---|---|---|
error_code | String | Error code |
error_msg | String | Error message |
Example Requests¶
GET https://{Endpoint}/v1/{project_id}/waf/policy?
Example Responses¶
Status code: 200
Request succeeded.
{
"total" : 1,
"items" : [ {
"id" : "41cba8aee2e94bcdbf57460874205494",
"name" : "policy_2FHwFOKz",
"level" : 2,
"action" : {
"category" : "log",
"modulex_category" : "log"
},
"options" : {
"webattack" : true,
"common" : true,
"crawler" : true,
"crawler_engine" : false,
"crawler_scanner" : true,
"crawler_script" : false,
"crawler_other" : false,
"webshell" : false,
"cc" : true,
"custom" : true,
"precise" : false,
"whiteblackip" : true,
"geoip" : true,
"ignore" : true,
"privacy" : true,
"antitamper" : true,
"anticrawler" : false,
"antileakage" : false,
"followed_action" : false,
"bot_enable" : true
},
"hosts" : [ ],
"extend" : { },
"timestamp" : 1650527546218,
"full_detection" : false,
"bind_host" : [ ]
} ]
}
Status Codes¶
Status Code | Description |
---|---|
200 | Request succeeded. |
400 | Request failed. |
401 | The token does not have required permissions. |
500 | Internal server error. |
Error Codes¶
See Error Codes.