Skip to content

[Security Solution] Failed to Fetch Rules and Timeline in Preview Flyout#146904

Merged
e40pud merged 1 commit intoelastic:mainfrom
e40pud:security/bugfix/146858-Fetch-Rules-Error
Dec 2, 2022
Merged

[Security Solution] Failed to Fetch Rules and Timeline in Preview Flyout#146904
e40pud merged 1 commit intoelastic:mainfrom
e40pud:security/bugfix/146858-Fetch-Rules-Error

Conversation

@e40pud
Copy link
Contributor

@e40pud e40pud commented Dec 2, 2022

Summary

These changes fixes the issue with the unexpected "Failed to Fetch Rule" error toast that appears when user opens the alert details from the Rule Preview page.

The issue was introduced by recent refactoring where we switched from the optional toast to showing error toast always when it is not possible to fetch the rule (see useRuleWithFallback hook). In case of Rule Preview the rule does not exist and thus server returns 404 (not found) error. In case of Rule Preview we would like to ignore this error and build the rule from the alert.

Bug Ticket: #146858

@e40pud e40pud added release_note:fix Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Team:Detection Alerts Security Detection Alerts Area Team backport:prev-minor ci:cloud-deploy Create or update a Cloud deployment labels Dec 2, 2022
@e40pud e40pud requested a review from a team as a code owner December 2, 2022 17:07
@e40pud e40pud self-assigned this Dec 2, 2022
@e40pud e40pud requested a review from spong December 2, 2022 17:07
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@kibana-ci
Copy link

kibana-ci commented Dec 2, 2022

💚 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.9MB 9.9MB +57.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 @e40pud

Copy link
Member

@spong spong left a comment

Choose a reason for hiding this comment

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

Verified issue, checked out, tested locally, and the issue of error toast showing when viewing an alert from Rule Preview is now resolved. 🎉 LGTM! Thank you for the fix here @e40pud! 🙂

Note: this also fixes the same error toast issue when viewing a deleted Rule when clicking through to Rule Details from a historical alert. I'll make a note over on #146858 about this as well.

@e40pud e40pud merged commit 1b4c661 into elastic:main Dec 2, 2022
@spong spong added release_note:skip Skip the PR/issue when compiling release notes and removed release_note:fix labels Dec 2, 2022
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 2, 2022
…out (elastic#146904)

## Summary

These changes fixes the issue with the unexpected "Failed to Fetch Rule"
error toast that appears when user opens the alert details from the Rule
Preview page.

The issue was introduced by [recent
refactoring](elastic#142950) where we
switched from the optional toast to showing error toast always when it
is not possible to fetch the rule (see `useRuleWithFallback` hook). In
case of Rule Preview the rule does not exist and thus server returns 404
(not found) error. In case of Rule Preview we would like to ignore this
error and build the rule from the alert.

Bug Ticket: elastic#146858

(cherry picked from commit 1b4c661)
@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 Dec 2, 2022
…ew Flyout (#146904) (#146921)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Security Solution] Failed to Fetch Rules and Timeline in Preview
Flyout (#146904)](#146904)

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

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

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"ievgen.sorokopud@elastic.co"},"sourceCommit":{"committedDate":"2022-12-02T20:17:54Z","message":"[Security
Solution] Failed to Fetch Rules and Timeline in Preview Flyout
(#146904)\n\n## Summary\r\n\r\nThese changes fixes the issue with the
unexpected \"Failed to Fetch Rule\"\r\nerror toast that appears when
user opens the alert details from the Rule\r\nPreview page.\r\n\r\nThe
issue was introduced by
[recent\r\nrefactoring](#142950)
where we\r\nswitched from the optional toast to showing error toast
always when it\r\nis not possible to fetch the rule (see
`useRuleWithFallback` hook). In\r\ncase of Rule Preview the rule does
not exist and thus server returns 404\r\n(not found) error. In case of
Rule Preview we would like to ignore this\r\nerror and build the rule
from the alert.\r\n\r\nBug Ticket:
#146858","sha":"1b4c66101b02dd4c01582a0e7b684eb5b499101a","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:
SecuritySolution","Team:Detection Rules","Team:Detection
Alerts","backport:prev-minor","ci:cloud-deploy","v8.7.0"],"number":146904,"url":"https://github.com/elastic/kibana/pull/146904","mergeCommit":{"message":"[Security
Solution] Failed to Fetch Rules and Timeline in Preview Flyout
(#146904)\n\n## Summary\r\n\r\nThese changes fixes the issue with the
unexpected \"Failed to Fetch Rule\"\r\nerror toast that appears when
user opens the alert details from the Rule\r\nPreview page.\r\n\r\nThe
issue was introduced by
[recent\r\nrefactoring](#142950)
where we\r\nswitched from the optional toast to showing error toast
always when it\r\nis not possible to fetch the rule (see
`useRuleWithFallback` hook). In\r\ncase of Rule Preview the rule does
not exist and thus server returns 404\r\n(not found) error. In case of
Rule Preview we would like to ignore this\r\nerror and build the rule
from the alert.\r\n\r\nBug Ticket:
#146858","sha":"1b4c66101b02dd4c01582a0e7b684eb5b499101a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146904","number":146904,"mergeCommit":{"message":"[Security
Solution] Failed to Fetch Rules and Timeline in Preview Flyout
(#146904)\n\n## Summary\r\n\r\nThese changes fixes the issue with the
unexpected \"Failed to Fetch Rule\"\r\nerror toast that appears when
user opens the alert details from the Rule\r\nPreview page.\r\n\r\nThe
issue was introduced by
[recent\r\nrefactoring](#142950)
where we\r\nswitched from the optional toast to showing error toast
always when it\r\nis not possible to fetch the rule (see
`useRuleWithFallback` hook). In\r\ncase of Rule Preview the rule does
not exist and thus server returns 404\r\n(not found) error. In case of
Rule Preview we would like to ignore this\r\nerror and build the rule
from the alert.\r\n\r\nBug Ticket:
#146858","sha":"1b4c66101b02dd4c01582a0e7b684eb5b499101a"}}]}]
BACKPORT-->

Co-authored-by: Ievgen Sorokopud <ievgen.sorokopud@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:cloud-deploy Create or update a Cloud deployment release_note:skip Skip the PR/issue when compiling release notes Team:Detection Alerts Security Detection Alerts Area Team Team:Detection Rule Management Security Detection Rule Management Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.6.0 v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants