-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Acceptance Criteria
- User should be able to tell when creating/editing/viewing a rule if it is dynamically loading the saved query on rule execution or the saved query is copied on rule creation
- User should be able to edit a rule and change between a static query and a dynamically loaded saved query
Related Issues
- [Security App][Detections] Unable to make changes to older rules that were saved_query type #127429
- [Security Solution] Saved Query Rule: rule-modified queries are shown in the UI, but do not affect rule execution #136905
- [Security Solution][Detections] Unexpected behaviors of saved queries in detection rules #76592
- [Security Solution] Id is displayed instead of Saved Query name under Rule details page #136178
Proposed Implementation
In the Alerts Area sync we discussed the possibility of adding a checkbox in the rule creation/editing flow to the effect of "Check this box to dynamically load the saved query on each rule execution". In the backend, checking this box is equivalent to the saved_query rule type, while leaving it unchecked is equivalent to the query rule type. A user can still load a saved query for a "query" rule type, but it will only be loaded by the frontend and the query itself will be copied from the saved query into the rule.
In order to allow users to check/uncheck this box when editing a rule, we also need to re-combine the query and saved query rule types at the alerting framework level. This means migrating the existing saved_query rules to be query rules instead in the framework and updating the siem.queryRule schema to allow both query and saved_query rules. The query and saved_query rule types both use the same executor function internally, so we should not need many changes in the executors to re-combine them.