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] [Rules] Fixes bug where editing a rule with a data view throws an unhandled exception #145658

Merged
merged 6 commits into from
Nov 23, 2022

Conversation

dhurley14
Copy link
Contributor

@dhurley14 dhurley14 commented Nov 18, 2022

Summary

Ref: #145078

I was unable to track down the reason as to why this error started appearing in 8.6 but this fix resolves the issue.

Checklist

Delete any items that are not applicable to this PR.

Comment on lines +506 to +508
return kibanaDataViews == null || Object.keys(kibanaDataViews).length === 0 ? (
<EuiLoadingSpinner size="l" />
) : (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unsure why the kibanaDataViews passed down to the edit page started breaking the edit page this release compared to last release. Either way, this will fix the issue going forward.

@dhurley14 dhurley14 changed the title initial fix, need to determine why this fix was needed though [Security Solution] [Rules] Fixes bug where editing a rule with a data view throws an unhandled exception Nov 23, 2022
@dhurley14 dhurley14 self-assigned this Nov 23, 2022
@dhurley14 dhurley14 added review release_note:skip Skip the PR/issue when compiling release notes Team:Security Solution Platform Security Solution Platform Team Feature:Rule Details Security Solution Detection Rule Details v8.6.0 labels Nov 23, 2022
@dhurley14 dhurley14 marked this pull request as ready for review November 23, 2022 00:08
@dhurley14 dhurley14 requested review from a team as code owners November 23, 2022 00:08
@dhurley14 dhurley14 requested a review from xcrzx November 23, 2022 00:08
Copy link
Contributor

@xcrzx xcrzx left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the fix👍

@@ -158,5 +165,24 @@ describe('Custom query rules', () => {
.should('match', /^[1-9].+$/);
cy.get(ALERT_GRID_CELL).contains(this.rule.name);
});
it('Creates and edits a new rule with a data view', function () {
visit(RULE_CREATION);
fillDefineCustomRuleAndContinue(this.rule);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR, but I've noticed that we access rules in our Cypress tests via this. And that leads to the type of this.rule being any. @dhurley14 Do you happen to know why we access rules using this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question. It's not clear to me either. @MadameSheema?

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

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.7MB 9.7MB +375.0B
Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 109 115 +6
securitySolution 443 449 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 68 74 +6
osquery 110 117 +7
securitySolution 520 526 +6
total +21

History

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

cc @dhurley14

@dhurley14 dhurley14 added the backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) label Nov 23, 2022
@dhurley14 dhurley14 merged commit 584752f into elastic:main Nov 23, 2022
@dhurley14 dhurley14 deleted the fix-edit-rule-data-view branch November 23, 2022 14:11
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 23, 2022
…a view throws an unhandled exception (elastic#145658)

## Summary

Ref: elastic#145078
(cherry picked from commit 584752f)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.6

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 Nov 23, 2022
… a data view throws an unhandled exception (#145658) (#146153)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Security Solution] [Rules] Fixes bug where editing a rule with a
data view throws an unhandled exception
(#145658)](#145658)

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

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

<!--BACKPORT [{"author":{"name":"Devin W.
Hurley","email":"devin.hurley@elastic.co"},"sourceCommit":{"committedDate":"2022-11-23T14:11:05Z","message":"[Security
Solution] [Rules] Fixes bug where editing a rule with a data view throws
an unhandled exception (#145658)\n\n## Summary\r\n\r\nRef:
https://github.com/elastic/kibana/issues/145078","sha":"584752f36693d2e9af56605f2e914285a1d4d62d","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["review","release_note:skip","Team:Security
Solution Platform","Feature:Rule
Details","backport:prev-minor","v8.6.0","v8.7.0"],"number":145658,"url":"https://github.com/elastic/kibana/pull/145658","mergeCommit":{"message":"[Security
Solution] [Rules] Fixes bug where editing a rule with a data view throws
an unhandled exception (#145658)\n\n## Summary\r\n\r\nRef:
https://github.com/elastic/kibana/issues/145078","sha":"584752f36693d2e9af56605f2e914285a1d4d62d"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145658","number":145658,"mergeCommit":{"message":"[Security
Solution] [Rules] Fixes bug where editing a rule with a data view throws
an unhandled exception (#145658)\n\n## Summary\r\n\r\nRef:
https://github.com/elastic/kibana/issues/145078","sha":"584752f36693d2e9af56605f2e914285a1d4d62d"}}]}]
BACKPORT-->

Co-authored-by: Devin W. Hurley <devin.hurley@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:Rule Details Security Solution Detection Rule Details release_note:skip Skip the PR/issue when compiling release notes review Team:Security Solution Platform Security Solution Platform Team v8.6.0 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants