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 timeline bug receiving dataProvider value as number #159723

Merged
merged 2 commits into from Jun 15, 2023

Conversation

semd
Copy link
Contributor

@semd semd commented Jun 14, 2023

Summary

issue: #159720
Timeline save request fails when the dataProvider value stored is a Number type.

Adding the dataProvider through timeline page itself does not cause the bug. it sets a string value even if the field type is number.

The bug only happens when using "add to timeline" CellAction on a field with type number

Solution

Cast the dataProvider values to a string before adding them to the timeline.

@semd semd requested a review from a team as a code owner June 14, 2023 16:10
@semd semd self-assigned this Jun 14, 2023
@elasticmachine
Copy link
Contributor

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

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.

pulled down the branch and tested, this fixes the bug trying to save timeline! LGTM

@machadoum
Copy link
Member

Thank you for fixing it so quickly!
nit: Could you please add a unit test for this scenario? I want to make sure we don't delete this code in the future.

@semd semd enabled auto-merge (squash) June 15, 2023 07:52
@semd semd merged commit b9d6beb into elastic:main Jun 15, 2023
23 checks passed
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Tests #7 / Exceptions viewer read only "before each" hook for "Cannot add an exception from empty viewer screen"

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 10.8MB 10.8MB +25.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 410 414 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 493 497 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @semd

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 15, 2023
…number (elastic#159723)

## Summary

issue: elastic#159720
Timeline save request fails when the dataProvider value stored is a
Number type.

Adding the dataProvider through timeline page itself does not cause the
bug. it sets a string value even if the field type is `number`.

The bug only happens when using "add to timeline" CellAction on a field
with type `number`

### Solution

Cast the dataProvider values to a `string` before adding them to the
timeline.

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

💚 All backports created successfully

Status Branch Result
8.8

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 15, 2023
…ue as number (#159723) (#159775)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Security Solution] Fix timeline bug receiving dataProvider value as
number (#159723)](#159723)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Sergi
Massaneda","email":"sergi.massaneda@elastic.co"},"sourceCommit":{"committedDate":"2023-06-15T08:39:45Z","message":"[Security
Solution] Fix timeline bug receiving dataProvider value as number
(#159723)\n\n## Summary\r\n\r\nissue:
#159720 save request
fails when the dataProvider value stored is a\r\nNumber
type.\r\n\r\nAdding the dataProvider through timeline page itself does
not cause the\r\nbug. it sets a string value even if the field type is
`number`.\r\n\r\nThe bug only happens when using \"add to timeline\"
CellAction on a field\r\nwith type `number`\r\n\r\n###
Solution\r\n\r\nCast the dataProvider values to a `string` before adding
them to
the\r\ntimeline.","sha":"b9d6beb070ba60a533857616150c453cc7714237","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Threat
Hunting","Team:Threat Hunting:Investigations","Team:Threat
Hunting:Explore","v8.9.0","v8.8.2"],"number":159723,"url":"#159723
Solution] Fix timeline bug receiving dataProvider value as number
(#159723)\n\n## Summary\r\n\r\nissue:
#159720 save request
fails when the dataProvider value stored is a\r\nNumber
type.\r\n\r\nAdding the dataProvider through timeline page itself does
not cause the\r\nbug. it sets a string value even if the field type is
`number`.\r\n\r\nThe bug only happens when using \"add to timeline\"
CellAction on a field\r\nwith type `number`\r\n\r\n###
Solution\r\n\r\nCast the dataProvider values to a `string` before adding
them to
the\r\ntimeline.","sha":"b9d6beb070ba60a533857616150c453cc7714237"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"#159723
Solution] Fix timeline bug receiving dataProvider value as number
(#159723)\n\n## Summary\r\n\r\nissue:
#159720 save request
fails when the dataProvider value stored is a\r\nNumber
type.\r\n\r\nAdding the dataProvider through timeline page itself does
not cause the\r\nbug. it sets a string value even if the field type is
`number`.\r\n\r\nThe bug only happens when using \"add to timeline\"
CellAction on a field\r\nwith type `number`\r\n\r\n###
Solution\r\n\r\nCast the dataProvider values to a `string` before adding
them to
the\r\ntimeline.","sha":"b9d6beb070ba60a533857616150c453cc7714237"}},{"branch":"8.8","label":"v8.8.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sergi Massaneda <sergi.massaneda@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants