WAF Insights does not support automation via our REST API web service. If you are currently using WAF Insights, upgrade your WAF solution to take advantage of our REST API.
Retrieves a bot rule set. A bot rule set contains one or more bot rules. Each bot rule defines the set of requests that will require a client (e.g., a web browser) to solve a challenge before resolving the request.
Key information:
There are two types of bot rules:
Reputation Database: A bot rule that relies on our reputation database is defined through the directive.include property.
Example:
{ "directive": [{ "include": "r3010_ec_bot_challenge_reputation.conf.json" ...
Custom Match Conditions: A bot rule that contains match conditions is defined through a directive.sec_rule object.
Define criteria by specifying an operator object and one or more variable object(s). A set of criteria is satisfied when at least one variable object results in a successful match.
You may also transform the source string via the action object to simplify matching. For example, you may transform the source string to all lowercase characters.
The variable.type property determines the type of variable (e.g., REQUEST_HEADERS) through which traffic will be identified. Define a value property within the match object to further restrict the comparison (e.g., User-Agent).
A request will satisfy the following configuration when the value corresponding to any of its request headers contains the word Windows:
... "operator": { "type": "CONTAINS", "value": "Windows" }, "variable": [{ "match": [{ "is_negated": false, "is_regex": false, } ], "type": "REQUEST_HEADERS" } ...
The following code excerpt adds a value property to the match object that restricts the current variable (i.e., REQUEST_HEADERS) to User-Agent. This means that a request will only satisfy this configuration when the User-Agent request header contains the word Windows.
... "operator": { "type": "CONTAINS", "value": "Windows" }, "variable": [{ "match": [{ "value": "User-Agent" } ], "type": "REQUEST_HEADERS" } ...
An alternative to a string comparison is to count the number of times that a variable is found within a request. This requires the following configuration:
A request will satisfy the following configuration when it contains 2 User-Agent request headers:
... "operator": { "is_negated": false, "type": "EQ", "value": "2" }, "variable": [{ "is_count": true, "match": [{ "is_negated": false, "is_regex": false, "value": "User-Agent" } ], "type": "REQUEST_HEADERS" } ...
A request satisfies a bot rule when all of the following conditions are met:
A request to retrieve a bot rule set is described below.
HTTP Method | Request URI |
---|---|
GET |
https://api.edgecast.com/v2/mcc/customers/AccountNumber/waf/v1.0/bots/Bot Rule Set ID |
Define the following variables when submitting the above request:
VariableA variable represents a value that must be replaced. A variable consists of either a URL segment (e.g., "0001" in /0001/) or a query string value (e.g., "3" in mediaTypes=3). | Description |
---|---|
Required |
|
Required |
Replace this variable with the system-defined ID for the desired bot rule set. Use the Get All Bot Rule Sets endpoint to retrieve a list of bot rule sets and their system-defined IDs |
This endpointIdentifies a request's connection point to our REST API service. only takes advantage of common request headers.
Request body parameters are not required by this endpoint.
The response to the above request includes an HTTP status code, response headers, and a response body.
A status code indicates whether the request was successfully performed.
The response for this endpoint only includes standard HTTP response headers.
The response body for a successful request contains the following response elements for each bot rule set:
Name | Data Type | Description |
---|---|---|
customer_id |
String |
Identifies your account by its customer account number. |
directive |
Array Objects |
Contains the bot rules associated with this bot rule set. |
id |
String |
Indicates the system-defined ID for this bot rule set. |
last_modified_date |
String |
Indicates the timestamp at which this bot rule set was last modified. Syntax: YYYY-MM-DDThh:mm:ss:ffffffZ
|
name |
String |
Indicates the name assigned to this bot rule set. |
The directive array describes each bot rule through the following properties:
Name | Data Type | Description |
---|---|---|
include |
String |
Identifies a bot rule that uses our reputation database. This type of rule is satisfied when the client's IP address matches an IP address defined within our reputation database. Our reputation database contains a list of IP addresses known to be used by bots. This property is only returned when your bot rule set contains a bot rule that uses our reputation database. Returns the following value: r3010_ec_bot_challenge_reputation.conf.json
|
sec_rule |
Object |
Identifies a bot rule that uses custom match conditions. This type of rule is satisfied when a match is found for each of its conditions. A condition determines request identification by defining what will be matched (i.e., variable), how it will be matched (i.e., operator), and a match value. |
The sec_rule object describes a bot rule using the following properties:
Name | Data Type | Description |
---|---|---|
Object |
Determines whether the string identified in a variable object will be transformed and metadata through which you may identify traffic to which this bot rule was applied. |
|
Array Object |
Contains additional criteria that must be satisfied to identify traffic to which this bot rule will be applied. You may add up to 5 chained_rule objects per bot rule. |
|
id |
String |
Indicates the system-defined ID for this bot rule. |
name |
String |
Indicates the name assigned to this bot rule. |
Object |
Indicates the comparison that will be performed against the request element(s) identified within a variable object. |
|
Array Object |
Contains criteria that identifies a request element. |
The variable array identifies each request element for which a comparison will be made using the following properties:
Name | Data Type | Description |
---|---|---|
type |
String |
Determines the request element that will be assessed. Valid values are: GEOIdentifies the country from which the request originated by its 2 character country code. | QUERY_STRING | REMOTE_ADDRIdentifies the client's IP address. | REMOTE_ASN | REQUEST_COOKIES | REQUEST_FILENAMERequest URL Path: Match against the request's URL path. Define a URL path that starts directly after the hostname. Exclude the protocol, hostname, and query string when defining this property. | REQUEST_HEADERS | REQUEST_METHOD | REQUEST_URI
If a request element consists of one or more key-value pairs (e.g., REQUEST_HEADERS), then you may identify a key via a match object. If is_count has been disabled, then you may identify a specific value via the operator object. |
Array Object |
Contains comparison settings for the request element identified by the type property. |
|
Boolean |
Determines whether a comparison will be performed between the operator object and a string value or the number of matches found. Valid values are:
|
The match array determines the comparison conditions for the request element identified by the type property.
Name | Data Type | Description |
---|---|---|
is_negated |
Boolean |
Determines whether this condition is satisfied when the request element identified by the variable object is found or not found.
|
is_regex |
Boolean |
Determines whether the value property will be interpreted as a regular expression. Valid values are:
|
value |
String |
Restricts the match condition defined by the type property to the specified value. Example: If the type property is set to REQUEST_HEADERS and this property is set to User-Agent, then this match condition is restricted to the User-Agent request header. If the value property is omitted, then this match condition applies to all request headers. |
The action object determines whether the value derived from the request element identified in a variable object will be transformed and the metadata that will be used to identify traffic to which this bot rule was applied.
Name | Data Type | Description |
---|---|---|
id |
String |
Determines the custom ID that will be assigned to this bot rule. This custom ID is exposed via the Browser Challenges Dashboard. Valid values fall within this range: 77000000 - 77999999
This field is only applicable for the action object that resides in the root of the sec_rule object. Default Value: Random number |
msg |
String |
Determines the rule message that will be assigned to this bot rule. This message is exposed through the Browser Challenges Dashboard. This field is only applicable for the action object that resides in the root of the sec_rule object. Default Value: Blank |
t |
Array String values |
Determines the set of transformations that will be applied to the value derived from the request element identified in a variable object (i.e., source value). Transformations are always applied to the source value, regardless of the number of transformations that have been defined. Valid values are:
A criterion is satisfied if the source value or any of the modified string values meet the conditions defined by the operator object. |
The operator object describes the comparison that will be performed on the request element(s) defined within a variable object using the following properties:
Name | Data Type | Description |
---|---|---|
is_negated |
Boolean |
Indicates whether a condition will be satisfied when the value derived from the request element defined within a variable object matches or does not match the value property. Valid values are:
|
type |
Indicates how the system will interpret the comparison between the value property and the value derived from the request element defined within a variable object. Valid values are:
|
|
value |
String |
Indicates a value that will be compared against the string or number value derived from the request element defined within a variable object. |
Each object within the chained_rule array describes an additional set of criteria that must be satisfied in order to identify a malicious request.
Name | Data Type | Description |
---|---|---|
Object |
Determines whether the string value derived from the request element identified in a variable object will be transformed and metadata through which you may identify traffic to which this bot rule was applied. |
|
Object |
Indicates the comparison that will be performed on the string value(s) derived from the request element(s) defined within the variable array. |
|
Array Object |
Identifies each request element for which a comparison will be made. |
The response body for an unsuccessful request may contain an error element that provides additional information.
A sample JSON request is shown below.
GET https://api.edgecast.com/v2/mcc/customers/0001/waf/v1.0/bots/pfJKToQF HTTP/1.1
Authorization: TOK:12345678-1234-1234-1234-1234567890ab
Accept: application/json
Content-Type: application/json
Host: api.edgecast.com
A sample JSON response is shown below.
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Date: Thu, 15 Apr 2021 12:00:00 GMT
Content-Length: 750
{ "customer_id": "0001", "directive": [{ "include": "r3010_ec_bot_challenge_reputation.conf.json" }, { "sec_rule": { "action": { "id": "77000001", "t": [ "NONE" ] }, "chained_rule": [], "id": "Ukg1khPJ", "name": "Popular Bots", "operator": { "type": "RX", "value": ".*(Googlebot|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Spider|Exabot).*" }, "variable": [{ "match": [{ "value": "User-Agent" } ], "type": "REQUEST_HEADERS" } ] } } ], "id": "pfJKToQF", "last_modified_by": "joe@example.com via MCC portal", "last_modified_date": "2022-05-04T17:18:33.017946Z", "name": "My Bot Rule Set" }