Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ruleset Engine] Add back "List rules by tag" operation #18958

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/content/docs/ruleset-engine/rulesets-api/view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,65 @@ curl https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/{ruleset_id}/
:::note
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.
:::

## List rules in a managed ruleset with a specific tag

Returns a list of all the rules in a managed ruleset with a specific tag.

| Operation | Method + Endpoint |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| List rules in account ruleset version by tag | `GET /accounts/{account_id}/rulesets/{managed_ruleset_id}/versions/{version_number}/by_tag/{tag_name}` |

### Example

```bash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/rulesets/{ruleset_id}/versions/2/by_tag/wordpress \
--header "Authorization: Bearer <API_TOKEN>"
```

```json output
{
"result": {
"id": "<MANAGED_RULESET_ID>",
"name": "Cloudflare Managed Ruleset",
"description": "Managed ruleset created by Cloudflare",
"kind": "managed",
"version": "4",
"rules": [
{
"id": "<RULE_ID_1>",
"version": "3",
"action": "log",
"categories": [
"cve-2014-5265",
"cve-2014-5266",
"cve-2014-5267",
"dos",
"drupal",
"wordpress"
],
"description": "Drupal, WordPress - DoS - XMLRPC - CVE:CVE-2014-5265, CVE:CVE-2014-5266, CVE:CVE-2014-5267",
"last_updated": "2023-03-19T16:54:32.942986Z",
"ref": "<RULE_REF_1>",
"enabled": true
},
{
"id": "<RULE_ID_2>",
"version": "3",
"action": "block",
"categories": ["broken-access-control", "cve-2018-12895", "wordpress"],
"description": "WordPress - Broken Access Control - CVE:CVE-2018-12895",
"last_updated": "2023-03-19T16:54:32.942986Z",
"ref": "<RULE_REF_2>",
"enabled": true
}
// (...)
],
"last_updated": "2023-03-19T16:54:32.942986Z",
"phase": "http_request_firewall_managed"
},
"success": true,
"errors": [],
"messages": []
}
```
Loading