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] [Bug] Multiple filtering actions in Lens visualizations #171167

Closed
semd opened this issue Nov 14, 2023 · 2 comments
Closed

[Security Solution] [Bug] Multiple filtering actions in Lens visualizations #171167

semd opened this issue Nov 14, 2023 · 2 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.12.0

Comments

@semd
Copy link
Contributor

semd commented Nov 14, 2023

Summary

Lens visualizations in Security are showing multiple Filter for & Filter out actions.
The issue does not happen outside Security, when editing visualizations in the Lens app it works as expected.

fwiw, not all filter actions work, only the first two and the last two.

It can be reproduced on the Security Alerts page in the Counts table:

image

Also in the Lens visualizations added in dashboards inside Security:

Captura de pantalla 2023-11-14 a les 11 34 06 Captura de pantalla 2023-11-14 a les 11 34 39
@semd semd added bug Fixes for quality problems that affect the customer experience Team:Threat Hunting Security Solution Threat Hunting Team Team:Threat Hunting:Explore v8.12.0 labels Nov 14, 2023
@elasticmachine
Copy link
Contributor

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

@semd
Copy link
Contributor Author

semd commented Nov 15, 2023

The bug is caused by this PR. Only the showTopN popover visualization was taken into consideration. The rest of the Lens visualizations in Security do not pass the shouldShowLegendAction property, so all the registered actions are displayed.

We could add this prop to the Alerts page and other visualizations we render directly. BUT, the Dashboards inside Security also render Lens visualizations, and we do not have control over how those visualizations are rendered, this new shouldShowLegendAction property is not useful in this case.

I am implementing a PoC that do not require any new property, we can use the actions type property to check if any of the registered action is a "Filter" action, if so, the default (hardcoded) "Filter" actions will not be displayed.

cc @drewdaemon

@semd semd closed this as completed Nov 20, 2023
kibanamachine added a commit to nreese/kibana that referenced this issue Nov 20, 2023
…lter actions in visualizations (elastic#171284)

## Summary

Bug: elastic#171167

The [previous
implementation](elastic#170127) solved a
different bug using a new `shouldShowLegendAction` property. This
approach had a limitation on the Security Dashboards page since the
Security app has no control over the properties passed to the
visualization components when they are rendered through portable
Dashboards.

This PR fixes the problem by checking if any of the registered actions
is a "filter" action `type` in the visualizations. If customized filter
actions are found, the default filter actions hardcoded in the
visualizations code are not added, preventing duplication of filter
actions.

The specific action `type` used for the check is the
`FILTER_CELL_ACTION_TYPE = 'cellAction-filter'` constant exported by the
`@kbn/cell-actions` package.

This new approach uses a property stored in the registered actions
themselves, so we don't need to pass any extra property to the
visualization components, it works transparently. So the
`shouldShowLegendAction` property has also been cleaned.

## Demos

Timeline using `showTopN` visualization:


https://github.com/elastic/kibana/assets/17747913/491c08e8-0740-4c9e-9cb7-81267b9ba040


Alerts page using `Counts` table visualization and `showTopN`
visualization


https://github.com/elastic/kibana/assets/17747913/683eec6c-382e-4ae9-9400-c1022922e488


Portable Dashboard visualizations:


https://github.com/elastic/kibana/assets/17747913/50f09a65-488d-41f2-a5b8-3882d9c80678


Security actions are "compatible" only inside the Security app, in the
Lens app the default filter actions are displayed:

<img width="1682" alt="lens-actions-screenshot"
src="https://github.com/elastic/kibana/assets/17747913/1e7ce929-129d-45a9-ba71-8d28e3726454">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.12.0
Projects
None yet
Development

No branches or pull requests

2 participants