-
Notifications
You must be signed in to change notification settings - Fork 513
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
[FR] Add Support for ES|QL Rule Type and Remote Validation #3281
[FR] Add Support for ES|QL Rule Type and Remote Validation #3281
Conversation
rules/windows/command_and_control_rare_microsoft_office_child_processes.toml
Outdated
Show resolved
Hide resolved
rules/windows/command_and_control_rare_microsoft_office_child_processes.toml
Outdated
Show resolved
Hide resolved
Aside from the small comments made, this looks relatively straight forward. @Mikaayenson will there be a second PR to add the github workflow action? Also, I built a package to ensure the release package workflow does not break with any of the changes in this PR. |
…ype-and-core-validation # Conflicts: # detection_rules/rule.py # detection_rules/rule_validators.py # detection_rules/schemas/definitions.py # tests/test_all_rules.py
Slight modifications to the previous diagram This now takes This currently will skip the unit test until we add a config file (intentionally). This adds capability to remote validate ES|QL and EQL only. If an index doesn't exist on the stack for the rule, it will raise an exception. |
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.
Did you ever resolve the intermitted bug with remote eql queries?
query_results = method(contents) | ||
engine_results = self.engine_preview(contents) |
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.
Do both?
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.
?
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.
is this saying that we validate via the esql api and the rules engine api?
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.
kind of - definitely the ESQL api, whereas the engine preview api would need further inspection to determine "validation" - parsing and interpreting the results
from detection_rules.remote_validation import RemoteValidator | ||
|
||
|
||
@unittest.skipIf(get_default_config() is None, 'Skipping remote validation due to missing config') |
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.
we should probably skipIf env var is available vs config for CI purposes.
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.
So what I think makes the most sense is that I am goign to just comment this test out for now and in a future PR, we can add the functionality to trigger via a label in a PR
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.
f"new terms fields values are not unique - {rule.contents.data.new_terms.value}" | ||
|
||
|
||
class TestESQLRules(BaseRuleTest): |
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.
note: in the esql library pr, I moved these to a test_esql_rules
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.
Ah, thanks. I think we should leave these here and consolidate all tests which focus on a subset of rules (vs all) to this file to avoid making a test file per rule type
removed: 44209c7 |
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.
🚀
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. I had a couple questions that were already resolved. Functionality appears sound.
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, minor questions all addressed 👍
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
* add suuport for esql type * add unit tests * set clients in RemoteConnector from auth methods * thread remote rules; add engine test * Add versions to remote validation results --------- Co-authored-by: Terrance DeJesus <[email protected]> Co-authored-by: brokensound77 <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> (cherry picked from commit 7514c0a)
Issues
Resolves #3275
Summary
Testing
Additional Information
Increased Scope
We've decided to spend more cycles designing and implementing the remote validation component prior to working on the ECP/persistent stack POCs. The initial design to fully support remote validation is here and will be worked by @brokensound77.