Skip to content

[Security Solution][Attacks/Alerts][Setup and miscellaneous] Unified Alerts: Hooks to work with the new endpoints (#247387)#247389

Merged
e40pud merged 4 commits intoelastic:mainfrom
e40pud:security/attack-alerts-alignment/247387-unified-alerts-hooks
Dec 24, 2025
Merged

[Security Solution][Attacks/Alerts][Setup and miscellaneous] Unified Alerts: Hooks to work with the new endpoints (#247387)#247389
e40pud merged 4 commits intoelastic:mainfrom
e40pud:security/attack-alerts-alignment/247387-unified-alerts-hooks

Conversation

@e40pud
Copy link
Contributor

@e40pud e40pud commented Dec 23, 2025

Summary

Closes #247387

This PR implements public-side logic to interact with the unified alerts management endpoints created in as part of this ticket in this PR. It provides React Query hooks and API wrappers that enable the frontend to perform bulk operations (search, tag updates, assignee updates, and workflow status changes) on both detection alerts and attack alerts through a unified interface.

Motivation

The new Attacks page requires a unified way to manage different types of alerts (detection engine alerts and attack discovery alerts) in a single view. This PR provides the frontend infrastructure needed to interact with the backend unified alerts endpoints, enabling consistent user experience across alert management operations.

Implementation Details

API Layer (api/index.ts)

  • searchUnifiedAlerts: Wraps POST /internal/detection_engine/unified_alerts/search endpoint for searching unified alerts
  • setUnifiedAlertsWorkflowStatus: Wraps POST /internal/detection_engine/unified_alerts/workflow_status endpoint
  • setUnifiedAlertsTags: Wraps POST /internal/detection_engine/unified_alerts/tags endpoint
  • setUnifiedAlertsAssignees: Wraps POST /internal/detection_engine/unified_alerts/assignees endpoint

React Query Hooks

Query Hook

  • useSearchUnifiedAlerts: React Query hook for searching unified alerts
    • Accepts SearchUnifiedAlertsRequestBody as parameter
    • Provides automatic caching, error handling, and loading states
    • Includes cache invalidation support via useInvalidateSearchUnifiedAlerts

Mutation Hooks

  • useSetUnifiedAlertsWorkflowStatus: Mutation hook for updating workflow status
  • useSetUnifiedAlertsTags: Mutation hook for adding/removing tags
  • useSetUnifiedAlertsAssignees: Mutation hook for adding/removing assignees

File Structure

x-pack/solutions/security/plugins/security_solution/public/common/containers/unified_alerts/
├── __mocks__/
│   ├── index.ts
│   ├── unified_alerts.ts
│   └── update_responses.ts
├── api/
│   ├── index.ts
│   └── index.test.ts
├── hooks/
│   ├── constants.ts
│   ├── translations.ts
│   ├── use_search_unified_alerts.ts
│   ├── use_search_unified_alerts.test.tsx
│   ├── use_set_unified_alerts_workflow_status.ts
│   ├── use_set_unified_alerts_workflow_status.test.tsx
│   ├── use_set_unified_alerts_tags.ts
│   ├── use_set_unified_alerts_tags.test.tsx
│   ├── use_set_unified_alerts_assignees.ts
│   └── use_set_unified_alerts_assignees.test.tsx
└── index.ts

Testing Instructions

  1. Run unit tests:

    yarn test:jest x-pack/solutions/security/plugins/security_solution/public/common/containers/unified_alerts
  2. Verify all tests pass (13 tests across 5 test suites)

@e40pud e40pud self-assigned this Dec 23, 2025
@e40pud e40pud requested a review from a team as a code owner December 23, 2025 15:36
@e40pud e40pud added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team labels Dec 23, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] x-pack/solutions/security/test/cloud_security_posture_functional/config.ts / Cloud Security Posture Security Network Page - Graph visualization ECS fields only expanded flyout - entity enrichment for multiple actors and targets

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 687 691 +4

References to deprecated APIs

id before after diff
securitySolution 437 438 +1

Total ESLint disabled count

id before after diff
securitySolution 791 795 +4

History

cc @e40pud

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

Nice work! I like to see the all the error will show up in a toast!

@e40pud e40pud merged commit 4fd0079 into elastic:main Dec 24, 2025
13 checks passed
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 6, 2026
…Alerts: Hooks to work with the new endpoints (elastic#247387) (elastic#247389)

## Summary

Closes elastic#247387

This PR implements public-side logic to interact with the unified alerts
management endpoints created in as part of this
[ticket](elastic#247065) in this
[PR](elastic#247068). It provides React
Query hooks and API wrappers that enable the frontend to perform bulk
operations (search, tag updates, assignee updates, and workflow status
changes) on both detection alerts and attack alerts through a unified
interface.

## Motivation

The new **Attacks page** requires a unified way to manage different
types of alerts (detection engine alerts and attack discovery alerts) in
a single view. This PR provides the frontend infrastructure needed to
interact with the backend unified alerts endpoints, enabling consistent
user experience across alert management operations.

## Implementation Details

### API Layer (`api/index.ts`)
- **`searchUnifiedAlerts`**: Wraps `POST
/internal/detection_engine/unified_alerts/search` endpoint for searching
unified alerts
- **`setUnifiedAlertsWorkflowStatus`**: Wraps `POST
/internal/detection_engine/unified_alerts/workflow_status` endpoint
- **`setUnifiedAlertsTags`**: Wraps `POST
/internal/detection_engine/unified_alerts/tags` endpoint
- **`setUnifiedAlertsAssignees`**: Wraps `POST
/internal/detection_engine/unified_alerts/assignees` endpoint

### React Query Hooks

#### Query Hook
- **`useSearchUnifiedAlerts`**: React Query hook for searching unified
alerts
  - Accepts `SearchUnifiedAlertsRequestBody` as parameter
  - Provides automatic caching, error handling, and loading states
- Includes cache invalidation support via
`useInvalidateSearchUnifiedAlerts`

#### Mutation Hooks
- **`useSetUnifiedAlertsWorkflowStatus`**: Mutation hook for updating
workflow status
- **`useSetUnifiedAlertsTags`**: Mutation hook for adding/removing tags
- **`useSetUnifiedAlertsAssignees`**: Mutation hook for adding/removing
assignees

## File Structure

```
x-pack/solutions/security/plugins/security_solution/public/common/containers/unified_alerts/
├── __mocks__/
│   ├── index.ts
│   ├── unified_alerts.ts
│   └── update_responses.ts
├── api/
│   ├── index.ts
│   └── index.test.ts
├── hooks/
│   ├── constants.ts
│   ├── translations.ts
│   ├── use_search_unified_alerts.ts
│   ├── use_search_unified_alerts.test.tsx
│   ├── use_set_unified_alerts_workflow_status.ts
│   ├── use_set_unified_alerts_workflow_status.test.tsx
│   ├── use_set_unified_alerts_tags.ts
│   ├── use_set_unified_alerts_tags.test.tsx
│   ├── use_set_unified_alerts_assignees.ts
│   └── use_set_unified_alerts_assignees.test.tsx
└── index.ts
```

## Testing Instructions

1. Run unit tests:
   ```bash
yarn test:jest
x-pack/solutions/security/plugins/security_solution/public/common/containers/unified_alerts
   ```

2. Verify all tests pass (13 tests across 5 test suites)
dej611 pushed a commit to dej611/kibana that referenced this pull request Jan 8, 2026
…Alerts: Hooks to work with the new endpoints (elastic#247387) (elastic#247389)

## Summary

Closes elastic#247387

This PR implements public-side logic to interact with the unified alerts
management endpoints created in as part of this
[ticket](elastic#247065) in this
[PR](elastic#247068). It provides React
Query hooks and API wrappers that enable the frontend to perform bulk
operations (search, tag updates, assignee updates, and workflow status
changes) on both detection alerts and attack alerts through a unified
interface.

## Motivation

The new **Attacks page** requires a unified way to manage different
types of alerts (detection engine alerts and attack discovery alerts) in
a single view. This PR provides the frontend infrastructure needed to
interact with the backend unified alerts endpoints, enabling consistent
user experience across alert management operations.

## Implementation Details

### API Layer (`api/index.ts`)
- **`searchUnifiedAlerts`**: Wraps `POST
/internal/detection_engine/unified_alerts/search` endpoint for searching
unified alerts
- **`setUnifiedAlertsWorkflowStatus`**: Wraps `POST
/internal/detection_engine/unified_alerts/workflow_status` endpoint
- **`setUnifiedAlertsTags`**: Wraps `POST
/internal/detection_engine/unified_alerts/tags` endpoint
- **`setUnifiedAlertsAssignees`**: Wraps `POST
/internal/detection_engine/unified_alerts/assignees` endpoint

### React Query Hooks

#### Query Hook
- **`useSearchUnifiedAlerts`**: React Query hook for searching unified
alerts
  - Accepts `SearchUnifiedAlertsRequestBody` as parameter
  - Provides automatic caching, error handling, and loading states
- Includes cache invalidation support via
`useInvalidateSearchUnifiedAlerts`

#### Mutation Hooks
- **`useSetUnifiedAlertsWorkflowStatus`**: Mutation hook for updating
workflow status
- **`useSetUnifiedAlertsTags`**: Mutation hook for adding/removing tags
- **`useSetUnifiedAlertsAssignees`**: Mutation hook for adding/removing
assignees

## File Structure

```
x-pack/solutions/security/plugins/security_solution/public/common/containers/unified_alerts/
├── __mocks__/
│   ├── index.ts
│   ├── unified_alerts.ts
│   └── update_responses.ts
├── api/
│   ├── index.ts
│   └── index.test.ts
├── hooks/
│   ├── constants.ts
│   ├── translations.ts
│   ├── use_search_unified_alerts.ts
│   ├── use_search_unified_alerts.test.tsx
│   ├── use_set_unified_alerts_workflow_status.ts
│   ├── use_set_unified_alerts_workflow_status.test.tsx
│   ├── use_set_unified_alerts_tags.ts
│   ├── use_set_unified_alerts_tags.test.tsx
│   ├── use_set_unified_alerts_assignees.ts
│   └── use_set_unified_alerts_assignees.test.tsx
└── index.ts
```

## Testing Instructions

1. Run unit tests:
   ```bash
yarn test:jest
x-pack/solutions/security/plugins/security_solution/public/common/containers/unified_alerts
   ```

2. Verify all tests pass (13 tests across 5 test suites)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team Team:Threat Hunting Security Solution Threat Hunting Team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security Solution][Attacks/Alerts][Setup and miscellaneous] Unified Alerts: Hooks to work with the new endpoints

4 participants