Configures WAF protection rules.
Operation description
Rate limit per user: 20 calls per second.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dcdn:BatchCreateDcdnWafRules |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| PolicyId |
integer |
Yes |
The policy ID. |
1000001 |
| RuleConfigs |
string |
Yes |
The configuration of the protection rules. |
[{"name":"example","action":"monitor","conditions":[{"key":"URL","opValue":"match-one","values":"1,2,3,4,5"},{"key":"Header","opValue":"contain-one","subKey":"example_subkey","values":"6,7,8,9,10"}],"ratelimit":{"target":"header","interval":10,"threshold":5,"ttl":1800,"subKey":"example_subkey","status":{"code":"502","count":5}},"ccStatus":"on","effect":"rule","status":"on"}] |
RuleConfigs value description
RuleConfigs is a list slice, where each struct represents a rule.
The format of RuleConfigs varies based on the type of the protection policy specified by PolicyId.
Protection scenario 1: Web regex protection (waf_group)
| Parameter | Type | Required | Example | Description |
| status | String | No | on | The switch for the protection rule. Valid values: on (enable) and off (disable). Default value: on. |
| action | String | Yes | block | The action of the rule. Valid values: block (block requests) and monitor (monitor requests). |
| wafGroupIds | String | No | 1012 | The ID of the WAF rule group. Default value: 1012. Separate multiple IDs with commas (,). |
waf_group configuration example:
// Web regex protection currently supports only one rule per policy.
[
{
"status": "on",
"action": "block"
}
]
Protection scenario 2: Custom rules (custom_acl)
| Parameter | Type | Required | Example | Description |
| name | string | Yes | acl_1 | The name of the protection rule. The name can contain letters, digits, and underscores (_), and can be up to 64 characters in length. |
| status | string | No | on | The switch for the protection rule. Valid values: on (enable) and off (disable). Default value: on. |
| conditions | Condition | Yes | [ {"key": "URI", "subKey": "","opValue": "contain", "values": "/login.php" }] | The conditions that trigger the rule. For more information about the parameters, see Table 1 Condition metric description. |
| ccStatus | string | Yes | off | The switch for frequency control. Valid values: on (enable) and off (disable). |
| rateLimit | RateLimit | No | { "target": "Header", "subKey": "User-Agent", "interval": 5, "threshold": 2, "ttl": 1800} | The frequency control rule. This parameter is required when ccStatus is set to on. For more information about the parameters, see Table 2 RateLimit metric description. |
| effect | string | No | service | The effective scope of the frequency control blacklist. This parameter is required when ccStatus is set to on. Valid values: rule (effective for the current rule) and service (globally effective). |
| action | string | Yes | deny | The action of the rule. Valid values: deny (block), js (JavaScript verification), and monitor (monitor). |
Table 1 Condition metric description
| Parameter | Type | Required | Example | Description |
| Key | string | Yes | Query String Parameter | The match field. For more information, see DescribeDcdnWafFilterInfo. |
| subKey | string | No | action | The match subfield. For more information, see DescribeDcdnWafFilterInfo. |
| opValue | String | Yes | eq | The logical operator. For more information, see DescribeDcdnWafFilterInfo. |
| values | String | No | js | The match content. Separate multiple values with commas (,). For more information, see DescribeDcdnWafFilterInfo. |
Table 2 RateLimit metric description
| Parameter | Type | Required | Example | Description |
| target | string | Yes | Header | The statistical field for frequency control. Valid values: IP (counts the frequency of requests from the same IP address), Header (counts the frequency of requests that contain the specified header), Query String Parameter (counts the frequency of requests that contain the specified parameter), Cookie Name (counts the frequency of requests that contain the specified cookie), and Session (counts the frequency of requests from the same session). |
| subKey | string | No | User-Agent | The subfield of the unified field. This parameter is required when target is set to Header, Query String Parameter, or Cookie Name. |
| Interval | Integer | Yes | 5 | The statistical period. Valid values: 5 to 1800. Unit: seconds. |
| threshold | Integer | Yes | 2 | The statistical threshold. Valid values: 2 to 500000. Unit: times. |
| ttl | Integer | Yes | 1800 | The timeout period of the blacklist. Valid values: 60 to 86400. Unit: seconds. |
| status | RateLimitStatus | No | {"code": "404", "ratio": 10} | The statistics of response codes. For more information about the parameters, see Table 3 RateLimitStatus metric description. |
Table 3 RateLimitStatus metric description
| Parameter | Type | Required | Example | Description |
| codet | string | Yes | 404 | The HTTP status code. |
| ratio | Integer | No | 10 | The statistical percentage (%). Valid values: 1 to 100. This parameter and the count parameter are mutually exclusive. |
| count | Integer | No | 10 | The statistical count. Valid values: 2 to 50000. This parameter and the ratio parameter are mutually exclusive. |
custom_acl configuration example:
[
// Access control
{
"name": "acl_1",
"status": "off",
"conditions":
[
{
"key": "Query String Parameter",
"subKey": "action",
"opValue": "eq",
"values": "js"
}
],
"ccStatus": "off",
"action": "js"
},
// Frequency control
{
"name": "cc_1",
"status": "on",
"conditions":
[
{
"key": "URI",
"subKey": "",
"opValue": "contain",
"values": "/login.php"
},
{
"key": "IP",
"subKey": "",
"opValue": "ip-contain",
"values": "192.168.0.1/24"
}
],
"ccStatus": "on",
"ratelimit":
{
"target": "Header",
"subKey": "User-Agent",
"interval": 5,
"threshold": 2,
"ttl": 1800,
"status":
{
"code": "404",
"ratio": 10
}
},
"effect": "service",
"action": "deny"
}
]
Protection scenario 3: Whitelist (whitelist)
| Parameter | Type | Required | Example | Description |
| name | string | Yes | on | The name of the protection rule. The name can contain letters, digits, and underscores (_), and can be up to 64 characters in length. |
| status | string | No | on | The switch for the protection rule. Valid values: on (default, enable) and off (disable). |
| conditions | Condition | Yes | [{ "key": "Http-Method","subKey": "","opValue": "match-one", "values": "GET,POST,DELETE" }] | The conditions that trigger the rule. For more information about the parameters, see Table 1 Condition metric description. |
| tags | String | Yes | [ "waf_group", "custom_acl"] | The list of protection policy types. |
| regularTypes | String | No | [ [ "sqli", "xss","code_exec", "crlf", "lfilei", "rfilei", "webshell","vvip", "other"] | The type of the regular expression rule. This parameter can be specified when waf_group is included in tags. Valid values: sqli, xss, code_exec, crlf, lfilei, rfilei, webshell, vvip, and other. |
| regularRules | String | No | [ "100001", "100002", "100003"] | The regular expression rule. This parameter can be specified when waf_group is included in tags. This parameter and regularTypes are mutually exclusive. The value is a list of six-digit strings. |
whitelist configuration example:
[
// Skip all scenarios
{
"name": "wl_all",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"waf_group",
"custom_acl",
"ip_blacklist",
"region_block"
]
},
// Skip specified rule IDs in waf_group
{
"name": "wl_waf_id",
"status": "off",
"conditions":
[
{
"key": "Cookie Name",
"subKey": "cdn-sec",
"opValue": "prefix-match",
"values": "a7sdsa9dsa8d8sa"
},
{
"key": "Referer",
"subKey": "",
"opValue": "none",
"values": ""
}
],
"tags":
[
"waf_group"
],
"regularRules":
[
"100001",
"100002",
"100003"
]
},
{
// Skip specified rule types in waf_group
"name": "wl_waf_type",
"status": "on",
"conditions":
[
{
"key": "Query String",
"subKey": "",
"opValue": "exists",
"values": ""
}
],
"tags":
[
"waf_group"
],
"regularTypes":
[
"sqli",
"xss",
"code_exec",
"crlf",
"lfilei",
"rfilei",
"webshell",
"vvip",
"other"
]
},
// Skip custom rules
{
"name": "wl_custom_acl",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"custom_acl"
]
},
// Skip IP blacklist
{
"name": "wl_ip_blacklist",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"ip_blacklist"
]
},
// Skip region blocking
{
"name": "wl_region_block",
"status": "on",
"conditions":
[
{
"key": "Http-Method",
"subKey": "",
"opValue": "match-one",
"values": "GET,POST,DELETE"
}
],
"tags":
[
"region_block"
]
}
]
Protection scenario 4: IP blacklist (ip_blacklist)
| Parameter | Type | Required | Example | Description |
| name | string | Yes | ipblacklist | The name of the protection rule. The name can contain letters, digits, and underscores (_), and can be up to 64 characters in length. |
| status | string | No | on | The switch for the protection rule. Valid values: on (enable) and off (disable). Default value: on. |
| remoteAddr | []String | Yes | ["192.168.0.1","10.10.10.10/24","::1","abcd::abcd","BCDE::BCDE"] | Filters by IP address. For more information, see DescribeDcdnWafFilterInfo. |
| action | string | Yes | deny | The action of the rule. Valid values: deny (block) and monitor (monitor). |
ipblacklist configuration example:
[
{
"name": "ipblacklist",
"status": "on",
"remoteAddr": ["192.168.0.1","10.10.10.10/24","::1","abcd::abcd","BCDE::BCDE"],
"action": "deny"
}
]
Protection scenario 5: Region blocking (region_block)
| Parameter | Type | Required | Example | Description |
| status | string | No | on | The switch for the protection rule. Valid values: on (enable) and off (disable). Default value: on. |
| cnRegionList | string | No | 110000,TW,MO | The blocked regions in the Chinese mainland, separated by commas (,). For more information about the supported regions, see DescribeDcdnWafGeoInfo. |
| otherRegionList | string | No | JP,GB | The blocked regions outside the Chinese mainland, separated by commas (,). For more information about the supported regions, see DescribeDcdnWafGeoInfo. |
| action | string | Yes | deny | The action of the rule. Valid values: deny (block) and monitor (monitor). |
You must specify at least one of cnRegionList and otherRegionList.
region_block configuration example:
[
{
"status": "on",
"cnRegionList": "110000,TW,MO",
"otherRegionList": "JP,GB",
"action": "deny"
}
]
Protection scenario 6: Bot management (bot)
Rule template
All rule parameters include the following four fields. For specific values, refer to the corresponding rule category.
| Parameter | Type | Required | Description |
| type | String | Yes | The rule type. For more information, see the specific rule category. |
| status | String | Yes | The rule status. Valid values: on (enabled) and off (disabled). |
| config | TargetType | No | The rule configuration. For more information, see the specific rule category. |
| action | String | No | The rule action. For more information, see the specific rule category. |
Rule category 1: Protected object type
| Parameter | Type | Required | Example | Description |
| type | String | Yes | target_type | The rule type. Set the value to target_type. |
| status | String | Yes | on | The rule switch. Valid value: on (enabled). |
| config | TargetType | No | {"target":"app"} | The rule configuration. Format: target: the protected object type. Required. Valid values: web (web pages/browsers) and app (apps). |
| action | String | No | Empty | The rule action. Not applicable here. Set it to an empty value. |
Example of protected object type configuration:
[
{
"type":"target_type",
"status":"on",
"config":{"target":"app"},
"action":""
}
]
Rule category 2: Web SDK integration
| Parameter | Type | Required | Example | Description |
| type | String | Yes | web_sdk | The rule type. Set the value to web_sdk. |
| status | String | Yes | on | The rule switch. Valid value: on (enabled). |
| config | WebSdk | No | {"mode":"automatic","crossDomain":"example.com"} | The rule configuration. Format: mode: the Web SDK integration method. Required. Valid values: automatic (automatic integration) and manual (manual integration). crossDomain: the cross-domain domain name call. Optional. This parameter takes effect only when mode is set to automatic. |
| action | String | No | Empty | The rule action. Not applicable here. Set it to an empty value. |
Example of Web SDK integration configuration:
[
{
"type":"web_sdk",
"status":"on",
"config":{"mode":"automatic","crossDomain":"example.com"},
"action":""
}
]
Rule category 3: Traffic features
| Parameter | Type | Required | Example | Description |
| type | String | Yes | traffic_feature | The rule type. Set the value to traffic_feature. |
| status | String | Yes | on | The rule switch. Valid value: on (enabled). |
| config | TrafficFeature | Yes | {"conditions":[{"key":"Header","subKey":"User-Agent","opValue":"contain","values":"Chrome"},{"key":"IP","subKey":"","opValue":"ip-contain","values":"192.168.0.1/24"}]} | The rule configuration. For more information, see condition. |
| action | String | No | Empty | The rule action. Not applicable here. Set it to an empty value. |
condition (Match conditions)
| Parameter | Type | Required | Example | Description |
| key | String | Yes | Header | The match field. For specific values, see DescribeDcdnWafFilterInfo. |
| subKey | String | No | User-Agent | The match subfield. For specific values, see DescribeDcdnWafFilterInfo. |
| opValue | String | Yes | contain | The operator. For specific values, see DescribeDcdnWafFilterInfo. |
| values | String | No | Chrome | The match content. Separate multiple values with commas (,). For specific values, see DescribeDcdnWafFilterInfo. |
Example of traffic feature configuration:
[
{
"type":"traffic_feature",
"status":"on",
"config":{"conditions":[{"key":"Header","subKey":"User-Agent","opValue":"contain","values":"Chrome"},{"key":"IP","subKey":"","opValue":"ip-contain","values":"192.168.0.1/24"}]},
"action":""
}
]
Rule category 4: Legitimate bot management
| Parameter | Type | Required | Example | Description |
| type | String | Yes | intelligence_crawler | The rule type. Set the value to intelligence_crawler. |
| status | String | Yes | on | The rule switch. Valid value: on (enabled). |
| config | IntelligenceCrawler | No | {"name":"intelligence_crawler_baidu"} | The rule configuration. For valid values, see name (Search engine bot whitelist). |
| action | String | Yes | bypass | The rule action. Valid value: bypass (allow). |
name (Search engine bot whitelist)
| Value | Description |
| intelligence_crawler_all | Legitimate search engine whitelist (Google, Bing, Baidu, Sogou, 360, Yandex) |
| intelligence_crawler_baidu | Baidu bot whitelist |
| intelligence_crawler_sogou | Sogou bot whitelist |
| intelligence_crawler_360 | 360 bot whitelist |
| intelligence_crawler_google | Google bot whitelist |
| intelligence_crawler_bing | Bing bot whitelist |
| intelligence_crawler_yandex | Yandex bot whitelist |
Example of legitimate bot management configuration:
[
{
"type":"intelligence_crawler",
"status":"on",
"config":{"name":"intelligence_crawler_baidu"},
"action":"bypass"
},
{
"type":"intelligence_crawler",
"status":"on",
"config":{"name":"intelligence_crawler_google"},
"action":"bypass"
}
]
Rule category 5: Simple script filtering (JavaScript challenge)
| Parameter | Type | Required | Example | Description |
| type | String | Yes | js | The rule type. Set the value to js. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | Js | No | Empty | The rule configuration. Not applicable here. Set it to an empty value. |
| action | String | Yes | js | The rule action. Valid value: js (JavaScript verification). |
Example of simple script filtering (JavaScript challenge) configuration:
[
{
"type":"js",
"status":"on",
"config":{},
"action":"js"
}
]
Rule category 6: Advanced bot protection (dynamic token challenge)
| Parameter | Type | Required | Example | Description |
| type | String | Yes | sigchl | The rule type. Set the value to sigchl. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | Sigchl | No | {"sigchl":["sig","replay","driver"]} | The rule configuration. Format: sigchl: the request data signature verification. Required. Valid values: sig (signature verification exception), replay (signature timestamp exception), and driver (WebDriver attack). |
| action | String | Yes | sigchl | The rule action. Valid value: sigchl (block). |
Example of advanced bot protection (dynamic token challenge) configuration:
[
{
"type":"sigchl",
"status":"on",
"config":{"sigchl":["sig","replay","driver"]},
"action":"sigchl"
}
]
Rule category 7: AI-based intelligent protection
| Parameter | Type | Required | Example | Description |
| type | String | Yes | algorithm | The rule type. Set the value to algorithm. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | Algorithm | No | Empty | The rule configuration. Not applicable here. Set it to an empty value. |
| action | String | Yes | captcha | The rule action. Valid values: monitor (monitor) and captcha (slider CAPTCHA). |
Example of AI-based intelligent protection configuration:
[
{
"type":"algorithm",
"status":"on",
"config":{},
"action":"captcha"
}
]
Rule category 8: IP rate limiting
| Parameter | Type | Required | Example | Description |
| type | String | Yes | custom_cc_ip | The rule type. Set the value to custom_cc_ip. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | CustomCcIp | Yes | {"interval":20,"target":"IP","threshold":50,"ttl":2800} | The rule configuration. For more information, see IP rate limiting config parameter description. |
| action | String | Yes | monitor | The rule action. Valid values: deny (block), monitor (monitor), and captcha (slider CAPTCHA, applicable only to web). |
IP rate limiting config parameter description
| Parameter | Type | Required | Example | Description |
| target | String | Yes | IP | The statistical field for frequency control. Valid value: IP. |
| subKey | String | No | Empty | The subfield of the statistical field. Not applicable here. Set it to an empty value. |
| Interval | Integer | Yes | 20 | The statistical period. Valid values: 5 to 1800. Unit: seconds. |
| threshold | Integer | Yes | 50 | The statistical threshold. Valid values: 2 to 50000. Unit: times. |
| ttl | Integer | Yes | 2800 | The blacklist timeout period. Valid values: 60 to 86400. Unit: seconds. |
Example of IP rate limiting configuration:
[
{
"type":"custom_cc_ip",
"status":"on",
"config":{"interval":20,"target":"IP","threshold":50,"ttl":2800},
"action":"monitor"
},
{
"type":"custom_cc_ip",
"status":"on",
"config":{"interval":10,"target":"IP","threshold":30,"ttl":1800},
"action":"monitor"
}
]
Rule category 9: Device rate limiting
| Parameter | Type | Required | Example | Description |
| type | String | Yes | custom_cc_dev | The rule type. Set the value to custom_cc_dev. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | CustomCcDev | Yes | {"interval":20,"target":"Header","subKey":"aliwaf_wxbb_umid","threshold":50,"ttl":2800} | The rule configuration. For more information, see Device rate limiting config parameter description. |
| action | String | Yes | monitor | The rule action. Valid values: deny (block) and monitor (monitor). |
Device rate limiting config parameter description
| Parameter | Type | Required | Example | Description |
| target | String | Yes | Header | The statistical field for frequency control. Valid value: Header. |
| subKey | String | No | aliwaf_wxbb_umid | The subfield of the statistical field. Valid value: aliwaf_wxbb_umid. |
| Interval | Integer | Yes | 20 | The statistical period. Valid values: 5 to 1800. Unit: seconds. |
| threshold | Integer | Yes | 50 | The statistical threshold. Valid values: 2 to 50000. Unit: times. |
| ttl | Integer | Yes | 2800 | The blacklist timeout period. Valid values: 60 to 86400. Unit: seconds. |
Example of device rate limiting configuration:
[
{
"type":"custom_cc_dev",
"status":"on",
"config":{"interval":20,"target":"Header","subKey":"aliwaf_wxbb_umid","threshold":50,"ttl":2800},
"action":"monitor"
},
{
"type":"custom_cc_dev",
"status":"on",
"config":{"interval":20,"target":"Header","subKey":"aliwaf_wxbb_umid","threshold":50,"ttl":2800},
"action":"deny"
}
]
Rule category 10: Custom session rate limiting
| Parameter | Type | Required | Example | Description |
| type | String | Yes | custom_cc | The rule type. Set the value to custom_cc. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | CustomCcIp | Yes | {"interval":10,"target":"Query String Parameter","subKey":"arg","threshold":30,"ttl":1800} | The rule configuration. For more information, see Custom session rate limiting config parameter description. |
| action | String | Yes | monitor | The rule action. Valid values: deny (block), monitor (monitor), and captcha (slider CAPTCHA, applicable only to web). |
Custom session rate limiting config parameter description
| Parameter | Type | Required | Example | Description |
| target | String | Yes | Query String Parameter | The statistical field for frequency control. Valid values: Header (counts the frequency of requests containing the specified header), Query String Parameter (counts the frequency of requests containing the specified parameter), Cookie Name (counts the frequency of requests containing the specified cookie), and Session (counts the frequency of requests from the same session). |
| subKey | String | No | arg | The subfield of the statistical field. Custom value. |
| Interval | Integer | Yes | 10 | The statistical period. Valid values: 5 to 1800. Unit: seconds. |
| threshold | Integer | Yes | 30 | The statistical threshold. Valid values: 2 to 50000. Unit: times. |
| ttl | Integer | Yes | 2800 | The blacklist timeout period. Valid values: 60 to 86400. Unit: seconds. |
Example of custom session rate limiting configuration:
[
{
"type":"custom_cc",
"status":"on",
"config":{"interval":10,"target":"Query String Parameter","subKey":"arg","threshold":30,"ttl":1800},
"action":"deny"
},
{
"type":"custom_cc",
"status":"on",
"config":{"interval":10,"target":"Query String Parameter","subKey":"arg","threshold":30,"ttl":1800},
"action":"captcha"
}
]
Rule category 11: Bot threat intelligence library
| Parameter | Type | Required | Example | Description |
| type | String | Yes | intelligence | The rule type. Set the value to intelligence. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | Intelligence | No | Empty | The rule configuration. Not applicable here. Set it to an empty value. |
| action | String | Yes | captcha | The rule action. Valid values: monitor (monitor) and captcha (slider CAPTCHA). |
Example of bot threat intelligence library configuration:
[
{
"type":"intelligence",
"status":"on",
"config":{},
"action":"captcha"
}
]
Rule category 12: IDC IP blacklist
| Parameter | Type | Required | Example | Description |
| type | String | Yes | intelligence_idc | The rule type. Set the value to intelligence_idc. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | IntelligenceIdc | Yes | {"name":"intelligence_idc_alibaba"} | The rule configuration. For valid values, see name parameter description. |
| action | String | Yes | captcha | The rule action. Valid values: deny (block), monitor (monitor), and captcha (slider CAPTCHA). |
name parameter description
| Value | Description |
| intelligence_idc_alibaba | IDC IP library - Alibaba Cloud |
| intelligence_idc_tencent | IDC IP library - Tencent Cloud |
| intelligence_idc_mtyun | IDC IP library - Meituan Cloud |
| intelligence_idc_vnet | IDC IP library - 21Vianet |
| intelligence_idc_other | IDC IP library - Others |
Example of IDC IP blacklist configuration:
[
{
"type":"intelligence_idc",
"status":"on",
"config":{"name":"intelligence_idc_alibaba"},
"action":"captcha"
},
{
"type":"intelligence_idc",
"status":"on",
"config":{"name":"intelligence_idc_tencent"},
"action":"captcha"
}
]
Rule category 13: Fake bot blocking
| Parameter | Type | Required | Example | Description |
| type | String | Yes | intelligence_fake_crawler | The rule type. Set the value to intelligence_fake_crawler. |
| status | String | Yes | on | The rule switch. Valid values: on (enabled) and off (disabled). |
| config | IntelligenceFakeCrawler | No | Empty | The rule configuration. Not applicable here. Set it to an empty value. |
| action | String | Yes | deny | The rule action. Valid value: deny (block). |
Example of fake bot blocking configuration:
[
{
"type": "intelligence_fake_crawler",
"status": "on",
"config":{},
"action": "deny"
}
]
Rule category 14: Bot characteristic identification
| Parameter | Type | Required | Example | Description |
| type | String | Yes | app_sdk | The rule type. Set the value to app_sdk. |
| status | String | Yes | on | The rule switch. Valid value: on (enabled). |
| config | AppSdk | Yes | {"featureAbnormal":["simulator","proxy","root","debugged","hook","virtual","antiReplay","signInvalid"],"customSignStatus":"on","customSign":{"key":"header","value":"ua"}} | The rule configuration. For more information, see Bot characteristic identification config parameter description. |
| action | String | Yes | monitor | The rule action. Valid values: deny (block) and monitor (monitor). |
Bot characteristic identification config parameter description
| Parameter | Type | Required | Example | Description |
| featureAbnormal | []String | Yes | simulator | signInvalid: app signature exception. antiReplay: signature expired. simulator: emulator used. proxy: proxy used. root: rooted device. debugged: debugging mode. hook: app hooked. virtual: app multi-opening. |
| customSignStatus | String | No | on | The custom signature field switch. Valid values: on (enabled) and off (disabled). |
| customSign | CustomSign | No | {"key":"header","value":"ua"} | The custom signature field. Format: key: the field name. Required. Valid values: header, arg, and cookie. value: the field value. Required. |
Example of bot characteristic identification configuration:
[
{
"type": "app_sdk",
"status": "on",
"config": {"featureAbnormal":["simulator","proxy","root","debugged","hook","virtual","antiReplay","signInvalid"],"customSignStatus":"on","customSign":{"key":"header","value":"ua"}},
"action": "monitor"
}
]
Rule category 15: Advanced protection (repackaged app detection)
| Parameter | Type | Required | Example | Description |
| type | String | Yes | app_package | The rule type. Set the value to app_package. |
| status | String | Yes | on | The rule switch. Valid value: on (enabled). |
| config | AppPackage | No | {"packageSigns":[{"name":"aaaaa","sign":"bbbb"},{"name":"cccc","sign":"dddd"}]} | The rule configuration. For more information, see packageSigns parameter description. |
| action | String | Yes | monitor | The rule action. Valid values: deny (block) and monitor (monitor). |
packageSigns parameter description
| Parameter | Type | Required | Example | Description |
| name | String | Yes | aaaaa | The valid package name. |
| sign | String | No | bbbb | The package signature. |
Example of advanced protection (repackaged app detection) configuration:
[
{
"type": "app_package",
"status": "on",
"config": {"packageSigns":[{"name":"aaaaa","sign":"bbbb"},{"name":"cccc","sign":"dddd"}]},
"action": "deny"
}
]
Example of combined parameter configuration for bot management web page/browser protection
[
{
"type": "target_type",
"status": "on",
"config":
{
"target": "web"
},
"action": ""
},
{
"type": "web_sdk",
"status": "on",
"config":
{
"mode": "automatic",
"crossDomain": "example.com"
},
"action": ""
},
{
"type": "traffic_feature",
"status": "on",
"config":
{
"conditions":
[
{
"key": "Header",
"subKey": "User-Agent",
"opValue": "contain",
"values": "Chrome"
},
{
"key": "IP",
"subKey": "",
"opValue": "ip-contain",
"values": "192.168.0.1/24"
}
]
},
"action": ""
},
{
"type": "intelligence_crawler",
"status": "on",
"config":
{
"name": "intelligence_crawler_baidu"
},
"action": "bypass"
},
{
"type": "intelligence_crawler",
"status": "on",
"config":
{
"name": "intelligence_crawler_google"
},
"action": "bypass"
},
{
"type": "js",
"status": "on",
"config":
{},
"action": "js"
},
{
"type": "sigchl",
"status": "on",
"config":
{
"sigchl":
[
"sig",
"replay",
"driver"
]
},
"action": "sigchl"
},
{
"type": "algorithm",
"status": "on",
"config":
{},
"action": "captcha"
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 20,
"target": "IP",
"threshold": 50,
"ttl": 2800
},
"action": "monitor"
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 10,
"target": "IP",
"threshold": 30,
"ttl": 1800
},
"action": "monitor"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "deny"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "captcha"
},
{
"type": "intelligence",
"status": "on",
"config":
{},
"action": "captcha"
},
{
"type": "intelligence_idc",
"status": "on",
"config":
{
"name": "intelligence_idc_alibaba"
},
"action": "captcha"
},
{
"type": "intelligence_idc",
"status": "on",
"config":
{
"name": "intelligence_idc_tencent"
},
"action": "captcha"
},
{
"type": "intelligence_fake_crawler",
"status": "on",
"config":
{},
"action": "deny"
}
]
Example of combined parameter configuration for bot management app protection
[
{
"type": "target_type",
"status": "on",
"config":
{
"target": "app"
},
"action": ""
},
{
"type": "traffic_feature",
"status": "on",
"config":
{
"conditions":
[
{
"key": "Header",
"subKey": "User-Agent",
"opValue": "contain",
"values": "Chrome"
},
{
"key": "IP",
"subKey": "",
"opValue": "ip-contain",
"values": "192.168.0.1/24"
}
]
},
"action": ""
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 20,
"target": "IP",
"threshold": 50,
"ttl": 2800
},
"action": "monitor"
},
{
"type": "custom_cc_ip",
"status": "on",
"config":
{
"interval": 10,
"target": "IP",
"threshold": 30,
"ttl": 1800
},
"action": "monitor"
},
{
"type": "custom_cc_dev",
"status": "on",
"config":
{
"interval": 20,
"target": "Header",
"subKey": "aliwaf_wxbb_umid",
"threshold": 50,
"ttl": 2800
},
"action": "monitor"
},
{
"type": "custom_cc_dev",
"status": "on",
"config":
{
"interval": 20,
"target": "Header",
"subKey": "aliwaf_wxbb_umid",
"threshold": 50,
"ttl": 2800
},
"action": "deny"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "monitor"
},
{
"type": "custom_cc",
"status": "on",
"config":
{
"interval": 10,
"target": "Query String Parameter",
"subKey": "arg",
"threshold": 30,
"ttl": 1800
},
"action": "deny"
},
{
"type": "app_sdk",
"status": "on",
"config":
{
"featureAbnormal":
[
"simulator",
"proxy",
"root",
"debugged",
"hook",
"virtual",
"antiReplay",
"signInvalid"
],
"customSignStatus": "on",
"customSign":
{
"key": "header",
"value": "ua"
}
},
"action": "monitor"
},
{
"type": "app_package",
"status": "on",
"config":
{
"packageSigns":
[
{
"name": "aaaaa",
"sign": "bbbb"
},
{
"name": "cccc",
"sign": "dddd"
}
]
},
"action": "deny"
}
]
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
CB1A380B-09F0-41BB-280B-72F8FD6DA2FE |
| RuleIds |
object |
||
| RuleId |
array |
The list of protection rule IDs. |
|
|
string |
The list of IDs of the created rules. |
100001,200002 |
Examples
Success response
JSON format
{
"RequestId": "CB1A380B-09F0-41BB-280B-72F8FD6DA2FE",
"RuleIds": {
"RuleId": [
"100001,200002"
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | A parameter is set to an invalid value. |
| 400 | Policy.NotExist | The specified policy does not exist. | The specified protection policy does not exist. |
| 400 | RuleConfigs.Malformed | The specified RuleConfigs format is invalid. | The RuleConfigs parameter is in an invalid format. |
| 400 | RuleName.AlreadyExists | Rule name already exists in specified policy. | The specified rule name is already used by another rule. |
| 400 | Rule.QuantityOverflow | Rules are overflowed quantity in specified policy. | The number of rules in the specified policy has already reached the upper limit. |
| 500 | InternalError | An internal error occurred; please try again later. | An internal error occurred. Try again later. If the error persists, submit a ticket. |
| 403 | %s.NotSupport | The specified resource type %s is not supported. | The specified resource type is not supported. To use this type of resource, contact us. |
| 403 | %s.OverQuota | The quantity of %s exceeds the quota. | The number of resources exceeds the quota. If you want to apply for more resources, contact us. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.