-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[SECURITY SOLUTION] [Detections] Fixes bug where rule failed to run on first execution #68429
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Pinging @elastic/siem (Team:SIEM) |
…g where api key was invalidated during alert execution
…erwise the call to updateApiKey inside of updateRulesNotifications will invalidate the api key for the currently running rule and throw an error on the initial rule run
…flects the rules state, adds e2e test case to ensure rule ran successfully instead of just 'going to run'
b043ba9 to
4d4f6bf
Compare
Contributor
💔 Build Failed
Failed CI StepsTest FailuresKibana Pipeline / kibana-xpack-agent / X-Pack Detection Engine API Integration Tests.x-pack/test/detection_engine_api_integration/security_and_spaces/tests/find_rules·ts.detection engine api security and spaces enabled find_rules should return a single rule when a single rule is loaded from a find with everything for the rule addedStandard OutStack TraceKibana Pipeline / kibana-xpack-agent / X-Pack Detection Engine API Integration Tests.x-pack/test/detection_engine_api_integration/security_and_spaces/tests/find_rules·ts.detection engine api security and spaces enabled find_rules should return a single rule when a single rule is loaded from a find with everything for the rule addedStandard OutStack TraceTo update your PR or re-run it, just comment with: |
Contributor
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature:Detection Rules
Security Solution rules and Detection Engine
release_note:fix
review
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Team:SIEM
v7.7.2
v7.8.1
v7.9.0
v8.0.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
fixes https://github.com/elastic/siem-team/issues/697
Source of the error was the addition of
updateApiKey#67364 which would invalidate the api key of the rule as it was running or before it could start running which would yield the errors displayed in the above issue.The fix involves creating the rule as disabled first, so that the task manager does not pick it up until after the actions are updated inside of https://github.com/patrykkopycinski/kibana/blob/f7e8c597b16756b2af15e81dfa0695d3d890c619/x-pack/plugins/siem/server/lib/detection_engine/rules/update_rules_notifications.ts
and the call to
updateApiKeyis executed. After this, we enable the rule which will allow task manager to pick up the rule and begin executing, this time with a new api key.I have an idea that this PR may actually allow us to remove the
updateApiKeycall inside of https://github.com/patrykkopycinski/kibana/blob/f7e8c597b16756b2af15e81dfa0695d3d890c619/x-pack/plugins/siem/server/lib/detection_engine/rules/update_rules_notifications.ts since it will generate a new api key when it enables the rule. I will test that out later. Wanted to get feedback on this method first before changing anything further.Checklist
Delete any items that are not applicable to this PR.
For maintainers