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] Empty Alert Table when upgrading from 8.8.x -> 8.9 #162063

Merged
merged 4 commits into from
Jul 18, 2023

Conversation

logeekal
Copy link
Contributor

@logeekal logeekal commented Jul 17, 2023

Summary

When users upgrade from 8.8.x -> 8.9 version, users observe empty table as shown below.

image

Below are steps to reproduce this issue and test it:

  1. Boot [email protected]
  2. Clear Local storage.
  3. Go to Security -> Alerts
  4. Add Columns _id or any other column
  5. Upgrade to 8.9
  6. The table will empty as shown in above screenshot.

Fix

This fix saperates out the migraton from 8.7 -> 8.8 and add a new migration for upgrading from 8.8 -> 8.9

migrateAlertTableStateToTriggerActionsState migrates table from v8.7 -> v8.8,

migrateTriggerActionsVisibleColumnsAlertTable88xTo89 migrates from v8.8.x -> v8.9

Combining both of them may lead to issues when users are migrating from v8.7 -> v8.9 or v8.8 -> v8.9

@logeekal logeekal added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:Threat Hunting:Investigations Security Solution Investigations Team labels Jul 17, 2023
@logeekal logeekal requested a review from XavierM July 17, 2023 15:10
@logeekal logeekal marked this pull request as ready for review July 17, 2023 15:11
@logeekal logeekal requested a review from a team as a code owner July 17, 2023 15:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@logeekal logeekal added release_note:skip Skip the PR/issue when compiling release notes and removed release_note:fix labels Jul 17, 2023
@@ -100,7 +112,7 @@ export const migrateAlertTableStateToTriggerActionsState = (
sort: legacyDataTableState[tableKey].sort.map((sortCandidate) => ({
[sortCandidate.columnId]: { order: sortCandidate.sortDirection },
})),
visibleColumns: legacyDataTableState[tableKey].columns.map((c) => c.id),
visibleColumns: legacyDataTableState[tableKey].columns,
Copy link
Contributor Author

@logeekal logeekal Jul 17, 2023

Choose a reason for hiding this comment

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

return;
}

if ('visibleColumns' in alertTableData) {
Copy link
Contributor

@michaelolo24 michaelolo24 Jul 17, 2023

Choose a reason for hiding this comment

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

Can we have one more early exit here?

const nonCompliant = alertTableData.visibleColumns.some(val => typeof val !== 'string')

if (!nonCompliant) return

... or this if you prefer

if (nonCompliant) {
  alertTableData.visibleColumns.map(...)
}

Right now the map will most likely run every time someone loads the table for every version after this

Copy link
Contributor Author

@logeekal logeekal Jul 17, 2023

Choose a reason for hiding this comment

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

You are right.. made these changes with a little tweak.

const visibleColumns =
alertTableData.visibleColumns as DataTableState['dataTable']['tableById'][string]['columns'];
const v89CompliantFormat = visibleColumns.every((val: unknown) => typeof val === 'string');
if (v89CompliantFormat) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sweet, this works! 👍🏾

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Tests #7 / Alert details expandable flyout right panel overview tab insights section should display threat intelligence section

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 9.8MB 9.8MB +308.0B

History

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

Copy link
Contributor

@michaelolo24 michaelolo24 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 getting this fix in!

@logeekal
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.9

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

Questions ?

Please refer to the Backport tool documentation

logeekal added a commit to logeekal/kibana that referenced this pull request Jul 18, 2023
…-> 8.9 (elastic#162063)

## Summary

When users upgrade from `8.8.x` -> `8.9` version, users observe empty
table as shown below.

![image](https://github.com/elastic/kibana/assets/7485038/20549edb-07b9-4124-a0ac-7515cf0e2796)

Below are steps to reproduce this issue and test it:

1. Boot [email protected]
2. Clear Local storage.
3. Go to Security -> Alerts
4. Add Columns `_id` or any other column
5. Upgrade to `8.9`
6. The table will empty as shown in above screenshot.

## Fix

This fix saperates out the migraton from 8.7 -> 8.8 and add a new
migration for upgrading from 8.8 -> 8.9

`migrateAlertTableStateToTriggerActionsState` migrates table from `v8.7
-> v8.8`,

`migrateTriggerActionsVisibleColumnsAlertTable88xTo89` migrates from
`v8.8.x` -> `v8.9`

Combining both of them may lead to issues when users are migrating from
`v8.7` -> `v8.9` or `v8.8` -> `v8.9`

(cherry picked from commit 0516cae)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 18, 2023
…-> 8.9 (elastic#162063)

## Summary

When users upgrade from `8.8.x` -> `8.9` version, users observe empty
table as shown below.

![image](https://github.com/elastic/kibana/assets/7485038/20549edb-07b9-4124-a0ac-7515cf0e2796)

Below are steps to reproduce this issue and test it:

1. Boot [email protected]
2. Clear Local storage.
3. Go to Security -> Alerts
4. Add Columns `_id` or any other column
5. Upgrade to `8.9`
6. The table will empty as shown in above screenshot.

## Fix

This fix saperates out the migraton from 8.7 -> 8.8 and add a new
migration for upgrading from 8.8 -> 8.9

`migrateAlertTableStateToTriggerActionsState` migrates table from `v8.7
-> v8.8`,

`migrateTriggerActionsVisibleColumnsAlertTable88xTo89` migrates from
`v8.8.x` -> `v8.9`

Combining both of them may lead to issues when users are migrating from
`v8.7` -> `v8.9` or `v8.8` -> `v8.9`

(cherry picked from commit 0516cae)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.9

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 Jul 18, 2023
…8.8.x -> 8.9 (#162063) (#162120)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Security Solution][Fix] Empty Alert Table when upgrading from 8.8.x
-> 8.9 (#162063)](#162063)

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

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

<!--BACKPORT [{"author":{"name":"Jatin
Kathuria","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-07-18T08:57:12Z","message":"[Security
Solution][Fix] Empty Alert Table when upgrading from 8.8.x -> 8.9
(#162063)\n\n## Summary\r\n\r\nWhen users upgrade from `8.8.x` -> `8.9`
version, users observe empty\r\ntable as shown
below.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/7485038/20549edb-07b9-4124-a0ac-7515cf0e2796)\r\n\r\n\r\nBelow
are steps to reproduce this issue and test it:\r\n\r\n1. Boot
[email protected]\r\n2. Clear Local storage.\r\n3. Go to Security ->
Alerts\r\n4. Add Columns `_id` or any other column \r\n5. Upgrade to
`8.9`\r\n6. The table will empty as shown in above
screenshot.\r\n\r\n\r\n## Fix\r\n\r\nThis fix saperates out the migraton
from 8.7 -> 8.8 and add a new\r\nmigration for upgrading from 8.8 ->
8.9\r\n\r\n`migrateAlertTableStateToTriggerActionsState` migrates table
from `v8.7\r\n->
v8.8`,\r\n\r\n`migrateTriggerActionsVisibleColumnsAlertTable88xTo89`
migrates from\r\n`v8.8.x` -> `v8.9`\r\n\r\nCombining both of them may
lead to issues when users are migrating from\r\n`v8.7` -> `v8.9` or
`v8.8` ->
`v8.9`","sha":"0516caed1de3b72efa3f5c1282975c34962f7999","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","Team:Threat
Hunting:Investigations","v8.9.0","v8.10.0"],"number":162063,"url":"https://github.com/elastic/kibana/pull/162063","mergeCommit":{"message":"[Security
Solution][Fix] Empty Alert Table when upgrading from 8.8.x -> 8.9
(#162063)\n\n## Summary\r\n\r\nWhen users upgrade from `8.8.x` -> `8.9`
version, users observe empty\r\ntable as shown
below.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/7485038/20549edb-07b9-4124-a0ac-7515cf0e2796)\r\n\r\n\r\nBelow
are steps to reproduce this issue and test it:\r\n\r\n1. Boot
[email protected]\r\n2. Clear Local storage.\r\n3. Go to Security ->
Alerts\r\n4. Add Columns `_id` or any other column \r\n5. Upgrade to
`8.9`\r\n6. The table will empty as shown in above
screenshot.\r\n\r\n\r\n## Fix\r\n\r\nThis fix saperates out the migraton
from 8.7 -> 8.8 and add a new\r\nmigration for upgrading from 8.8 ->
8.9\r\n\r\n`migrateAlertTableStateToTriggerActionsState` migrates table
from `v8.7\r\n->
v8.8`,\r\n\r\n`migrateTriggerActionsVisibleColumnsAlertTable88xTo89`
migrates from\r\n`v8.8.x` -> `v8.9`\r\n\r\nCombining both of them may
lead to issues when users are migrating from\r\n`v8.7` -> `v8.9` or
`v8.8` ->
`v8.9`","sha":"0516caed1de3b72efa3f5c1282975c34962f7999"}},"sourceBranch":"main","suggestedTargetBranches":["8.9"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/162063","number":162063,"mergeCommit":{"message":"[Security
Solution][Fix] Empty Alert Table when upgrading from 8.8.x -> 8.9
(#162063)\n\n## Summary\r\n\r\nWhen users upgrade from `8.8.x` -> `8.9`
version, users observe empty\r\ntable as shown
below.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/7485038/20549edb-07b9-4124-a0ac-7515cf0e2796)\r\n\r\n\r\nBelow
are steps to reproduce this issue and test it:\r\n\r\n1. Boot
[email protected]\r\n2. Clear Local storage.\r\n3. Go to Security ->
Alerts\r\n4. Add Columns `_id` or any other column \r\n5. Upgrade to
`8.9`\r\n6. The table will empty as shown in above
screenshot.\r\n\r\n\r\n## Fix\r\n\r\nThis fix saperates out the migraton
from 8.7 -> 8.8 and add a new\r\nmigration for upgrading from 8.8 ->
8.9\r\n\r\n`migrateAlertTableStateToTriggerActionsState` migrates table
from `v8.7\r\n->
v8.8`,\r\n\r\n`migrateTriggerActionsVisibleColumnsAlertTable88xTo89`
migrates from\r\n`v8.8.x` -> `v8.9`\r\n\r\nCombining both of them may
lead to issues when users are migrating from\r\n`v8.7` -> `v8.9` or
`v8.8` -> `v8.9`","sha":"0516caed1de3b72efa3f5c1282975c34962f7999"}}]}]
BACKPORT-->

Co-authored-by: Jatin Kathuria <[email protected]>
ThomThomson pushed a commit to ThomThomson/kibana that referenced this pull request Aug 1, 2023
…-> 8.9 (elastic#162063)

## Summary

When users upgrade from `8.8.x` -> `8.9` version, users observe empty
table as shown below.


![image](https://github.com/elastic/kibana/assets/7485038/20549edb-07b9-4124-a0ac-7515cf0e2796)


Below are steps to reproduce this issue and test it:

1. Boot [email protected]
2. Clear Local storage.
3. Go to Security -> Alerts
4. Add Columns `_id` or any other column 
5. Upgrade to `8.9`
6. The table will empty as shown in above screenshot.


## Fix

This fix saperates out the migraton from 8.7 -> 8.8 and add a new
migration for upgrading from 8.8 -> 8.9

`migrateAlertTableStateToTriggerActionsState` migrates table from `v8.7
-> v8.8`,

`migrateTriggerActionsVisibleColumnsAlertTable88xTo89` migrates from
`v8.8.x` -> `v8.9`

Combining both of them may lead to issues when users are migrating from
`v8.7` -> `v8.9` or `v8.8` -> `v8.9`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:Threat Hunting:Investigations Security Solution Investigations Team v8.9.0 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants