-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution][Detections] Unexpected behaviors of saved queries in detection rules #76592
Comments
Pinging @elastic/siem (Team:SIEM) |
For this core issue, we'll be removing the |
Pinging @elastic/kibana-security (Team:Security Solution) |
This issue has again been reported within some users rule management workflows -- raising impact so we can prevent future disruptions here. |
Update that with this PR merged we will ignore savedQuery for Threshold and Indicator Match, and just use the custom query from rule configuration. So, when you create/edit these rules, you can use a saved query, but it just copies the query value into a custom query and then will ignore saved_id. |
Update: with the merging of this PR, the saved query behaviors have been updated to resolve most of the issues described in this issue.
I will create separate issues for (3) and (5). We should investigate (1) further before finally closing out this issue. |
Summary
This is a meta bug capturing several inconsistent/undesirable behaviors related to use of saved queries in detection rules.
1. Saved query filters referencing missing index patterns automatically disable on Rule edit
Saved query
filters created outside of the Security App will be created with a reference to a specificindex
. This is used internally by theSearchBar
component throughout all Kibana apps for fetching field/value autocomplete suggestions. For example here is the samesaved query
filter created inDiscover
,Dashboard
, and theSecurity
app.Discover
Dashboard
Security
Now where this becomes an issue is if you create a Rule that uses a
saved query
with anindex
reference, and then either delete the corresponding Kibana Index Pattern/Saved Query, or export and import into a space that does not also have this Kibana Index Pattern/Saved Query.At this point, it should be noted that the rule will continue to run without error so long as it isn't edited in the UI. Once the rule is edited via the UI, the
SearchBar
component will validate the filter against the missingindex
, which will put the filter in an error state, and once the Rule is then saved the filter will be saved withdisabled: true
, thus disabling the filter, and resulting in subsequent Rule runs to execute without the filter (so long as theSaved Query
is deleted as well).2. Inability to clear a saved query in the UI
While it may remove the querystring/filter, the
saved_id
is not cleared and still references the selectedsaved query
:3. The
Rule Details
page doesn't showdisabled
filter modifications4. The
Rule Details
/Edit Rules
do not show the query that will be executedThese pages show the query/filter saved to the Rule object and doesn't query for the latest
saved query
values as what happens during Rule execution, so there could be a mis-match in what is displayed to the user if thesaved query
is later updated.5. No insight into applied filters
When there is a
saved_id
the DE will always query for the latestsaved query
, and if not found fall back to the querystring/filters on the Rule object. For either scenario, no indication of which filters were used are saved to the resulting alerts -- the system will always copy over the querystring/filters on the Rule object tosignal.rule.query/filters
.The text was updated successfully, but these errors were encountered: