[8.x] [Attack Discovery][Scheduling] Attack Discovery scheduling rule management (#12003) (#216656)#217794
Merged
e40pud merged 1 commit intoelastic:8.xfrom Apr 10, 2025
Merged
Conversation
…ement (elastic#12003) (elastic#216656) ## Summary Main ticket ([Internal link](elastic/security-team#12003)) To allow users to schedule Attack Discovery generations, we will use either [Alerting Framework](https://www.elastic.co/guide/en/kibana/current/alerting-getting-started.html). These changes add functionality to manage new alerts type - Attack Discovery Schedule. ### Introduced endpoints - **Create** AD scheduling rule route: `POST /internal/elastic_assistant/attack_discovery/schedules` - **Read/Get** AD scheduling rule by id route: `GET /internal/elastic_assistant/attack_discovery/schedules/{id}` - **Update** AD scheduling rule by id route: `PUT /internal/elastic_assistant/attack_discovery/schedules/{id}` - **Delete** AD scheduling rule by id route: `DELETE /internal/elastic_assistant/attack_discovery/schedules/{id}` - **Enable** AD scheduling rule by id route: `POST /internal/elastic_assistant/attack_discovery/schedules/{id}/_enable` - **Disable** AD scheduling rule by id route: `POST /internal/elastic_assistant/attack_discovery/schedules/{id}/_disable` - **Find** all existing AD scheduling rules route: `GET /internal/elastic_assistant/attack_discovery/schedules/_find` ## NOTES The feature is hidden behind the feature flag: > xpack.securitySolution.enableExperimental: ['assistantAttackDiscoverySchedulingEnabled'] ## cURL examples <details> <summary>Create AD scheduling rule route</summary> ```curl curl --location 'http://localhost:5601/internal/elastic_assistant/attack_discovery/schedules' \ --header 'kbn-xsrf: true' \ --header 'elastic-api-version: 1' \ --header 'x-elastic-internal-origin: security-solution' \ --header 'Content-Type: application/json' \ --data '{ "name": "Test Schedule", "schedule": { "interval": "10m" }, "params": { "alertsIndexPattern": ".alerts-security.alerts-default", "apiConfig": { "connectorId": "gpt-4o", "actionTypeId": ".gen-ai" }, "end": "now", "size": 100, "start": "now-24h" } }' ``` </details> <details> <summary>Read/Get AD scheduling rule by id route</summary> ```curl curl --location 'http://localhost:5601/internal/elastic_assistant/attack_discovery/schedules/{id}' \ --header 'kbn-xsrf: true' \ --header 'elastic-api-version: 1' \ --header 'x-elastic-internal-origin: security-solution' ``` </details> <details> <summary>Update AD scheduling rule by id route</summary> ```curl curl --location --request PUT 'http://localhost:5601/internal/elastic_assistant/attack_discovery/schedules/{id}' \ --header 'kbn-xsrf: true' \ --header 'elastic-api-version: 1' \ --header 'x-elastic-internal-origin: security-solution' \ --header 'Content-Type: application/json' \ --data '{ "name": "Test Schedule - Updated", "schedule": { "interval": "123m" }, "params": { "alertsIndexPattern": ".alerts-security.alerts-default", "apiConfig": { "connectorId": "gpt-4o", "actionTypeId": ".gen-ai" }, "end": "now", "size": 35, "start": "now-24h" }, "actions": [] }' ``` </details> <details> <summary>Delete AD scheduling rule by id route</summary> ```curl curl --location --request DELETE 'http://localhost:5601/internal/elastic_assistant/attack_discovery/schedules/{id}' \ --header 'kbn-xsrf: true' \ --header 'elastic-api-version: 1' \ --header 'x-elastic-internal-origin: security-solution' ``` </details> <details> <summary>Enable AD scheduling rule by id route</summary> ```curl curl --location --request POST 'http://localhost:5601/internal/elastic_assistant/attack_discovery/schedules/{id}/_enable' \ --header 'kbn-xsrf: true' \ --header 'elastic-api-version: 1' \ --header 'x-elastic-internal-origin: security-solution' ``` </details> <details> <summary>Disable AD scheduling rule by id route</summary> ```curl curl --location --request POST 'http://localhost:5601/internal/elastic_assistant/attack_discovery/schedules/{id}/_disable' \ --header 'kbn-xsrf: true' \ --header 'elastic-api-version: 1' \ --header 'x-elastic-internal-origin: security-solution' ``` </details> <details> <summary>Find all existing AD scheduling rules route</summary> ```curl curl --location 'http://localhost:5601/internal/elastic_assistant/attack_discovery/schedules/_find' \ --header 'kbn-xsrf: true' \ --header 'elastic-api-version: 1' \ --header 'x-elastic-internal-origin: security-solution' ``` </details> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit fc11ca9) # Conflicts: # x-pack/solutions/security/plugins/elastic_assistant/server/types.ts
Contributor
💔 Build Failed
Failed CI Steps |
Contributor
Author
|
/ci |
patrykkopycinski
approved these changes
Apr 10, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport
This will backport the following commits from
mainto8.x:Questions ?
Please refer to the Backport tool documentation