Skip to content

Commit

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

# Backport

This will backport the following commits from `main` to `8.16`:
- [[Security Solution] Fix an error with nested fields being treated as
keyword (elastic#201473)](elastic#201473)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kevin
Qualters","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-23T00:11:12Z","message":"[Security
Solution] Fix an error with nested fields being treated as keyword
(elastic#201473)\n\n## Summary\r\nWhen formatting elasticsearch responses for
the frontend, the timelines\r\nsearch strategies will treat unmapped
fields as type: keyword. If the\r\nunderlying field is actually an
object, but is seen as a string in the\r\ncode, this for (key in source)
loop will fail, as it's trying to loop\r\nover a string. Fix below
should have minimal effect as the data is\r\naccessible at the further
nested keys.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"c6cb05996188ec7613d38f10de57dade356d12f7","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat
Hunting:Investigations","backport:prev-major"],"title":"[Security
Solution] Fix an error with nested fields being treated as
keyword","number":201473,"url":"https://github.com/elastic/kibana/pull/201473","mergeCommit":{"message":"[Security
Solution] Fix an error with nested fields being treated as keyword
(elastic#201473)\n\n## Summary\r\nWhen formatting elasticsearch responses for
the frontend, the timelines\r\nsearch strategies will treat unmapped
fields as type: keyword. If the\r\nunderlying field is actually an
object, but is seen as a string in the\r\ncode, this for (key in source)
loop will fail, as it's trying to loop\r\nover a string. Fix below
should have minimal effect as the data is\r\naccessible at the further
nested keys.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"c6cb05996188ec7613d38f10de57dade356d12f7"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201473","number":201473,"mergeCommit":{"message":"[Security
Solution] Fix an error with nested fields being treated as keyword
(elastic#201473)\n\n## Summary\r\nWhen formatting elasticsearch responses for
the frontend, the timelines\r\nsearch strategies will treat unmapped
fields as type: keyword. If the\r\nunderlying field is actually an
object, but is seen as a string in the\r\ncode, this for (key in source)
loop will fail, as it's trying to loop\r\nover a string. Fix below
should have minimal effect as the data is\r\naccessible at the further
nested keys.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"c6cb05996188ec7613d38f10de57dade356d12f7"}}]}]
BACKPORT-->

Co-authored-by: Kevin Qualters <[email protected]>
  • Loading branch information
kibanamachine and kqualters-elastic authored Nov 23, 2024
1 parent 263d9b0 commit e306b57
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 e306b57

Please sign in to comment.