Skip to content

Commit e6e9dca

Browse files
authored
[WAF] Filter/hide API permissions (#23559)
1 parent 3a3b8fb commit e6e9dca

File tree

14 files changed

+146
-91
lines changed

14 files changed

+146
-91
lines changed

src/content/docs/waf/account/custom-rulesets/create-api.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The following example creates a custom ruleset with a single rule in the `rules`
4848
],
4949
phase: "http_request_firewall_custom",
5050
}}
51+
roles="account"
5152
/>
5253

5354
Save the ruleset ID in the response for the next step.
@@ -67,6 +68,7 @@ To deploy the custom ruleset, add a rule with `"action": "execute"` to the `http
6768
parameters={{
6869
ruleset_phase: "http_request_firewall_custom",
6970
}}
71+
roles="account"
7072
/>
7173

7274
```json output {4}
@@ -110,6 +112,7 @@ To deploy the custom ruleset, add a rule with `"action": "execute"` to the `http
110112
},
111113
enabled: true,
112114
}}
115+
roles="account"
113116
/>
114117

115118
:::caution
@@ -142,6 +145,7 @@ To deploy the custom ruleset, add a rule with `"action": "execute"` to the `http
142145
],
143146
phase: "http_request_firewall_custom",
144147
}}
148+
roles="account"
145149
/>
146150

147151
## Next steps

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ The second rule logs any matches for PL4 rules, the most strict set of rules in
3333
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
3434

3535
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-
3736
- **OWASP Anomaly Score Threshold**: _Medium - 40 and higher_
3837
- **OWASP Paranoia Level**: _PL3_
3938
- **OWASP Action**: _Managed Challenge_
4039

4140
2. Select **Deploy**.
4241

4342
3. Repeat the deployment procedure for the OWASP ruleset, but with following ruleset configuration:
44-
4543
- **OWASP Anomaly Score Threshold**: _Medium - 40 and higher_
4644
- **OWASP Paranoia Level**: _PL4_
4745
- **OWASP Action**: _Log_
@@ -102,6 +100,7 @@ The following `POST` request for the [Create an account ruleset](/api/resources/
102100
},
103101
],
104102
}}
103+
roles="account"
105104
/>
106105

107106
</TabItem> </Tabs>

src/content/docs/waf/account/rate-limiting-rulesets/create-api.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ The following example creates a rate limiting ruleset with a single rate limitin
6464
],
6565
phase: "http_ratelimit",
6666
}}
67+
roles="account"
6768
/>
6869

6970
The available characteristics depend on your Cloudflare plan and product subscriptions. Refer to [Availability](/waf/rate-limiting-rules/#availability) for more information.
@@ -85,6 +86,7 @@ To deploy the rate limiting ruleset, add a rule with `"action": "execute"` to th
8586
parameters={{
8687
ruleset_phase: "http_ratelimit",
8788
}}
89+
roles="account"
8890
/>
8991

9092
```json output {4}
@@ -129,6 +131,7 @@ To deploy the rate limiting ruleset, add a rule with `"action": "execute"` to th
129131
},
130132
enabled: true,
131133
}}
134+
roles="account"
132135
/>
133136

134137
<Render file="account-enterprise-zones-only-api" />
@@ -159,6 +162,7 @@ To deploy the rate limiting ruleset, add a rule with `"action": "execute"` to th
159162
],
160163
phase: "http_ratelimit",
161164
}}
165+
roles="account"
162166
/>
163167

164168
For examples of rate limiting rule definitions for the API, refer to the [zone-level API documentation](/waf/rate-limiting-rules/create-api/).

src/content/docs/waf/custom-rules/create-api.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The new rule, which will be the last rule in the ruleset, will challenge request
4444
'(ip.src.country eq "GB" or ip.src.country eq "FR") and cf.waf.score lt 20',
4545
action: "challenge",
4646
}}
47+
roles={false}
4748
/>
4849

4950
<Render file="api-create-ruleset-with-rule" />
@@ -70,6 +71,7 @@ The new rule, which will be the last rule in the ruleset, includes the definitio
7071
},
7172
},
7273
}}
74+
roles={false}
7375
/>
7476

7577
<Render file="api-create-ruleset-with-rule" />

src/content/docs/waf/custom-rules/skip/api-examples.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This example invokes the [Create a zone ruleset rule](/api/resources/rulesets/su
4141
expression: 'http.request.uri.path contains "/skip-current-ruleset/"',
4242
description: "",
4343
}}
44+
roles={false}
4445
/>
4546

4647
## Skip a phase
@@ -58,6 +59,7 @@ This example invokes the [Create a zone ruleset rule](/api/resources/rulesets/su
5859
expression: 'http.request.uri.path contains "/skip-phase/"',
5960
description: "",
6061
}}
62+
roles={false}
6163
/>
6264

6365
Refer to [Available skip options](/waf/custom-rules/skip/options/) for the list of phases you can skip.
@@ -83,6 +85,7 @@ This example invokes the [Create a zone ruleset rule](/api/resources/rulesets/su
8385
expression: 'http.request.uri.path contains "/disable-logging/"',
8486
description: "",
8587
}}
88+
roles={false}
8689
/>
8790

8891
Refer to [Available skip options: Logging](/waf/custom-rules/skip/options/#logging) for more information on disabling logging for requests that match a skip rule.
@@ -102,6 +105,7 @@ This example uses the [Create a zone ruleset rule](/api/resources/rulesets/subre
102105
expression: 'http.request.uri.path contains "/skip-products/"',
103106
description: "",
104107
}}
108+
roles={false}
105109
/>
106110

107111
Refer to [Available skip options](/waf/custom-rules/skip/options/) for the list of products you can skip.

src/content/docs/waf/managed-rules/check-for-exposed-credentials/configure-api.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ This `POST` request example creates a new custom ruleset with a rule that checks
7575
],
7676
phase: "http_request_firewall_custom",
7777
}}
78+
roles="account"
7879
/>
7980

8081
The response returns the created ruleset. Note the presence of the `exposed_credential_check` object on the rule definition.
@@ -153,6 +154,7 @@ This `POST` request example creates a new custom ruleset with a rule that checks
153154
],
154155
phase: "http_request_firewall_custom",
155156
}}
157+
roles="account"
156158
/>
157159

158160
The response returns the created ruleset. Note the presence of the following elements in the rule definition:

src/content/docs/waf/managed-rules/payload-logging/configure-api.mdx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Use the [Rulesets API](/ruleset-engine/rulesets-api/) to configure payload loggi
1616
## Configure and enable payload logging
1717

1818
1. Use the [Get a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/get/) operation to obtain the following IDs:
19-
2019
- The ID of the [entry point ruleset](/ruleset-engine/about/rulesets/#entry-point-ruleset) of the `http_request_firewall_managed` [phase](/ruleset-engine/about/phases/).
2120
- The ID of the `execute` rule deploying the WAF managed ruleset, for which you want to configure payload logging.
2221

@@ -48,14 +47,15 @@ To configure payload logging for a managed ruleset deployed at the account level
4847

4948
This example configures payload logging for the [Cloudflare Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/), which is already deployed for a zone with ID `$ZONE_ID`.
5049

51-
1. Invoke the [Get a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/get/) operation (a `GET` request) to obtain the rules currently configured in the entry point ruleset of the `http_request_firewall_managed` phase.
50+
1. Invoke the [Get a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/get/) operation to obtain the rules currently configured in the entry point ruleset of the `http_request_firewall_managed` phase.
5251

5352
<APIRequest
5453
path="/zones/{zone_id}/rulesets/phases/{ruleset_phase}/entrypoint"
5554
method="GET"
5655
parameters={{
5756
ruleset_phase: "http_request_firewall_managed",
5857
}}
58+
roles={false}
5959
/>
6060

6161
```json output {3,12,20}
@@ -94,7 +94,6 @@ This example configures payload logging for the [Cloudflare Managed Ruleset](/wa
9494
```
9595

9696
2. Save the following IDs for the next step:
97-
9897
- The ID of the entry point ruleset: `060013b1eeb14c93b0dcd896537e0d2c`
9998
- The ID of the `execute` rule deploying the Cloudflare Managed Ruleset: `1bdb49371c1f46958fc8b985efcb79e7`
10099

@@ -105,7 +104,7 @@ This example configures payload logging for the [Cloudflare Managed Ruleset](/wa
105104
To get the IDs of existing WAF managed rulesets, refer to [WAF Managed Rules](/waf/managed-rules/#available-managed-rulesets) or use the [List account rulesets](/api/resources/rulesets/methods/list/) operation.
106105
:::
107106

108-
3. Invoke the [Update a zone ruleset rule](/api/resources/rulesets/methods/update/) operation (a `PATCH` request) to update the configuration of the rule you identified. The rule will now include the payload logging configuration (`matched_data` object).
107+
3. Invoke the [Update a zone ruleset rule](/api/resources/rulesets/methods/update/) operation to update the configuration of the rule you identified. The rule will now include the payload logging configuration (`matched_data` object).
109108

110109
<APIRequest
111110
path="/zones/{zone_id}/rulesets/{ruleset_id}/rules/{rule_id}"
@@ -124,6 +123,10 @@ This example configures payload logging for the [Cloudflare Managed Ruleset](/wa
124123
},
125124
expression: "true",
126125
}}
126+
code={{
127+
mark: [8, 9, 10],
128+
}}
129+
roles={false}
127130
/>
128131

129132
The response will include the complete ruleset after updating the rule.
@@ -136,11 +139,11 @@ For more information on deploying managed rulesets via API, refer to [Deploy a m
136139

137140
To disable payload logging for a managed ruleset:
138141

139-
1. Use the [Update a zone ruleset rule](/api/resources/rulesets/methods/update/) operation (a `PATCH` request) to update the rule deploying the managed ruleset (an `execute` rule).
142+
1. Use the [Update a zone ruleset rule](/api/resources/rulesets/methods/update/) operation to update the rule deploying the managed ruleset (a rule with `"action": "execute"`).
140143

141144
2. Modify the rule definition so that there is no `matched_data` object in `action_parameters`.
142145

143-
For example, the following `PATCH` request updates rule with ID `$RULE_ID` deploying the [Cloudflare Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/) so that payload logging is disabled:
146+
For example, the following `PATCH` request updates the rule with ID `$RULE_ID` deploying the [Cloudflare Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/) so that payload logging is disabled:
144147

145148
<APIRequest
146149
path="/zones/{zone_id}/rulesets/{ruleset_id}/rules/{rule_id}"
@@ -152,6 +155,7 @@ For example, the following `PATCH` request updates rule with ID `$RULE_ID` deplo
152155
},
153156
expression: "true",
154157
}}
158+
roles={false}
155159
/>
156160

157161
For details on obtaining the entry point ruleset ID and the ID of the rule to update, refer to [Configure and enable payload logging](/waf/managed-rules/payload-logging/configure-api/#configure-and-enable-payload-logging).

src/content/docs/waf/managed-rules/reference/exposed-credentials-check.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ This example deploys the Cloudflare Exposed Credentials Check Managed Ruleset to
6767
parameters={{
6868
ruleset_phase: "http_request_firewall_managed",
6969
}}
70+
roles={false}
7071
/>
7172

7273
```json output {4}
@@ -111,6 +112,7 @@ This example deploys the Cloudflare Exposed Credentials Check Managed Ruleset to
111112
description:
112113
"Execute the Cloudflare Exposed Credentials Check Managed Ruleset",
113114
}}
115+
roles={false}
114116
/>
115117

116118
```json output
@@ -176,6 +178,7 @@ This example deploys the Cloudflare Exposed Credentials Check Managed Ruleset to
176178
},
177179
],
178180
}}
181+
roles={false}
179182
/>
180183

181184
<Render

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ This example sets the Cloudflare OWASP Core Ruleset's paranoia level for a zone
3636

3737
1. Get the ID of the Cloudflare OWASP Core Ruleset using the [List account rulesets](/api/resources/rulesets/methods/list/) method, since WAF's managed rulesets exist at the account level. Alternatively, use the following ruleset ID directly: <RuleID id="4814384a9e5d4991b9815dcfc25d2f1f" />.
3838

39-
<APIRequest path="/accounts/{account_id}/rulesets" method="GET" />
39+
<APIRequest
40+
path="/accounts/{account_id}/rulesets"
41+
method="GET"
42+
roles={false}
43+
/>
4044

4145
```json output {4-5}
4246
{
@@ -67,6 +71,7 @@ This example sets the Cloudflare OWASP Core Ruleset's paranoia level for a zone
6771
parameters={{
6872
ruleset_phase: "http_request_firewall_managed",
6973
}}
74+
roles={false}
7075
/>
7176

7277
```json output {3,12,14-16}
@@ -133,6 +138,7 @@ This example sets the Cloudflare OWASP Core Ruleset's paranoia level for a zone
133138
expression: "true",
134139
enabled: true,
135140
}}
141+
roles={false}
136142
/>
137143

138144
For more information on creating overrides, refer to [Override a managed ruleset](/ruleset-engine/managed-rulesets/override-managed-ruleset/).
@@ -150,7 +156,11 @@ This example configures the managed ruleset score threshold and the performed ac
150156

151157
1. Get the ID of the Cloudflare OWASP Core Ruleset using the [List account rulesets](/api/resources/rulesets/methods/list/) method, since WAF's managed rulesets exist at the account level. Alternatively, use the following ruleset ID directly: <RuleID id="4814384a9e5d4991b9815dcfc25d2f1f" />.
152158

153-
<APIRequest path="/accounts/{account_id}/rulesets" method="GET" />
159+
<APIRequest
160+
path="/accounts/{account_id}/rulesets"
161+
method="GET"
162+
roles={false}
163+
/>
154164

155165
```json output {4-5}
156166
{
@@ -179,6 +189,7 @@ This example configures the managed ruleset score threshold and the performed ac
179189
path="/accounts/{account_id}/rulesets/{ruleset_id}"
180190
method="GET"
181191
parameters={{ ruleset_id: "$OWASP_RULESET_ID" }}
192+
roles={false}
182193
/>
183194

184195
```json output {12,16}
@@ -220,6 +231,7 @@ This example configures the managed ruleset score threshold and the performed ac
220231
parameters={{
221232
ruleset_phase: "http_request_firewall_managed",
222233
}}
234+
roles={false}
223235
/>
224236

225237
```json output {3,12,14-16}
@@ -258,7 +270,6 @@ This example configures the managed ruleset score threshold and the performed ac
258270
```
259271

260272
4. Update the rule you identified in the entry point ruleset using the [Update a zone ruleset rule](/api/resources/rulesets/methods/update/) operation, adding a rule override for the last rule in the OWASP ruleset (identified in step 2) with the following properties and values:
261-
262273
- `"score_threshold": 60`
263274
- `"action": "managed_challenge"`
264275

@@ -286,6 +297,7 @@ This example configures the managed ruleset score threshold and the performed ac
286297
expression: "true",
287298
enabled: true,
288299
}}
300+
roles={false}
289301
/>
290302

291303
## More resources

src/content/docs/waf/managed-rules/reference/sensitive-data-detection.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ This example deploys the Cloudflare Sensitive Data Detection managed ruleset to
8181
parameters={{
8282
ruleset_phase: "http_response_firewall_managed",
8383
}}
84+
roles={false}
8485
/>
8586

8687
```json output {4}
@@ -124,6 +125,7 @@ This example deploys the Cloudflare Sensitive Data Detection managed ruleset to
124125
description:
125126
"Execute the Cloudflare Sensitive Data Detection managed ruleset",
126127
}}
128+
roles={false}
127129
/>
128130

129131
```json output
@@ -189,6 +191,7 @@ This example deploys the Cloudflare Sensitive Data Detection managed ruleset to
189191
},
190192
],
191193
}}
194+
roles={false}
192195
/>
193196

194197
<Render

0 commit comments

Comments
 (0)