Skip to content

Commit bc7a3ce

Browse files
[WAF] Add OWASP account config example (#17533)
--------- Co-authored-by: marciocloudflare <[email protected]>
1 parent 4f45fc1 commit bc7a3ce

File tree

4 files changed

+103
-12
lines changed

4 files changed

+103
-12
lines changed

src/content/docs/waf/account/managed-rulesets/index.mdx

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 4
66
---
77

8-
import { Render } from "~/components";
8+
import { Render, Tabs, TabItem, Details } from "~/components";
99

1010
:::note
1111
This feature requires an Enterprise plan with a paid add-on.
@@ -17,7 +17,96 @@ This feature requires an Enterprise plan with a paid add-on.
1717

1818
At the account level, you can deploy each [WAF managed ruleset](/waf/managed-rules/#managed-rulesets) more than once. This means that you can apply the same managed ruleset with different configurations to different subsets of incoming traffic for the Enterprise zones in your account.
1919

20-
For example, you could deploy the [Cloudflare OWASP Core Ruleset](/waf/managed-rules/reference/owasp-core-ruleset/) multiple times with different paranoia levels and a different action (_Log_ action for PL4 and _Block_ action for PL2).
20+
For example, you could deploy the [Cloudflare OWASP Core Ruleset](/waf/managed-rules/reference/owasp-core-ruleset/) multiple times with different paranoia levels and a different action (_Managed Challenge_ action for PL3 and _Log_ action for PL4).
21+
22+
<Details header="Example: Deploy OWASP with two different configurations">
23+
24+
The following example deploys the [Cloudflare OWASP Core Ruleset](/waf/managed-rules/reference/owasp-core-ruleset/) multiple times at the account level through the following execute rules:
25+
26+
- First execute rule: Enable OWASP rules up to paranoia level 3 (PL3) and set the action to _Managed Challenge_.
27+
- Second execute rule: Enable OWASP rules up to PL4 and set the action to _Log_.
28+
29+
This configuration gives you additional protection by enabling PL3 rules, but without blocking the requests, since higher paranoia levels are more prone to false positives.
30+
31+
The second rule logs any matches for PL4 rules, the most strict set of rules in the ruleset, so that it does not affect live traffic. You could use this configuration to understand which traffic would be affected by PL4 rules.
32+
33+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
34+
35+
1. Deploy the Cloudflare OWASP Core Ruleset by following the [dashboard instructions](/waf/account/managed-rulesets/deploy-dashboard/#deploy-a-managed-ruleset), customizing the ruleset behavior using these settings:
36+
37+
- **OWASP Anomaly Score Threshold**: _Medium - 40 and higher_
38+
- **OWASP Paranoia Level**: _PL3_
39+
- **OWASP Action**: _Managed Challenge_
40+
41+
2. Select **Deploy**.
42+
43+
3. Repeat the deployment procedure for the OWASP ruleset, but with following ruleset configuration:
44+
45+
- **OWASP Anomaly Score Threshold**: _Medium - 40 and higher_
46+
- **OWASP Paranoia Level**: _PL4_
47+
- **OWASP Action**: _Log_
48+
49+
Once you finish your configuration, the **Deployed managed rulesets** list will show two _Execute_ rules for the Cloudflare OWASP Core Ruleset.
50+
51+
</TabItem> <TabItem label="API">
52+
53+
The following `POST` request for the [Create an account ruleset](/api/operations/createAccountRuleset) operation creates an [entry point ruleset](/ruleset-engine/about/rulesets/#entry-point-ruleset) for the `http_request_firewall_managed` phase at the account level. The ruleset includes two rules deploying the Cloudflare OWASP Core Ruleset twice with different configurations.
54+
55+
```bash
56+
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/rulesets" \
57+
--header "Authorization: Bearer <API_TOKEN>" \
58+
--header "Content-Type: application/json" \
59+
--data '{
60+
"name": "My ruleset",
61+
"description": "Entry point ruleset for WAF managed rulesets (account)",
62+
"kind": "root",
63+
"phase": "http_request_firewall_managed",
64+
"rules": [
65+
{
66+
"action": "execute",
67+
"action_parameters": {
68+
"id": "4814384a9e5d4991b9815dcfc25d2f1f",
69+
"overrides": {
70+
"categories": [
71+
{
72+
"category": "paranoia-level-4",
73+
"enabled": false
74+
}
75+
],
76+
"rules": [
77+
{
78+
"id": "6179ae15870a4bb7b2d480d4843b323c",
79+
"action": "managed_challenge"
80+
}
81+
]
82+
}
83+
},
84+
"expression": "cf.zone.plan eq \"ENT\"",
85+
"description": "Execute OWASP ruleset at PL3 with Managed Challenge action"
86+
},
87+
{
88+
"action": "execute",
89+
"action_parameters": {
90+
"id": "4814384a9e5d4991b9815dcfc25d2f1f",
91+
"overrides": {
92+
"rules": [
93+
{
94+
"id": "6179ae15870a4bb7b2d480d4843b323c",
95+
"action": "log"
96+
}
97+
]
98+
}
99+
},
100+
"expression": "cf.zone.plan eq \"ENT\"",
101+
"description": "Execute OWASP ruleset at PL4 with Log action"
102+
}
103+
]
104+
}'
105+
```
106+
107+
</TabItem> </Tabs>
108+
109+
</Details>
21110

22111
<Render
23112
file="managed-ruleset-config-options"

src/content/docs/waf/managed-rules/reference/owasp-core-ruleset/concepts.mdx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ sidebar:
66
head:
77
- tag: title
88
content: OWASP ruleset concepts
9-
109
---
1110

1211
## Paranoia level
1312

14-
The paranoia level (PL) classifies OWASP rules according to their aggressiveness. Paranoia levels vary from PL1 to PL4, where PL4 is the most strict level.
13+
The paranoia level (PL) classifies OWASP rules according to their aggressiveness. Paranoia levels vary from PL1 to PL4, where PL4 is the most strict level:
14+
15+
- PL1 (default value)
16+
- PL2
17+
- PL3
18+
- PL4
1519

1620
Each rule in the OWASP managed ruleset is associated with a paranoia level. Rules associated with higher paranoia levels are considered more aggressive and provide increased protection. However, they might cause more legitimate traffic to get blocked due to false positives.
1721

@@ -29,8 +33,8 @@ The score threshold (or anomaly threshold) defines the minimum cumulative score
2933

3034
The available score thresholds are the following:
3135

32-
* *Low – 60 and higher*
33-
* *Medium – 40 and higher* (default value)
34-
* *High – 25 and higher*
36+
- _Low – 60 and higher_
37+
- _Medium – 40 and higher_ (default value)
38+
- _High – 25 and higher_
3539

36-
Each threshold (*Low*, *Medium*, and *High*) has an associated value (*60*, *40*, and *25*, respectively). Configuring a *Low* threshold means that more rules will have to match the current request for the WAF to apply the configured ruleset action. For an example, refer to [OWASP evaluation example](/waf/managed-rules/reference/owasp-core-ruleset/example/).
40+
Each threshold (_Low_, _Medium_, and _High_) has an associated value (_60_, _40_, and _25_, respectively). Configuring a _Low_ threshold means that more rules will have to match the current request for the WAF to apply the configured ruleset action. For an example, refer to [OWASP evaluation example](/waf/managed-rules/reference/owasp-core-ruleset/example/).

src/content/docs/waf/managed-rules/reference/owasp-core-ruleset/configure-api.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ This example sets the Cloudflare OWASP Core Ruleset's paranoia level for a zone
115115
"action": "execute",
116116
"action_parameters": {
117117
"id": "4814384a9e5d4991b9815dcfc25d2f1f",
118-
"version": "latest",
119118
"overrides": {
120119
"categories": [
121120
{
@@ -260,7 +259,7 @@ This example configures the managed ruleset score threshold and the performed ac
260259
- `"score_threshold": 60`
261260
- `"action": "managed_challenge"`
262261

263-
```bash null {10-18}
262+
```bash null {9-17}
264263
curl --request PATCH \
265264
"https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/{entry_point_ruleset_id}/rules/{execute_rule_id}" \
266265
--header "Authorization: Bearer <API_TOKEN>" \
@@ -269,7 +268,6 @@ This example configures the managed ruleset score threshold and the performed ac
269268
"action": "execute",
270269
"action_parameters": {
271270
"id": "4814384a9e5d4991b9815dcfc25d2f1f",
272-
"version": "latest",
273271
"overrides": {
274272
"rules": [
275273
{

src/content/docs/waf/managed-rules/reference/owasp-core-ruleset/example.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Example
2+
title: Evaluation example
33
pcx_content_type: concept
44
sidebar:
55
order: 3

0 commit comments

Comments
 (0)