Skip to content

Commit 79e68f1

Browse files
authored
Merge pull request #2212 from aziontech/EDU-6664-waf-exceptions-api-endpoints
docs(waf): add API documentation for WAF Exceptions and update termin…
2 parents 95b3a80 + 4fc6786 commit 79e68f1

4 files changed

Lines changed: 356 additions & 11 deletions

File tree

src/content/docs/en/pages/main-menu/reference/secure/edge-firewall/web-application-firewall/custom-allowed-rule.mdx

Lines changed: 163 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
---
2-
title: WAF Custom Allowed Rules
2+
title: WAF Exceptions
33
description: >-
4-
Optimize the security of your application with Custom Allowed Rules for
5-
WAF.
6-
meta_tags: 'waf, security, edge computing'
4+
Optimize the security of your application with Exceptions for
5+
WAF. Create, manage, and automate exception rules via API or Console.
6+
meta_tags: 'waf, security, edge computing, exceptions, api'
77
namespace: >-
88
documentation_products_edge_firewall_web_application_firewall_custom_allowed_rules
99
permalink: >-
1010
/documentation/products/secure/firewall/web-application-firewall/custom-allowed-rules/
1111
---
1212

13-
**Web Application Firewall (WAF) Custom Allowed Rules** are configurations that explicitly allow certain request patterns to bypass blocking, overriding the standard WAF security rules that would otherwise identify these requests as potentially malicious. They operate at a high level, analyzing specific components of HTTP requests, such as parameters (ARGS), request body contents (BODY), or the URL path (URL). Each rule is defined with a unique identifier, a match string, and an application zone, ensuring that the security filter remains effective while minimizing blocks on requests containing characteristics considered necessary or legitimate by the user, thus reducing false positives.
13+
**Web Application Firewall (WAF) Exceptions** are configurations that explicitly allow certain request patterns to bypass blocking, overriding the standard WAF security rules that would otherwise identify these requests as potentially malicious. They operate at a high level, analyzing specific components of HTTP requests, such as parameters (ARGS), request body contents (BODY), or the URL path (URL). Each exception is defined with a unique identifier, a match string, and an application zone, ensuring that the security filter remains effective while minimizing blocks on requests containing characteristics considered necessary or legitimate by the user, thus reducing false positives.
14+
15+
:::note
16+
Exceptions were previously referred to as **Allowed Rules** in the Console interface. The API now uses the **Exceptions** terminology. Both terms refer to the same functionality.
17+
:::
1418

1519
## Prerequisites
1620

@@ -162,6 +166,160 @@ See the list of all available internal rules below:
162166
| 1311 | Possible XSS attack: close square bracket `]` found in `Body`, `Path`, `Query String` or `Cookies`. |
163167
| 1312 | Possible XSS attack: tilde character `~` found in `Body`, `Path`, `Query String`, or `Cookies`. |
164168
| 1314 | Possible XSS attack: `` ` `` (*backtick*) found in `Body`, `Path`, `Query String`, or `Cookies`. |
169+
170+
---
171+
172+
## Managing Exceptions via API
173+
174+
You can manage WAF Exceptions programmatically using the Azion API. This enables you to automate the creation, update, and deletion of exceptions, integrate WAF calibration into CI/CD pipelines, and build custom tools for managing your security posture.
175+
176+
### API endpoints
177+
178+
The Exceptions API provides the following operations:
179+
180+
| Operation | Endpoint | Description |
181+
|-----------|----------|-------------|
182+
| List | `GET /v4/edge_firewall/wafs/{waf_id}/exceptions` | List all exceptions for a WAF Rule Set |
183+
| Create | `POST /v4/edge_firewall/wafs/{waf_id}/exceptions` | Create a new exception |
184+
| Retrieve | `GET /v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id}` | Get details of a specific exception |
185+
| Update | `PUT /v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id}` | Update an existing exception |
186+
| Partial update | `PATCH /v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id}` | Update specific fields of an exception |
187+
| Delete | `DELETE /v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id}` | Delete an exception |
188+
189+
For complete API specifications, refer to the [Azion API reference](https://api.azion.com/v4#/operations/list_waf_exceptions).
190+
191+
### Listing exceptions
192+
193+
To retrieve all exceptions configured for a WAF Rule Set:
194+
195+
```bash
196+
curl --request GET \
197+
--url https://api.azion.com/v4/edge_firewall/wafs/{waf_id}/exceptions \
198+
--header 'Accept: application/json' \
199+
--header 'Authorization: Token [TOKEN VALUE]'
200+
```
201+
202+
Response example:
203+
204+
```json
205+
{
206+
"count": 2,
207+
"results": [
208+
{
209+
"id": 1234,
210+
"rule_id": 1000,
211+
"reason": "Allow legitimate API traffic",
212+
"match_zone": "query_string",
213+
"match_pattern": "^[a-zA-Z0-9]+$",
214+
"path": "/api/v1/data",
215+
"active": true
216+
},
217+
{
218+
"id": 5678,
219+
"rule_id": 1302,
220+
"reason": "Allow HTML in specific endpoint",
221+
"match_zone": "body",
222+
"match_pattern": "<script>",
223+
"path": "/api/v1/render",
224+
"active": true
225+
}
226+
]
227+
}
228+
```
229+
230+
### Creating an exception
231+
232+
To create a new exception for a WAF Rule Set:
233+
234+
```bash
235+
curl --request POST \
236+
--url https://api.azion.com/v4/edge_firewall/wafs/{waf_id}/exceptions \
237+
--header 'Accept: application/json' \
238+
--header 'Authorization: Token [TOKEN VALUE]' \
239+
--header 'Content-Type: application/json' \
240+
--data '{
241+
"rule_id": 1000,
242+
"reason": "Allow legitimate API traffic with SQL-like patterns",
243+
"match_zone": "query_string",
244+
"match_pattern": "^[a-zA-Z0-9\\s]+$",
245+
"path": "/api/v1/search",
246+
"active": true
247+
}'
248+
```
249+
250+
### Retrieving a specific exception
251+
252+
To get details of a specific exception:
253+
254+
```bash
255+
curl --request GET \
256+
--url https://api.azion.com/v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id} \
257+
--header 'Accept: application/json' \
258+
--header 'Authorization: Token [TOKEN VALUE]'
259+
```
260+
261+
### Updating an exception
262+
263+
To update all fields of an existing exception:
264+
265+
```bash
266+
curl --request PUT \
267+
--url https://api.azion.com/v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id} \
268+
--header 'Accept: application/json' \
269+
--header 'Authorization: Token [TOKEN VALUE]' \
270+
--header 'Content-Type: application/json' \
271+
--data '{
272+
"rule_id": 1000,
273+
"reason": "Updated reason for the exception",
274+
"match_zone": "query_string",
275+
"match_pattern": "^[a-zA-Z0-9\\s\\-]+$",
276+
"path": "/api/v1/search",
277+
"active": true
278+
}'
279+
```
280+
281+
### Partially updating an exception
282+
283+
To update specific fields without modifying the entire exception:
284+
285+
```bash
286+
curl --request PATCH \
287+
--url https://api.azion.com/v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id} \
288+
--header 'Accept: application/json' \
289+
--header 'Authorization: Token [TOKEN VALUE]' \
290+
--header 'Content-Type: application/json' \
291+
--data '{
292+
"active": false,
293+
"reason": "Temporarily disabled for investigation"
294+
}'
295+
```
296+
297+
### Deleting an exception
298+
299+
To delete an exception:
300+
301+
```bash
302+
curl --request DELETE \
303+
--url https://api.azion.com/v4/edge_firewall/wafs/{waf_id}/exceptions/{exception_id} \
304+
--header 'Accept: application/json' \
305+
--header 'Authorization: Token [TOKEN VALUE]'
306+
```
307+
308+
### Exception object fields
309+
310+
| Field | Type | Description |
311+
|-------|------|-------------|
312+
| `id` | integer | Unique identifier of the exception (read-only) |
313+
| `rule_id` | integer | The WAF internal rule ID to create an exception for. See the [WAF internal rules table](#waf-internal-rules) for available IDs |
314+
| `reason` | string | A description explaining why this exception was created |
315+
| `match_zone` | string | The part of the request to match against. See [Match Zone options](/en/documentation/products/secure/firewall/web-application-firewall/#match-zone-dropdown-options) |
316+
| `match_pattern` | string | The pattern to match in the specified zone |
317+
| `path` | string | The URL path where the exception applies |
318+
| `active` | boolean | Whether the exception is active (`true`) or inactive (`false`) |
319+
320+
:::tip
321+
Use the API to automate WAF calibration workflows. For example, you can create a script that analyzes WAF Tuning data and automatically creates exceptions for verified false positives, or integrate exception management into your CI/CD pipeline to deploy security configurations alongside your application.
322+
:::
165323
| 1400 | Possible trick to evade protection: UTF7/8 encoding `&#` found in `Body`, `Path`, `Query String` or `Cookies`. |
166324
| 1401 | Possible trick to evade protection: M$ encoding `%U` found in `Body`, `Path`, `Query String` or `Cookies`. |
167325
| 1500 | Possible File Upload attempt: `asp/php` or `.ph`, `.asp`, `.ht` found in filename in a multipart POST containing a file. |

src/content/docs/en/pages/main-menu/reference/secure/edge-firewall/web-application-firewall/web-application-firewall.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ By clicking the **Apply filter** button, a list of **Possible Attacks** will be
118118

119119
## Allowed Rules
120120

121-
This tab allows you to create, edit, and delete *Allowed Rules*.
121+
This tab allows you to create, edit, and delete *Allowed Rules* (also referred to as **Exceptions** in the API).
122+
123+
:::note
124+
**Exceptions** is the terminology used in the Azion API. In the Console interface, you'll see **Allowed Rules**. Both terms refer to the same functionality.
125+
:::
122126

123127
The Allowed Rules are composed of the fields:
124128

@@ -162,6 +166,17 @@ Options starting with **Specific** require you to provide a value in the **Name*
162166
The `Last Editor` and `Last Modified` fields are only available through the [API](https://api.azion.com).
163167
:::
164168

169+
### Managing Exceptions via API
170+
171+
You can manage Allowed Rules (Exceptions) programmatically using the Azion API. This enables you to:
172+
173+
- Automate exception creation based on WAF Tuning analysis
174+
- Integrate WAF calibration into CI/CD pipelines
175+
- Build custom tools for managing security configurations
176+
- Bulk update or deactivate exceptions across multiple WAF Rule Sets
177+
178+
For complete API specifications and examples, see the [WAF Exceptions documentation](/en/documentation/products/secure/firewall/web-application-firewall/custom-allowed-rules/#managing-exceptions-via-api) and the [Azion API reference](https://api.azion.com/v4#/operations/list_waf_exceptions).
179+
165180
---
166181

167182
## Limits

0 commit comments

Comments
 (0)