[Security Solution] Gracefully handle errors in detection rules install#83306
[Security Solution] Gracefully handle errors in detection rules install#83306pzl merged 2 commits intoelastic:masterfrom
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. |
FrankHassanabad
left a comment
There was a problem hiding this comment.
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
installPrepackagedRulesreturns 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.