|
1 | 1 | --- |
2 | | -title: WAF Custom Allowed Rules |
| 2 | +title: WAF Exceptions |
3 | 3 | 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' |
7 | 7 | namespace: >- |
8 | 8 | documentation_products_edge_firewall_web_application_firewall_custom_allowed_rules |
9 | 9 | permalink: >- |
10 | 10 | /documentation/products/secure/firewall/web-application-firewall/custom-allowed-rules/ |
11 | 11 | --- |
12 | 12 |
|
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 | +::: |
14 | 18 |
|
15 | 19 | ## Prerequisites |
16 | 20 |
|
@@ -162,6 +166,160 @@ See the list of all available internal rules below: |
162 | 166 | | 1311 | Possible XSS attack: close square bracket `]` found in `Body`, `Path`, `Query String` or `Cookies`. | |
163 | 167 | | 1312 | Possible XSS attack: tilde character `~` found in `Body`, `Path`, `Query String`, or `Cookies`. | |
164 | 168 | | 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 | +::: |
165 | 323 | | 1400 | Possible trick to evade protection: UTF7/8 encoding `&#` found in `Body`, `Path`, `Query String` or `Cookies`. | |
166 | 324 | | 1401 | Possible trick to evade protection: M$ encoding `%U` found in `Body`, `Path`, `Query String` or `Cookies`. | |
167 | 325 | | 1500 | Possible File Upload attempt: `asp/php` or `.ph`, `.asp`, `.ht` found in filename in a multipart POST containing a file. | |
|
0 commit comments