Skip to content

[8.19] [Attack discovery] Optionally update the kibana.alert.workflow_status of alerts associated with Attack discoveries (#225029)#225349

Merged
kibanamachine merged 1 commit intoelastic:8.19from
kibanamachine:backport/8.19/pr-225029
Jun 25, 2025
Merged

[8.19] [Attack discovery] Optionally update the kibana.alert.workflow_status of alerts associated with Attack discoveries (#225029)#225349
kibanamachine merged 1 commit intoelastic:8.19from
kibanamachine:backport/8.19/pr-225029

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

…s` of alerts associated with Attack discoveries (elastic#225029)

## [Attack discovery] Optionally update the `kibana.alert.workflow_status` of alerts associated with Attack discoveries

This PR introduces a new UI to optionally update the `kibana.alert.workflow_status` of alerts associated with Attack discoveries, as illustrated by the animated gif below:

![update_attack_discovery_alerts](https://github.com/user-attachments/assets/5974fc4e-50b4-43e9-9939-885f9577c153)

Users may (optionally) update all alerts for a single attack discovery, or just update the discovery itself:

![update_one_attack_discovery](https://github.com/user-attachments/assets/fd774ae7-976d-4649-a97d-b9bae8d359ad)

When multiple attack discoveries are selected, users may also (optionally) update the status of all their related alerts via the bulk action menu:

![update_multiple_discoveries](https://github.com/user-attachments/assets/71463945-f201-4810-9798-2646751dc919)

### Alert document enhancements

Attack discoveries generated via the Attack discovery page, and scheduled Attack discoveries (generated via the alerting framework), are persisted as alert documents.

To support the new UI, this PR populates Attack discovery alert documents with two additional (existing, but unused by Attack discovery) alert document fields:

1) `kibana.alert.start` - timestamp when Attack discoveries are created

2) `kibana.alert.workflow_status_updated_at` - timestamp when the `kibana.alert.workflow_status` was last updated

This PR introduces three new alert document fields to capture metadata about when alerts are updated. Attack discovery is the first implementation to use these new fields, however any consumer of the alerting framework may utilize them in the future:

1) `kibana.alert.updated_at` - timestamp when the alert was last updated

2) `kibana.alert.updated_by.user.id` - user id of the user that last updated the alert

3) `kibana.alert.updated_by.user.name` -  user name of the user that last updated the alert

The three new alert fields above are updated when Attack discovery users update:

- The `kibana.alert.workflow_status` status of Attack discoveries
- The visibility (sharing) status of Attack discoveries (`kibana.alert.attack_discovery.users`)

The three new fields above were added to the [alert_field_map](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-alerts-as-data-utils/src/field_maps/alert_field_map.ts) and [alert_schema](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-alerts-as-data-utils/src/schemas/generated/alert_schema.ts).

Using the `default` space as an example, the fields above may be observed in the `.adhoc.alerts-security.attack.discovery.alerts-default` data stream for Attack discoveries generated on the Attack discovery page, and scheduled discoveries for the same space are found in the `.alerts-security.attack.discovery.alerts-default` data stream.

### @timestamp updated when sharing status changes

To ensure newly-shared Attack discoveries are bumped to the top of search results, the `@timestamp` field is updated when the visibility (sharing) status of Attack discoveries (`kibana.alert.attack_discovery.users`) is updated.

(The original time an Attack discovery was generated is represented by the `kibana.alert.start` field, which is not mutated.)

### Visibility menu changes

This PR disables the visibility menu items for shared Attack discoveries, as illustrated by the screenshot below:

![visibility_menu_disabled](https://github.com/user-attachments/assets/168db75c-de8f-4bf1-9490-7e3995faed9d)

The disabled menu has a tooltip that reads:

```
The visibility of shared discoveries cannot be changed
```

Note: The internal Attack discovery bulk API still (intentionally) allows changes to the visibility of shared attack discoveries.

### `kibana.alert.workflow_status` added to default `Alerts` tab columns

The `kibana.alert.workflow_status` field was added to default `Alerts` tab columns, as illustrated by the screenshot below:

![alerts_tab_workflow_status](https://github.com/user-attachments/assets/264647d0-5782-444f-ad0e-c5485fae1e96)

### Summary of field updates

The following table describes when fields are updated (via this PR):

| Field                                     | Updated when                                                                                                                         | Description                                                                                  |
|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
| `kibana.alert.start`                      | - Attack discoveries are created                                                                                                     | timestamp when Attack discoveries are created                                                |
| `kibana.alert.workflow_status_updated_at` | - Workflow status (`kibana.alert.workflow_status`) is updated                                                                        | timestamp when `kibana.alert.workflow_status` was last updated                               |
| `kibana.alert.updated_at`                 | - Workflow status (`kibana.alert.workflow_status`) is updated<br>- Sharing status (`kibana.alert.attack_discovery.users`) is updated | timestamp when the alert was last updated                                                    |
| `kibana.alert.updated_by.user.id`         | - Workflow status (`kibana.alert.workflow_status`) is updated<br>- Sharing status (`kibana.alert.attack_discovery.users`) is updated | user id of the user that last updated the alert                                              |
| `kibana.alert.updated_by.user.name`       | - Workflow status (`kibana.alert.workflow_status`) is updated<br>- Sharing status (`kibana.alert.attack_discovery.users`) is updated | user name of the user that last updated the alert                                            |
| `@timestamp`                              | - Attack discoveries are created<br>- Sharing status (`kibana.alert.attack_discovery.users`) is updated                              | ECS [`@timestamp`](https://www.elastic.co/docs/reference/ecs/ecs-base#field-timestamp) field |

### Feature flags

The _required_ feature flag below is necessary to desk test with Ad hoc attack discoveries. The _recommended_ feature flag below enables testing with scheduled Attack discoveries.

### required: `securitySolution.attackDiscoveryAlertsEnabled`

Enable the required `securitySolution.attackDiscoveryAlertsEnabled` feature flag in `config/kibana.dev.yml`:

```yaml
feature_flags.overrides:
  securitySolution.attackDiscoveryAlertsEnabled: true
```

### recommended: `securitySolution.assistantAttackDiscoverySchedulingEnabled: true`

Also enable the recommended `assistantAttackDiscoverySchedulingEnabled` feature flag in `config/kibana.dev.yml`:

```yaml
feature_flags.overrides:
  securitySolution.attackDiscoveryAlertsEnabled: true
  securitySolution.assistantAttackDiscoverySchedulingEnabled: true
```

(cherry picked from commit ea7d174)
@kibanamachine kibanamachine merged commit b4d6f9a into elastic:8.19 Jun 25, 2025
11 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #63 / APM API tests service_maps/service_maps.spec.ts trial apm_8.0.0 Service Map with data /internal/apm/service-map with data with ML data with the default apm user returns the correct anomaly stats
  • [job] [logs] Jest Tests #10 / Create renders correctly with default values

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 7515 7519 +4

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/rule-data-utils 185 191 +6

Async chunks

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

id before after diff
observability 1.3MB 1.3MB +132.0B
securitySolution 9.4MB 9.4MB +6.2KB
slo 1015.4KB 1015.5KB +132.0B
synthetics 1.0MB 1.0MB +135.0B
total +6.6KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observability 93.4KB 93.5KB +105.0B
slo 57.5KB 57.7KB +105.0B
synthetics 53.1KB 53.2KB +105.0B
timelines 177.8KB 178.0KB +210.0B
total +525.0B
Unknown metric groups

API count

id before after diff
@kbn/rule-data-utils 198 204 +6

ESLint disabled line counts

id before after diff
securitySolution 566 567 +1

Total ESLint disabled count

id before after diff
securitySolution 653 654 +1

cc @andrew-goldstein

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants