[RAC] RuleDataClient writer should handle inserting required fields into new alert documents #107980
Labels
Team:Detection Alerts
Security Detection Alerts Area Team
Team:Detections and Resp
Security Detection Response Team
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Theme: rac
label obsolete
Right now the RuleDataWriter is a thin wrapper around the ElasticsearchClient. It expects callers to provide a request that it can provide directly to the
ElasticsearchClient.bulk
method. The RuleDataWriter does not make any changes to the documents before sending them off to ES, which means callers are responsible for adding the required fields (at least space IDs, consumer, producer, rule type ID,event.kind
, and@timestamp
). Since these fields are absolutely required for all alerts-as-data documents in order for RBAC and filtering to work correctly, inserting them should not be left up to individual rule types.Rather than taking a fully formed request ready to pass into
ElasticsearchClient.bulk
, theRuleDataWriter.bulk
method could take an array of alert documents that each contain the rule specific fields that need to be included in the alert. The RuleDataWriter would then augment each document with the additional required fields, format the documents in the request toElasticsearchClient.bulk
, and index the docs.This could be done as a refactor for 7.16 rather than rushing to get it in 7.15, as it's not absolutely required for alerts as data to work correctly. However, this change will make it easier to develop rules on top of the rule registry - reducing the likelihood of bugs in required fields and reducing the knowledge devs writing rules need to have about the internals of the rule registry - so it is medium-high priority.
The text was updated successfully, but these errors were encountered: