Skip to content
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

[Security Solution][Detection Engine] improves ES|QL investigation fields for detection rules #177746

Merged

Conversation

vitaliidm
Copy link
Contributor

@vitaliidm vitaliidm commented Feb 23, 2024

Summary

Screen.Recording.2024-03-05.at.17.41.14.mov

Checklist

@vitaliidm vitaliidm changed the title [Security Solution][Detection Engine] improves ES|QL highlighted fields [Security Solution][Detection Engine] improves ES|QL investigation fields Feb 23, 2024
@vitaliidm vitaliidm self-assigned this Feb 23, 2024
@vitaliidm vitaliidm added release_note:enhancement Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Engine Security Solution Detection Engine Area 8.14 candidate labels Feb 23, 2024
@vitaliidm
Copy link
Contributor Author

/ci

@vitaliidm
Copy link
Contributor Author

/ci

@vitaliidm vitaliidm closed this Mar 4, 2024
@vitaliidm vitaliidm deleted the detection-engine/esql-highlighted-fields branch March 4, 2024 17:31
@vitaliidm vitaliidm restored the detection-engine/esql-highlighted-fields branch March 4, 2024 18:11
@vitaliidm vitaliidm reopened this Mar 4, 2024
@vitaliidm
Copy link
Contributor Author

/ci

@vitaliidm
Copy link
Contributor Author

/ci

@vitaliidm vitaliidm marked this pull request as ready for review March 5, 2024 17:46
@vitaliidm vitaliidm requested review from a team as code owners March 5, 2024 17:46
@vitaliidm vitaliidm requested a review from e40pud March 5, 2024 17:46
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-engine (Team:Detection Engine)

@vitaliidm vitaliidm changed the title [Security Solution][Detection Engine] improves ES|QL investigation fields [Security Solution][Detection Engine] improves ES|QL investigation fields for detection rules Mar 5, 2024
Copy link
Contributor

@e40pud e40pud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Just a quick question, do we need to show custom fields in the rule preview's highlighted fields section?

Screenshot 2024-03-06 at 11 28 51

};

export const useInvestigationFields: UseInvestigationFields = ({
isEsqlRule,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need isEsqlRule parameter? I guess if rule is not ESQL then esqlQuery will be undefined and that should cover it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, can be simplified, removed it

@vitaliidm
Copy link
Contributor Author

Just a quick question, do we need to show custom fields in the rule preview's highlighted fields section?

Looks like it affect only preview flyout.
Works for actual alerts.
Screenshot 2024-03-06 at 10 44 37

Thanks for catching this, going to investigate

@vitaliidm
Copy link
Contributor Author

@e40pud
Thank for spotting the issue in preview flyout.
It is already existing behaviour.
I have created a ticket to address it: #178082

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Entity Analytics - Security Solution Cypress Tests #2 / risk tab with new risk score shows risk information overlay when button is clicked shows risk information overlay when button is clicked

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 5015 5016 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 13.0MB 13.0MB +932.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @vitaliidm

@vitaliidm vitaliidm merged commit c983a15 into elastic:main Mar 6, 2024
37 checks passed
@kibanamachine kibanamachine added v8.14.0 backport:skip This commit does not require backporting labels Mar 6, 2024
vitaliidm added a commit that referenced this pull request May 20, 2024
… rule type (#180927)

## Summary

- addresses elastic/security-team#9203
- adds alert suppression for new terms rule type
- similarly to [custom investigation
fields](#177746) list of available
suppression fields:
  - shows only ES|QL fields returned in query for aggregating queries
- shows ES|QL fields returned in query + index fields for
non-aggregating queries. Since resulted alerts for this type of query,
are enriched with source documents.

### Demo

1. run esql rule w/o suppression
2. run esql rule w/ suppression per rule execution. Since ES|QL query is
aggregating, no alerts suppressed on already agrregated field `host.ip`
3. run suppression on interval 20m
4. run suppression for custom ES|QL field which is the same as
`host.ip`, hence same results
5. run suppression on interval 100m


https://github.com/elastic/kibana/assets/92328789/4bd8cf13-6e23-4842-b775-605c74ae0127

### Limitations

Since suppressed alerts deduplication relies on alert timestamps,
sorting of results other than `@timestamp asc` in ES|QL query may impact
on number of suppressed alerts, when number of possible alerts more than
max_signals.
This affects only non-aggregating queries, since suppression boundaries
for these alerts set as rule execution time

### Checklist

- [x] Functional changes are hidden behind a feature flag 

    Feature flag `alertSuppressionForEsqlRuleEnabled`

- [x] Functional changes are covered with a test plan and automated
tests.

  - elastic/security-team#9389

- [x] Stability of new and changed tests is verified using the [Flaky
Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner).
- FTR(x100):
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5907
- Cypress(x100):
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6011
  
- [x] Comprehensive manual testing is done by two engineers: the PR
author and one of the PR reviewers. Changes are tested in both ESS and
Serverless.

- [x] Mapping changes are accompanied by a technical design document. It
can be a GitHub issue or an RFC explaining the changes. The design
document is shared with and approved by the appropriate teams and
individual stakeholders.

Existing AlertSuppression schema field is used for ES|QL rule, the one
that already used for Query, New terms and IM rules.
  
  ```yml
      alert_suppression:
$ref:
'./common_attributes.schema.yaml#/components/schemas/AlertSuppression'
  ```
  where
  
  ```yml
      AlertSuppression:
        type: object
        properties:
          group_by:
            $ref: '#/components/schemas/AlertSuppressionGroupBy'
          duration:
            $ref: '#/components/schemas/AlertSuppressionDuration'
          missing_fields_strategy:
$ref: '#/components/schemas/AlertSuppressionMissingFieldsStrategy'
        required:
          - group_by
     ```

- [x] Functional changes are communicated to the Docs team. A ticket or
PR is opened in https://github.com/elastic/security-docs. The following
information is included: any feature flags used, affected environments
(Serverless, ESS, or both).

  - elastic/security-docs#5156

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Nikita Indik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.14 candidate backport:skip This commit does not require backporting release_note:enhancement Team:Detection Engine Security Solution Detection Engine Area Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants