-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Gracefully handle errors in detection rules install #83306
Conversation
Pinging @elastic/endpoint-app-team (Feature:Endpoint) |
@elasticmachine merge upstream |
A lot of different authors in this file which kind of is what is making a few of the odd bugs and behaviors showing up.
That already returns an array so the code adding yet another array within an array is a problem. Glad you didn't do a spread here as that would just pull apart all of the array which isn't what you want. This code should work as is. I will approve it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, this should work as it is laid out.
Side notes are we have a lot of authors and different ways of loading things at this point from one technique being auto-generating an index and then loading that with a require statement, and then some streams that are auto scanning directories and files on the system and loading from there.
It makes it a bit tricky to understand what is going on and validate the code is working as intended (has nothing to do with this PR though, this PR is 👍 ), just some general notes.
@pzl , I changed the release not to be "fix" as this does fix a bug. |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
…ode-details * 'master' of github.com:elastic/kibana: Remove dependency of tests on strict SyntaxKind values (elastic#83440) [SecuritySolution] override timerange for prebuilt templates (elastic#82468) [Enterprise Search] Added a shouldShowActiveForSubroutes option (elastic#83338) [Lens] Make the dimension flyout panel stay close on outside click (elastic#83059) [Security Solution] Gracefully handle errors in detection rules install (elastic#83306) Fix advanced settings category sorting (elastic#83394)
Summary
Gracefully handle errors that were getting missed.
fixes #83277
installPrepackagedRules
returns an Array of promises (not a singular promise). Apparently, this does not sit well withPromise.all
, and errors/exceptions in any member of that array are not appropriately caught, and result in an unhandled exception (no matter how many try/catches you wrap it in).Instead, handing the Array right to Promise.all handles the errors just fine.
Also, typescript would not let me do:
because of argument type mismatches or something to that effect. Error looked like this: microsoft/TypeScript#35617
So it was pulled to the next line.