-
Notifications
You must be signed in to change notification settings - Fork 119
Add Support for Multiple Kibana Security Detection Rule Types #1292
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
base: main
Are you sure you want to change the base?
Conversation
💚 CLA has been signed |
Co-authored-by: nick-benoit <[email protected]>
…examples Co-authored-by: nick-benoit <[email protected]>
The trickiest part of this PR is sorting out
The api gives back this error if both are included:
|
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.
Pretty excellent first pass here, added a bunch of comments around using some shared utils and how we've generally tried to structure things but this is looking good.
IMO we should cover all the rule types in this PR, but I could be convinced they can be added in a follow up. We do need to cover them to consider the issue 'done' though.
Looking at the acceptance test failures: The 7.17 test is failing because an expected index doesn't exist yet. I guess it wouldn't be hard to create another 7.x specific test which also first created the index, but I'm not sure it's worthwhile given it's 7.x. The 8.10 test looks like we're getting a different response from Kibana in that version. Definitely worth investigating, but given 8.10 is 2 years old I don't think it's unreasonable to skip the test in 8.10 and mention in the docs that the resource isn't compatible with 8.10. |
…feedback Co-authored-by: nick-benoit <[email protected]>
@copilot Please support all detection rule types defined in https://www.elastic.co/docs/api/doc/kibana/group/endpoint-security-detections-api This will require adding updating the schema in |
I'm implementing support for all detection rule types. I've updated the schema to support all 8 rule types (query, eql, esql, machine_learning, new_terms, saved_query, threat_match, threshold) with their specific fields, and I'm working on updating the models to handle creation and updates for each type. This is a significant change that requires updating the create, update, and read logic for all rule types. I'll commit the progress once the implementation is complete and tested. |
Co-authored-by: nick-benoit <[email protected]>
Co-authored-by: Toby Brain <[email protected]>
…vider-elasticstack into copilot/fix-1290-2
Co-authored-by: Toby Brain <[email protected]>
Co-authored-by: Toby Brain <[email protected]>
Co-authored-by: Toby Brain <[email protected]>
…vider-elasticstack into copilot/fix-1290-2
Co-authored-by: Toby Brain <[email protected]>
Either skip check for required fields or use utils.IsKnown
Co-authored-by: Toby Brain <[email protected]>
Co-authored-by: Toby Brain <[email protected]>
internal/kibana/security_detection_rule/models_machine_learning.go
Outdated
Show resolved
Hide resolved
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 with one minor nit. Happy to get those addressed in a follow up PR though if you wanted to get this merged/released.
} | ||
|
||
// Helper function to update data view ID from API response | ||
func (d *SecurityDetectionRuleData) updateDataViewIdFromApi(ctx context.Context, dataViewId *kbapi.SecurityDetectionsAPIDataViewId) diag.Diagnostics { |
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.
The following few functions return diags that will always be empty. We should likely just remove the return value altogether.
…vider-elasticstack into copilot/fix-1290-2
Implements comprehensive support for Kibana Security Detection Rules with multiple rule types beyond the initial query rules.
Fixes #523
Changes Made
Core Infrastructure
Multi-Rule Type Support
Rule Type Specific Fields Added
Current Status
This implementation provides a solid foundation for all Kibana Security Detection rule types while maintaining backward compatibility and following established patterns in the codebase.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.