Skip to content

Commit 6405578

Browse files
authored
[Ruleset Engine] Add back "List rules by tag" operation (#18958)
1 parent d4f8d33 commit 6405578

File tree

1 file changed

+62
-0
lines changed
  • src/content/docs/ruleset-engine/rulesets-api

1 file changed

+62
-0
lines changed

src/content/docs/ruleset-engine/rulesets-api/view.mdx

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,65 @@ curl https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/{ruleset_id}/
241241
:::note
242242
When you view a specific version of a managed ruleset, each rule listed in the result can have one or more associated categories/tags, and it will not contain an expression.
243243
:::
244+
245+
## List rules in a managed ruleset with a specific tag
246+
247+
Returns a list of all the rules in a managed ruleset with a specific tag.
248+
249+
| Operation | Method + Endpoint |
250+
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
251+
| List rules in account ruleset version by tag | `GET /accounts/{account_id}/rulesets/{managed_ruleset_id}/versions/{version_number}/by_tag/{tag_name}` |
252+
253+
### Example
254+
255+
```bash
256+
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/rulesets/{ruleset_id}/versions/2/by_tag/wordpress \
257+
--header "Authorization: Bearer <API_TOKEN>"
258+
```
259+
260+
```json output
261+
{
262+
"result": {
263+
"id": "<MANAGED_RULESET_ID>",
264+
"name": "Cloudflare Managed Ruleset",
265+
"description": "Managed ruleset created by Cloudflare",
266+
"kind": "managed",
267+
"version": "4",
268+
"rules": [
269+
{
270+
"id": "<RULE_ID_1>",
271+
"version": "3",
272+
"action": "log",
273+
"categories": [
274+
"cve-2014-5265",
275+
"cve-2014-5266",
276+
"cve-2014-5267",
277+
"dos",
278+
"drupal",
279+
"wordpress"
280+
],
281+
"description": "Drupal, WordPress - DoS - XMLRPC - CVE:CVE-2014-5265, CVE:CVE-2014-5266, CVE:CVE-2014-5267",
282+
"last_updated": "2023-03-19T16:54:32.942986Z",
283+
"ref": "<RULE_REF_1>",
284+
"enabled": true
285+
},
286+
{
287+
"id": "<RULE_ID_2>",
288+
"version": "3",
289+
"action": "block",
290+
"categories": ["broken-access-control", "cve-2018-12895", "wordpress"],
291+
"description": "WordPress - Broken Access Control - CVE:CVE-2018-12895",
292+
"last_updated": "2023-03-19T16:54:32.942986Z",
293+
"ref": "<RULE_REF_2>",
294+
"enabled": true
295+
}
296+
// (...)
297+
],
298+
"last_updated": "2023-03-19T16:54:32.942986Z",
299+
"phase": "http_request_firewall_managed"
300+
},
301+
"success": true,
302+
"errors": [],
303+
"messages": []
304+
}
305+
```

0 commit comments

Comments
 (0)