Skip to content

Commit 169f792

Browse files
[DDoS Protection] More overrides (#23364)
* fix overrides logic * typos * header
1 parent e7073a0 commit 169f792

File tree

3 files changed

+52
-67
lines changed

3 files changed

+52
-67
lines changed

src/content/docs/ddos-protection/managed-rulesets/http/http-overrides/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ head:
1111
import { Render } from "~/components"
1212

1313
<Render file="override-logic" />
14+
15+
<Render file="override-example" />
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
{}
3+
4+
---
5+
6+
## Example
7+
8+
A DDoS managed ruleset contains the following managed rules:
9+
10+
- **Managed rule 1**
11+
- **Managed rule 2**
12+
- **Managed rule 3**
13+
14+
The following ruleset overrides have been configured:
15+
16+
- **Ruleset override A**
17+
- **Managed rule 1** is set to `block`
18+
- **Ruleset override B**
19+
- The action of the entire ruleset (or *all managed rules*) is set to `Managed Challenge`
20+
- **Managed rule 1** is set to `log`
21+
- **Managed rule 2** is set to `log`
22+
- **Ruleset override C**
23+
- **Managed rule 3** is set to `log`
24+
25+
### Use case
26+
27+
A DDoS attack was detected on **managed rules 1**, **2**, and **3**, and has generated a mitigation rule.
28+
29+
- Since **managed rule 1** matches **ruleset override A**, Cloudflare will `block` the attacks and not proceed with the rest of the rules.
30+
31+
- **Managed rule 2** does not match **ruleset override A**, so Cloudflare proceeds to **ruleset override B**. <br /> **Ruleset override B** matches both all managed rules and **managed rule 2**, but specificity takes precedence. It does not `challenge` and instead proceeds with `log` since it matches the most specific managed rule.
32+
33+
- **Managed rule 3** does not match **ruleset override A**, so Cloudflare proceeds to **rule override B**. Since **ruleset override B** sets *all managed rules* to `challenge`, then Cloudflare does not proceed to **ruleset override C**.
34+
35+
An additional dimension to take into account is Cloudflare’s DDoS systems will apply a given rule override only if its conditions are met — which includes the Sensitivity level. So, while it needs to match and modify the correct managed rule (or everything in the case of all managed rules above), it also has to meet the specified Sensitivity level of the rule.
36+
37+
- **Rule override A**
38+
- *All managed rules* are set to `challenge` at low sensitivity
39+
40+
- **Rule override B**
41+
- **Managed rule 1** is set to `log` at default sensitivity
42+
43+
You receive a small attack below the threshold for low sensitivity, but above the threshold for high sensitivity on **managed rule 1**.
44+
45+
- **Rule override A** does not meet the low sensitivity threshold. Therefore, we do not match the override and do not mitigate the attack, but proceed to evaluate the next managed rule in case the rule override instructs DoS to mitigate.
46+
- **Rule override B** sets `log` at default visibility, which matches the condition. So, the defined action is applied and attack traffic is logged.

src/content/partials/ddos-protection/override-logic.mdx

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,10 @@
33

44
---
55

6-
When Cloudflare's DDoS Protection systems detect an attack, mitigations are emitted against it. Each mitigation has a single managed rule from the managed ruleset associated with it.
6+
When Cloudflare's DDoS Protection systems detect an attack, an ephemeral mitigation rule is created and installed in-line to mitigate the attack. A mitigation rule is generated based on the logic of the DDoS Protection managed ruleset. Each mitigation rule is generated from a single managed rule.
77

8-
All mitigations and its associated managed rules are evaluated in order by DDoS Protection systems one by one.
8+
All mitigations and its associated managed rules are evaluated in order by the DDoS systems one by one. Cloudflare will go through all of the rule overrides defined in the ruleset overrides until one matches the managed rule, and apply the action and stop at that point. Otherwise, the evaluation will continue in order until a rule matches.
99

10-
You can create only one override ruleset that can contain one or multiple override rules. An override rule instructs the DDoS Protection system on the action it should take based on its matching managed rule.
10+
You can create only one ruleset override that can contain one or multiple rule overrides. A rule override instructs the DDoS system on the action it should take against the attack according to its matching managed rule.
1111

12-
For each active mitigation that is linked to a single managed rule, Cloudflare will go through all of the override rules defined in the override ruleset until one matches the managed rule, and apply the action and stop at that point. Otherwise, evaluation will continue in order until a rule matches.
13-
14-
However, within an override rule, specificity matters. If the override rule has the following two elements defined, then DDoS Protection systems will prioritize specificity when evaluating overrides:
15-
16-
- All of the managed rules in the ruleset are set to a specific action.
17-
- A managed rule within that ruleset is set to a different action from the rest of the rules.
18-
19-
## Examples
20-
21-
### General example
22-
23-
A managed ruleset contains the following managed rules:
24-
25-
- Managed rule 1
26-
- Managed rule 2
27-
- Managed rule 3
28-
29-
An override ruleset contains the following override rules:
30-
31-
- Override rule 1
32-
- Managed rule 1 is set to `block`
33-
- Override rule 2
34-
- *All managed rules* are set to `challenge`
35-
- Managed rule 1 is set to `log`
36-
- Managed rule 2 is set to `log`
37-
- Override rule 3
38-
- Managed rule 3 is set to `log`
39-
40-
If DDoS Protection triggers three mitigations — one linked with an individual managed rule — then the override for each mitigation is evaluated one by one.
41-
42-
**Mitigation 1 linked with managed rule 1**
43-
44-
Since managed rule 1 matches override rule 1, Cloudflare will `block` the attacks and not proceed with the rest of the rules.
45-
46-
**Mitigation 2 linked with managed rule 2**
47-
48-
Since managed rule 2 does not match override rule 1, Cloudflare will proceed to override rule 2.
49-
50-
Override rule 2 matches both *All managed rules* and managed rule 2, but specificity takes precedent. It does not `challenge` as dictated by *All managed rules* and instead proceeds with `log` since it matches the most specific managed rule.
51-
52-
**Mitigation 3 linked with managed rule 3**
53-
54-
Since managed rule 3 does not match override rule 1, Cloudflare will proceed to override rule 2.
55-
56-
Override rule 2 sets *All managed rules* to `challenge`, so Cloudflare challenges the attack and does not proceed to override rule 3.
57-
58-
---
59-
60-
### Sensitivity example
61-
62-
An additional dimension to take into account is Cloudflare will apply a given Override Rule only if its conditions are met, which includes the Sensitivity level.
63-
64-
While the override rule needs to match and modify the correct managed rule (or all managed rules in the case of mitigation 3 above), it also has to meet the specified Sensitivity level of the rule.
65-
66-
- Override rule 1
67-
- All managed rules are set to `challenge` at `low` sensitivity
68-
69-
- Override rule 2
70-
- Managed rule 1 is set to `log` at `default` sensitivity.
71-
72-
**Scenario**: You receive a small attack below the threshold for `low` sensitivity, but above the threshold for `high` sensitivity on managed rule 1.
73-
74-
- Override rule 1 does not meet the `low` sensitivity threshold. Therefore, we do not match the override and do not mitigate the attack, but proceed to evaluate the next managed rule in case the override rules instruct DDoS Protection to mitigate.
75-
- Override rule 2 sets `log` at default visibility, which matches the condition, so the defined action is applied and attack traffic is logged.
12+
However, within a rule override, specificity matters and the DDoS system will choose the more specific configuration. A rule override takes precedence over the ruleset override.

0 commit comments

Comments
 (0)