elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.77k stars 8.17k forks source link

Navigating to "Recently viewed" is not working for dashboards when the user comes from the Security solution #166686

Closed teresaalvarezsoler closed 12 months ago

teresaalvarezsoler commented 1 year ago

Kibana version: 8.9 but probably in older versions too

Browser: Chrome

Describe the bug: When users are located in any of the Security UIs and they click on a recently viewed dashboard from the left bar navigation menu, they get redirected to the dashboard list instead of the dashboard clicked.

This is not happening from other solution UIs (observbability or search) or with other SOs (lens, maps, etc.)

Steps to reproduce:

  1. Go to any Security solution UI
  2. Open left side navigation menu
  3. Click in a recently viewed dashboard
  4. You get redirected to the dashboard listing page

Expected behavior: Users should be redirected to the dashboard they clicked.

bug-recently-viewed2

Screenshots (if relevant):

elasticmachine commented 1 year ago

Pinging @elastic/kibana-presentation (Team:Presentation)

jsanz commented 1 year ago

I can confirm on a cloud 8.10.0 cluster. Nothing pops up on the browser dev console (on firefox 117.0.1 (64-bit))

Heenawter commented 1 year ago

This seems to be related to the Dashboard app's locator - the same thing happens when I add a links panel to the security dashboard. Rather than navigating to the specified dashboard in the Dashboard app, I get redirected to the listing page:

https://github.com/elastic/kibana/assets/8698078/aa7f02bd-c47e-4196-96bf-cbcbb470c3ed

I can most likely look into this as part of https://github.com/elastic/kibana/issues/164748

teresaalvarezsoler commented 1 year ago

Thanks @Heenawter !

Heenawter commented 1 year ago

After looking into this, it seems as though this may be an issue with the security app's router rather than dashboard's. Basically, when I was looking into this on my own, I found that the navigateToApp function in core was getting called with the expected path - i.e. app/dashboards#/view/<id>. However, on navigation, something was happening where, despite starting at the correct/expected URL, I would then get redirected to app/dashboards?, which ultimately redirected me to the dashboard listing page.

I called in @ThomThomson for reinforcements, and we found that at the point of navigation, the dashboard app's hash was already incorrect, which is not the case in any other solution (we tested observability, Discover, management, and a few others - the dashboard router's hash was correct in all cases and navigation worked as expected). This suggests that there is some sort of conflict happening between security's router and dashboard's, which is causing this weird behaviour. I've tried to show this in the following video:

https://github.com/elastic/kibana/assets/8698078/7c82856a-c950-41f4-ba44-7e3076eeb4f6

Note that both "Recent" and links panels are experiencing the exact same bug, so I've demonstrated it with the links panel in the above video but the same applies to navigating through recent.

elasticmachine commented 1 year ago

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

Heenawter commented 1 year ago

Assigning impact:high because of the impact on the links panel - since we plan to release the links panel in v8.11, and since Security allows users to edit/create their own dashboards to show up in their portable dashboard implementation, it will be possible for users to end up with links panels in their Security dashboards which won't work at all - these links will always redirect to the listing page.

elasticmachine commented 1 year ago

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

angorayc commented 1 year ago

It's the same bug that causes this issue and https://github.com/elastic/kibana/issues/166774

Basically it's x-pack/plugins/security_solution/public/flyout/shared/hooks/url/use_sync_flyout_state_with_url.tsx line 25 syncStateToUrl packages/kbn-url-state/use_sync_to_url.ts line 61, the new url does not include window.location.hash

I'll do a quick fix in https://github.com/elastic/kibana/pull/159486 to put the hash back. const newUrl = ${window.location.pathname}${window.location.hash}?${newSearch};

I'll also ask the team about better way of implementing syncStateToUrl

ThomThomson commented 1 year ago

@angorayc thank you for looking into this and finding the root cause!

angorayc commented 1 year ago

@angorayc thank you for looking into this and finding the root cause!

@dej611 Found it. Thank you @dej611 , Security Solution team appreciate you!

MadameSheema commented 12 months ago

Issue fixed on 8.11-BC1.