Skip to content
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] Fix an error with nested fields being treated as keyword #201473

Merged

Conversation

kqualters-elastic
Copy link
Contributor

@kqualters-elastic kqualters-elastic commented Nov 22, 2024

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

@kqualters-elastic kqualters-elastic added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team backport:prev-major Backport to (8.x, 8.17, 8.16) the previous major branch and other branches in development labels Nov 22, 2024
@kqualters-elastic kqualters-elastic requested a review from a team as a code owner November 22, 2024 22:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing this!

@kqualters-elastic kqualters-elastic enabled auto-merge (squash) November 22, 2024 22:28
@kqualters-elastic kqualters-elastic merged commit c6cb059 into elastic:main Nov 23, 2024
46 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.15, 8.16, 8.17, 8.x

https://github.com/elastic/kibana/actions/runs/11982116840

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #2 / RootPrivilegesCallout should render callout requiring root privileges

Metrics [docs]

✅ unchanged

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 23, 2024
…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

(cherry picked from commit c6cb059)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 23, 2024
…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

(cherry picked from commit c6cb059)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 23, 2024
…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

(cherry picked from commit c6cb059)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.15 Backport failed because of merge conflicts
8.16
8.17
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 201473

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 23, 2024
…ted as keyword (#201473) (#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 (#201473)](#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
(#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
(#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
(#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]>
kibanamachine added a commit that referenced this pull request Nov 23, 2024
…ted as keyword (#201473) (#201483)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[Security Solution] Fix an error with nested fields being treated as
keyword (#201473)](#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
(#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
(#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
(#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]>
kibanamachine added a commit that referenced this pull request Nov 23, 2024
…ed as keyword (#201473) (#201484)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Fix an error with nested fields being treated as
keyword (#201473)](#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
(#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
(#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
(#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]>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
…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
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.17, 8.16) the previous major branch and other branches in development release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Investigations Team v8.16.2 v8.17.0 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants