Skip to content

[Security Solution][AI4DSOC] Fix table not applying alert tags for Attack discovery and Cases pages in AI4DSOC#219410

Merged
PhilippeOberti merged 2 commits intoelastic:mainfrom
PhilippeOberti:fix-alert-tags
Apr 28, 2025
Merged

[Security Solution][AI4DSOC] Fix table not applying alert tags for Attack discovery and Cases pages in AI4DSOC#219410
PhilippeOberti merged 2 commits intoelastic:mainfrom
PhilippeOberti:fix-alert-tags

Conversation

@PhilippeOberti
Copy link
Contributor

@PhilippeOberti PhilippeOberti commented Apr 28, 2025

Summary

This PR fixes an issue with the apply alert tags functionality. This setAlertTags hook introduced in this PR was making use of a useRef and a useCallback which lead to the table having a null reference when it was expecting a function.

This meant that for parent table components that were written efficiently (meaning that do not render too many times), the set alert tags bulk actions was just plain not working. As can be seen in the following video:

Screen.Recording.2025-04-28.at.9.36.08.AM.mov

And this is with the fix in this PR

Screen.Recording.2025-04-28.at.9.33.08.AM.mov

The PR also makes 2 very small adjustments to the AI4DSOC alerts table in the Cases and Attack discovery pages, to make sure that the table refreshes after applying alert tags.

Checklist

@PhilippeOberti PhilippeOberti marked this pull request as ready for review April 28, 2025 15:11
@PhilippeOberti PhilippeOberti requested review from a team as code owners April 28, 2025 15:11
@PhilippeOberti PhilippeOberti requested a review from dplumlee April 28, 2025 15:11
@PhilippeOberti PhilippeOberti added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team Team:Security Generative AI Security Generative AI v9.1.0 labels Apr 28, 2025
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@dplumlee dplumlee left a comment

Choose a reason for hiding this comment

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

LGTM, talked about this with @PhilippeOberti offline. This bug likely also exists in the useSetAlertAssignees hook but can be addressed in a separate PR

@PhilippeOberti
Copy link
Contributor Author

LGTM, talked about this with @PhilippeOberti offline. This bug likely also exists in the useSetAlertAssignees hook but can be addressed in a separate PR

That is correct, I did notice that during my investigation. I'm already working on it separately, as I wanted this to go in asap for the conference.
Thank you!!

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Thanks!

@PhilippeOberti PhilippeOberti enabled auto-merge (squash) April 28, 2025 16:19
@PhilippeOberti PhilippeOberti merged commit 6f4d780 into elastic:main Apr 28, 2025
9 checks passed
@PhilippeOberti PhilippeOberti deleted the fix-alert-tags branch April 28, 2025 17:17
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 9.1MB 9.1MB -40.0B

History

PhilippeOberti added a commit that referenced this pull request May 1, 2025
…ssignees (#219460)

## Summary

This PR implements a similar change that was just merged a few hours
ago. While [that change](#219410)
was made to the alert tags not always working on the alerts table, this
current change is applied to the alert assignees that faced a potential
similar issue. The alert assignee code was introduced in [this
PR](#170579), and I believe the
code was using the similar logic of [the alert tag
PR](#157786).

The issue is related to the fact that we have a `useRef` for a function
that is returned before the `useEffect` in the same hook runs, and
setting the value of the function returned is happening within that
`useEffect`. This has not caused any issues because the few places where
this code is being used (the alerts page alerts table) is extremely not
efficient and renders multiple times. This gives enough tries to the
hook to actually get a value and return the correct function.

This PR fixes that by returning the function directly.

Here's a video showing that the functionality still works correctly for
bulk actions:


https://github.com/user-attachments/assets/b3394ffe-8333-4e0a-9bf7-831ef8ea8aea

And also for normal row actions:


https://github.com/user-attachments/assets/5f8c9d23-f0ef-4c65-b7de-4dc34478a8e7

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…tack discovery and Cases pages in AI4DSOC (elastic#219410)

## Summary

This PR fixes an issue with the `apply alert tags` functionality. This
[setAlertTags](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/public/common/components/toolbar/bulk_actions/use_set_alert_tags.tsx)
hook introduced in [this
PR](elastic#157786) was making use of a
`useRef` and a `useCallback` which lead to the table having a `null`
reference when it was expecting a `function`.

This meant that for parent table components that were written
efficiently (meaning that do not render too many times), the set alert
tags bulk actions was just plain not working. As can be seen in the
following video:


https://github.com/user-attachments/assets/50545677-d7a7-4d45-828e-89bdd7b2de34

And this is with the fix in this PR 


https://github.com/user-attachments/assets/b1f07e55-43bb-4d01-bfd9-3b0dd23e30cc

The PR also makes 2 very small adjustments to the AI4DSOC alerts table
in the Cases and Attack discovery pages, to make sure that the table
refreshes after applying alert tags.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…ssignees (elastic#219460)

## Summary

This PR implements a similar change that was just merged a few hours
ago. While [that change](elastic#219410)
was made to the alert tags not always working on the alerts table, this
current change is applied to the alert assignees that faced a potential
similar issue. The alert assignee code was introduced in [this
PR](elastic#170579), and I believe the
code was using the similar logic of [the alert tag
PR](elastic#157786).

The issue is related to the fact that we have a `useRef` for a function
that is returned before the `useEffect` in the same hook runs, and
setting the value of the function returned is happening within that
`useEffect`. This has not caused any issues because the few places where
this code is being used (the alerts page alerts table) is extremely not
efficient and renders multiple times. This gives enough tries to the
hook to actually get a value and return the correct function.

This PR fixes that by returning the function directly.

Here's a video showing that the functionality still works correctly for
bulk actions:


https://github.com/user-attachments/assets/b3394ffe-8333-4e0a-9bf7-831ef8ea8aea

And also for normal row actions:


https://github.com/user-attachments/assets/5f8c9d23-f0ef-4c65-b7de-4dc34478a8e7

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
PhilippeOberti added a commit to PhilippeOberti/kibana that referenced this pull request May 30, 2025
…tack discovery and Cases pages in AI4DSOC (elastic#219410)

## Summary

This PR fixes an issue with the `apply alert tags` functionality. This
[setAlertTags](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/public/common/components/toolbar/bulk_actions/use_set_alert_tags.tsx)
hook introduced in [this
PR](elastic#157786) was making use of a
`useRef` and a `useCallback` which lead to the table having a `null`
reference when it was expecting a `function`.

This meant that for parent table components that were written
efficiently (meaning that do not render too many times), the set alert
tags bulk actions was just plain not working. As can be seen in the
following video:

https://github.com/user-attachments/assets/50545677-d7a7-4d45-828e-89bdd7b2de34

And this is with the fix in this PR

https://github.com/user-attachments/assets/b1f07e55-43bb-4d01-bfd9-3b0dd23e30cc

The PR also makes 2 very small adjustments to the AI4DSOC alerts table
in the Cases and Attack discovery pages, to make sure that the table
refreshes after applying alert tags.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 6f4d780)
PhilippeOberti added a commit to PhilippeOberti/kibana that referenced this pull request May 30, 2025
…ssignees (elastic#219460)

## Summary

This PR implements a similar change that was just merged a few hours
ago. While [that change](elastic#219410)
was made to the alert tags not always working on the alerts table, this
current change is applied to the alert assignees that faced a potential
similar issue. The alert assignee code was introduced in [this
PR](elastic#170579), and I believe the
code was using the similar logic of [the alert tag
PR](elastic#157786).

The issue is related to the fact that we have a `useRef` for a function
that is returned before the `useEffect` in the same hook runs, and
setting the value of the function returned is happening within that
`useEffect`. This has not caused any issues because the few places where
this code is being used (the alerts page alerts table) is extremely not
efficient and renders multiple times. This gives enough tries to the
hook to actually get a value and return the correct function.

This PR fixes that by returning the function directly.

Here's a video showing that the functionality still works correctly for
bulk actions:

https://github.com/user-attachments/assets/b3394ffe-8333-4e0a-9bf7-831ef8ea8aea

And also for normal row actions:

https://github.com/user-attachments/assets/5f8c9d23-f0ef-4c65-b7de-4dc34478a8e7

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 254477e)
PhilippeOberti added a commit to PhilippeOberti/kibana that referenced this pull request May 30, 2025
…tack discovery and Cases pages in AI4DSOC (elastic#219410)

## Summary

This PR fixes an issue with the `apply alert tags` functionality. This
[setAlertTags](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/public/common/components/toolbar/bulk_actions/use_set_alert_tags.tsx)
hook introduced in [this
PR](elastic#157786) was making use of a
`useRef` and a `useCallback` which lead to the table having a `null`
reference when it was expecting a `function`.

This meant that for parent table components that were written
efficiently (meaning that do not render too many times), the set alert
tags bulk actions was just plain not working. As can be seen in the
following video:

https://github.com/user-attachments/assets/50545677-d7a7-4d45-828e-89bdd7b2de34

And this is with the fix in this PR

https://github.com/user-attachments/assets/b1f07e55-43bb-4d01-bfd9-3b0dd23e30cc

The PR also makes 2 very small adjustments to the AI4DSOC alerts table
in the Cases and Attack discovery pages, to make sure that the table
refreshes after applying alert tags.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 6f4d780)
qn895 pushed a commit to qn895/kibana that referenced this pull request Jun 3, 2025
…ssignees (elastic#219460)

## Summary

This PR implements a similar change that was just merged a few hours
ago. While [that change](elastic#219410)
was made to the alert tags not always working on the alerts table, this
current change is applied to the alert assignees that faced a potential
similar issue. The alert assignee code was introduced in [this
PR](elastic#170579), and I believe the
code was using the similar logic of [the alert tag
PR](elastic#157786).

The issue is related to the fact that we have a `useRef` for a function
that is returned before the `useEffect` in the same hook runs, and
setting the value of the function returned is happening within that
`useEffect`. This has not caused any issues because the few places where
this code is being used (the alerts page alerts table) is extremely not
efficient and renders multiple times. This gives enough tries to the
hook to actually get a value and return the correct function.

This PR fixes that by returning the function directly.

Here's a video showing that the functionality still works correctly for
bulk actions:


https://github.com/user-attachments/assets/b3394ffe-8333-4e0a-9bf7-831ef8ea8aea

And also for normal row actions:


https://github.com/user-attachments/assets/5f8c9d23-f0ef-4c65-b7de-4dc34478a8e7

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
PhilippeOberti added a commit to PhilippeOberti/kibana that referenced this pull request Jun 4, 2025
…tack discovery and Cases pages in AI4DSOC (elastic#219410)

## Summary

This PR fixes an issue with the `apply alert tags` functionality. This
[setAlertTags](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/security_solution/public/common/components/toolbar/bulk_actions/use_set_alert_tags.tsx)
hook introduced in [this
PR](elastic#157786) was making use of a
`useRef` and a `useCallback` which lead to the table having a `null`
reference when it was expecting a `function`.

This meant that for parent table components that were written
efficiently (meaning that do not render too many times), the set alert
tags bulk actions was just plain not working. As can be seen in the
following video:

https://github.com/user-attachments/assets/50545677-d7a7-4d45-828e-89bdd7b2de34

And this is with the fix in this PR

https://github.com/user-attachments/assets/b1f07e55-43bb-4d01-bfd9-3b0dd23e30cc

The PR also makes 2 very small adjustments to the AI4DSOC alerts table
in the Cases and Attack discovery pages, to make sure that the table
refreshes after applying alert tags.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 6f4d780)
PhilippeOberti added a commit to PhilippeOberti/kibana that referenced this pull request Jun 4, 2025
…ssignees (elastic#219460)

## Summary

This PR implements a similar change that was just merged a few hours
ago. While [that change](elastic#219410)
was made to the alert tags not always working on the alerts table, this
current change is applied to the alert assignees that faced a potential
similar issue. The alert assignee code was introduced in [this
PR](elastic#170579), and I believe the
code was using the similar logic of [the alert tag
PR](elastic#157786).

The issue is related to the fact that we have a `useRef` for a function
that is returned before the `useEffect` in the same hook runs, and
setting the value of the function returned is happening within that
`useEffect`. This has not caused any issues because the few places where
this code is being used (the alerts page alerts table) is extremely not
efficient and renders multiple times. This gives enough tries to the
hook to actually get a value and return the correct function.

This PR fixes that by returning the function directly.

Here's a video showing that the functionality still works correctly for
bulk actions:

https://github.com/user-attachments/assets/b3394ffe-8333-4e0a-9bf7-831ef8ea8aea

And also for normal row actions:

https://github.com/user-attachments/assets/5f8c9d23-f0ef-4c65-b7de-4dc34478a8e7

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 254477e)
PhilippeOberti added a commit to PhilippeOberti/kibana that referenced this pull request Jun 4, 2025
…ssignees (elastic#219460)

## Summary

This PR implements a similar change that was just merged a few hours
ago. While [that change](elastic#219410)
was made to the alert tags not always working on the alerts table, this
current change is applied to the alert assignees that faced a potential
similar issue. The alert assignee code was introduced in [this
PR](elastic#170579), and I believe the
code was using the similar logic of [the alert tag
PR](elastic#157786).

The issue is related to the fact that we have a `useRef` for a function
that is returned before the `useEffect` in the same hook runs, and
setting the value of the function returned is happening within that
`useEffect`. This has not caused any issues because the few places where
this code is being used (the alerts page alerts table) is extremely not
efficient and renders multiple times. This gives enough tries to the
hook to actually get a value and return the correct function.

This PR fixes that by returning the function directly.

Here's a video showing that the functionality still works correctly for
bulk actions:

https://github.com/user-attachments/assets/b3394ffe-8333-4e0a-9bf7-831ef8ea8aea

And also for normal row actions:

https://github.com/user-attachments/assets/5f8c9d23-f0ef-4c65-b7de-4dc34478a8e7

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 254477e)
PhilippeOberti added a commit that referenced this pull request Jun 4, 2025
…) (#222074)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[AI4DSOC] Alert summary page routing and initialization
(#214889)](#214889)
- [[AI4DSOC] Alert summary landing page
(#215246)](#215246)
- [[AI4DSOC] Alert summary dataview
(#215265)](#215265)
- [[AI4DSOC] Alert summary KQL bar
[#215586]](#215586)
- [[AI4DSOC] Alert summary KPI charts
[#215585]](#215585)
- [[AI4DSOR] Alert summary integrations section
[#215266]](#215266)
- [[AI4DSOC] Fix issue with filtering by integrations
[#216574]](#216574)
- [[AI4DSOC] Alert summary table setup
[#216744]](#216744)
- [Alerty summary table flyout setup
[#217421]](#217421)
- [[AI4DSOC] Alert summary alert actions in table and flyout
[#217696]](#217696)
- [[AI4DSOC] Alert summary table custom cell renderers
[#217124]](#217124)
- [[AI4DSOC] Alert summary table and flyout ai assistant
[#217744]](#217744)
- [[AI4DSOC] Alert summary page performance improvements
[#218632]](#218632)
- [[AI4DSOC] Change the Attack Discovery page to use the AI for SOC
alerts table [#218736]](#218736)
- [[AI4DSOC] Change the Cases page to use the AI for SOC alerts table
[#218742]](#218742)
- [[AI4DSOC] Fix spacing issue on alert summary landing page integration
card [#218868]](#218868)
- [[AI4DSOC][ResponseOps] Fix alerts table not handling undefined
maintenanceWindow capability
[#218999]](#218999)
- [[AI4DSOC] Fix link to the new integrations page
[#219030]](#219030)
- [[AI4DSOC] Disable CellActions and PreviewLinks on the Attack
discovery page [#219033]](#219033)
- [[AI4DSOC] Add cell renderer for datetime fields to the alert summary
table [#219126]](#219126)
- [[AI4DSOC] Remove Assistant icon from row action in alert summary
table [#219141]](#219141)
- [[AI4DSOC] Add checkboxes to the alert summary table
[#219169]](#219169)
- [[Security Solution][AI4DSOC] Fix table not applying alert tags for
Attack discovery and Cases pages in AI4DSOC
[#219410]](#219410)
- [[AI4DSOC] Fix logic that renders the group title when grouping by
integrations [#219430]](#219430)
- [[AI4DSOC] Alert summary table truncates long values and display the
field/value pair in tooltip
[#219438]](#219438)
- [[Security Solution] Fix alerts table potentially not applying alert
assignees [#219460]](#219460)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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:Security Generative AI Security Generative AI Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants