You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the CLI documentation for kibana import-rules command, when setting --rule-file or --rule-id argument, only a single rule should be imported and not everything recursively from the directory.
However, this imports all exceptions and connectors and not only the exception lists and connectors linked to the rule of interest.
So all exception lists and connectors are imported if the env CUSTOM_RULES_DIR is set (which is necessary to find items the rule depends on).
To Reproduce
In the Screenshare you can see the problem:
Screencast.From.2025-03-27.12-42-41.webm
The env is set
The command imports all the exceptions from the custom dir to Kibana though the rule doesn't contain any exceptions or connectors at all.
Unset the env
Only the rule is imported
Expected Behavior
Only the exceptions and connectors where the rule depends on should be imported.
Screenshots
No response
Desktop - OS
None
Desktop - Version
No response
Additional Context
The text was updated successfully, but these errors were encountered:
This is especially problematic for the use of the flag -id, --rule-id TEXT since we need to have the environment variable CUSTOM_RULES_DIR set to use the flag. But this will also lead to all exceptions and action connectors being imported even though undesired:
and without the var set, no dir is find to look for the id:
elastic-detection-rules-soc on master-soc [$✘!?⇡] is 📦 v1.0.0 via 🐍 v3.12.9 (detection-rules-build)
❯ unset CUSTOM_RULES_DIR
elastic-detection-rules-soc on master-soc [$✘!?⇡] is 📦 v1.0.0 via 🐍 v3.12.9 (detection-rules-build)
elastic-detection-rules-soc on master-soc [$✘!?⇡] is 📦 v1.0.0 via 🐍 v3.12.9 (detection-rules-build)
❯ python -m detection_rules kibana --space $SPACE --ignore-ssl-errors true import-rules -id $RULE_ID --overwrite
Loaded config file: /var/home/frederik/Programming/elastic-detection-rules-soc/.detection-rules-cfg.yaml
█▀▀▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄ ▄ █▀▀▄ ▄ ▄ ▄ ▄▄▄ ▄▄▄
█ █ █▄▄ █ █▄▄ █ █ █ █ █ █▀▄ █ █▄▄▀ █ █ █ █▄▄ █▄▄
█▄▄▀ █▄▄ █ █▄▄ █▄▄ █ ▄█▄ █▄█ █ ▀▄█ █ ▀▄ █▄▄█ █▄▄ █▄▄ ▄▄█
CLI Error (): Could not find rules with IDs: 87596efc-e89a-4f3b-9a58-3632b4871d8d
frederikb96
changed the title
[Bug] CLI detection_rules kibana import-rules doesnt regard the --rule-file parameter for exceptions and actions if dir env is set
[Bug] CLI detection_rules kibana import-rules imports all exceptions and connectors if --rule-file or --rule-id is set
Mar 27, 2025
Describe the Bug
According to the CLI documentation for kibana import-rules command, when setting --rule-file or --rule-id argument, only a single rule should be imported and not everything recursively from the directory.
However, this imports all exceptions and connectors and not only the exception lists and connectors linked to the rule of interest.
So all exception lists and connectors are imported if the env
CUSTOM_RULES_DIR
is set (which is necessary to find items the rule depends on).To Reproduce
In the Screenshare you can see the problem:
Screencast.From.2025-03-27.12-42-41.webm
Expected Behavior
Only the exceptions and connectors where the rule depends on should be imported.
Screenshots
No response
Desktop - OS
None
Desktop - Version
No response
Additional Context
The text was updated successfully, but these errors were encountered: