wazuh / wazuh-dashboard-plugins

Plugins for Wazuh Dashboard
https://wazuh.com/
GNU General Public License v2.0
427 stars 176 forks source link

Unpinning the agent from the menu is not removing the url param #3564

Open frankeros opened 3 years ago

frankeros commented 3 years ago
Wazuh Elastic
4.x 7.x

Description Unpinning the agent from the menu tool is not removing the agent param from the URL, this is causing that the agent has been pinned again after refreshing the page.

Steps to reproduce

  1. Go to 'Agents'
  2. Click on one agent
  3. Go to 'Modules / Office365'
  4. Click on unpin button from the menu
  5. Refresh the page
  6. See the agent pinned again.

Screenshots

https://user-images.githubusercontent.com/26828184/129067680-c79b1d34-67db-4bc2-b0bb-19443448c3ac.mp4

Desvelao commented 3 years ago

Research

I was researching about the problem and:

I attach a patch in that I am working to get a solution for this issue. It contains a workaround attaching a method to the $rootScope variable to be accessible in the WzMenu component because it doesn't receive the .setAgent method defined in https://github.com/wazuh/wazuh-kibana-app/blob/feature/Office365/public/controllers/overview/overview.js

❗ The method removeAgentsFilter in the https://github.com/wazuh/wazuh-kibana-app/blob/feature/Office365/public/components/wz-agent-selector/wz-agent-selector.js#L91-L107 defined the action to do when unpinning the agent from the agent selector and there is an agent pinned. This button could need some logic to remove the agentId query param too. We should check it image

Patch: remove_agentid_query_param_url_unppining_agent.patch.txt

I took a child branch from feature/office365. You should be able to apply the patch to a branch like that.

Apply the patch with:

git apply path/to/remove_agentid_query_param_url_unppining_agent.patch.txt

Annotations:

CPAlejandro commented 3 years ago

I have found a bug checking this issue, when you pin an agent in Security Events or in any other part of Wazuh, the dashboards appears without any data even though there are data.

image (18)

Current state of the issue: I am trying to develop a better form to use of the method setAgent and trying to figure out what is happening with the blank visualizations, because there aren't any errors in terminal

CPAlejandro commented 3 years ago

Today's feedback