Skip to content

Commit

Permalink
[Security Solution] Fix an error with nested fields being treated as …
Browse files Browse the repository at this point in the history
…keyword (elastic#201473)

## Summary
When formatting elasticsearch responses for the frontend, the timelines
search strategies will treat unmapped fields as type: keyword. If the
underlying field is actually an object, but is seen as a string in the
code, this for (key in source) loop will fail, as it's trying to loop
over a string. Fix below should have minimal effect as the data is
accessible at the further nested keys.



### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
  • Loading branch information
kqualters-elastic authored Nov 23, 2024
1 parent b28740e commit c6cb059
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const createBaseTimelineEdges = (): TimelineEdges => ({

function deepMerge(target: EventSource, source: EventSource) {
for (const key in source) {
if (source[key] instanceof Object && key in target) {
if (source && source[key] instanceof Object && target && target[key] instanceof Object) {
deepMerge(target[key], source[key]);
} else {
target[key] = source[key];
Expand Down

0 comments on commit c6cb059

Please sign in to comment.