[Security Solution][Detection Engine] make building alert ancestors type safe for ES|QL rule #205419
Labels
bug
Fixes for quality problems that affect the customer experience
Feature: ES|QL Rule
impact:high
Addressing this issue will have a high level of impact on the quality/strength of our product.
sdh-linked
Team:Detection Engine
Security Solution Detection Engine Area
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Describe the bug:
Reproduced in 8.16+
https://github.com/elastic/kibana/blob/8.16/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts#L154
There is a casting for ALERT_ANCESTORS property("kibana.alert.ancestors") into array in
buildAncestors
function. This is not a safe operation.If this value appears to be not array, rule execution would fail.
We need to avoid casting here and check whether existing ancestors is an array before creating new array.
Otherwise it might lead to rule failure: existingAncestors is not iterable
The text was updated successfully, but these errors were encountered: