Skip to content

[Bug] [DAC] Kibana Export Rules Rule Name Filter Exports All Rules #4917

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions detection_rules/kbwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ def kibana_export_rules( # noqa: PLR0912, PLR0913, PLR0915
if rule_name:
found = RuleResource.find(filter=f"alert.attributes.name:{rule_name}") # type: ignore[reportUnknownMemberType]
rule_id = [r["rule_id"] for r in found] # type: ignore[reportUnknownVariableType]
if not rule_id:
click.echo(
f"No rules found to export matching the provided name '{rule_name}' "
f"using filter 'alert.attributes.name:{rule_name}'"
)
return []
query = (
export_query
if not custom_rules_only
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "detection_rules"
version = "1.3.10"
version = "1.3.11"
description = "Detection Rules is the home for rules used by Elastic Security. This repository is used for the development, maintenance, testing, validation, and release of rules for Elastic Security’s Detection Engine."
readme = "README.md"
requires-python = ">=3.12"
Expand Down
Loading