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

Extract common services from main plugin #6959

Open
1 of 6 tasks
Tracked by #22887
asteriscos opened this issue Sep 3, 2024 · 4 comments · May be fixed by #7000, #7026 or #7037
Open
1 of 6 tasks
Tracked by #22887

Extract common services from main plugin #6959

asteriscos opened this issue Sep 3, 2024 · 4 comments · May be fixed by #7000, #7026 or #7037
Assignees
Labels
level/task Task issue type/enhancement Enhancement issue

Comments

@asteriscos
Copy link
Member

asteriscos commented Sep 3, 2024

Description

Historically the main Wazuh dashboard plugin contains many common services needed for the different modules to work. We are in the process of segregating the different modules into decoupled plugins, so we need a common service provider for all of them. Therefore we need to evaluate which services are common to the modules and extract them from main plugin into a common service provider plugin.

Objective

Tasks

The steps that have to be completed in order to close the issue.

Functional requirements

  • We must user the mechanisms provided in the life cycle of OpenSearch plugins to expose them, so other plugins can make use of them.
@asteriscos asteriscos added type/enhancement Enhancement issue level/task Task issue labels Sep 3, 2024
@asteriscos asteriscos changed the title Extract common services from main plugin to a common service provider plugin Extract common services from main plugin Sep 3, 2024
@wazuhci wazuhci moved this to Backlog in Release 5.0.0 Sep 3, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 5.0.0 Sep 12, 2024
@Desvelao
Copy link
Member

Desvelao commented Sep 12, 2024

Analysis

Frontend side:

Common services:

Service File
App state plugins/main/public/react-services/app-state.js
GenericRequest plugins/main/public/react-services/generic-request.js
NavigationService plugins/main/public/react-services/navigation-service.tsx
PatternHandler plugins/main/public/react-services/pattern-handler.js
WzRequest plugins/main/public/react-services/wz-request.ts
WzUserPermissions plugins/main/public/react-services/wz-user-permissions.ts
SavedObject plugins/main/public/react-services/saved-objects.js
ApiCheck plugins/main/public/react-services/wz-api-check.js
AgentSupportModule plugins/main/public/react-services/wz-agents.ts
WzAuthentication plugins/main/public/react-services/wz-authentication.ts
exportCsv plugins/main/public/react-services/wz-csv.js

Others:

Service File
useSearchBar
WzSearchBar
useDataSource
WzDiscover
WzFlyoutDiscover
useForm
InputForm
TableWzAPI
DataSource

Port services

Frontend

Type Service Old services Description
service http WzRequest, GenericRequest, ApiCheck, WzAuthentication Client to run API requests to the backend side
service serverSecurity WzUserPermissions, WzButtonPermissions, WzElementPermissions Manage the server security
service state AppState Manage the shared state

@wazuhci wazuhci moved this from In progress to On hold in Release 5.0.0 Sep 16, 2024
@wazuhci wazuhci moved this from On hold to In progress in Release 5.0.0 Sep 18, 2024
@Desvelao
Copy link
Member

Frontend - http

The http provides a custom mechanim to do an API request to the backend side.

This defines a request interceptor that disables the requests when core.http returns a response with status code 401, avoiding a problem in the login flow (with SAML).

The request interceptor is used in the clients:

  • generic
  • server

Generic

This client provides a method to run the request that injects some properties related to an index pattern and selected server API host in the headers of the API request that could be used for some backend endpoints

Server

This client provides:

  • some methods to communicate with the Wazuh server API
  • manage authentication with Wazuh server API
  • store the login data

@Desvelao Desvelao linked a pull request Sep 19, 2024 that will close this issue
6 tasks
@Desvelao Desvelao linked a pull request Sep 27, 2024 that will close this issue
6 tasks
@Desvelao Desvelao linked a pull request Sep 27, 2024 that will close this issue
6 tasks
@Desvelao
Copy link
Member

Frontend - serverSecurity

The serverSecurity service manages the security related to the Wazuh server.

  • Permissions

Expose hooks, HOCs and UI elements related to the user permissions.

@Desvelao Desvelao linked a pull request Sep 30, 2024 that will close this issue
6 tasks
@Desvelao Desvelao linked a pull request Sep 30, 2024 that will close this issue
6 tasks
@Desvelao
Copy link
Member

Frontend - state

The state service manages the shared state of the Wazuh plugins and it is a HUB of state containers. Features:

  • Extensible
  • Register state containers
  • Ability to get, set, remove data and subscribe to changes of state containers

The state containers provides a mechanism to manage a specific state. For example, some data is stored in cookies, others could be managed in-memory, local storage, session storage.

Others plugins can register new state containers.

The service creates hooks and HOCs that are exposed through the plugin lifecycle.

@wazuhci wazuhci moved this from In progress to On hold in Release 5.0.0 Oct 10, 2024
@wazuhci wazuhci moved this from On hold to In progress in Release 5.0.0 Oct 18, 2024
@wazuhci wazuhci moved this from In progress to On hold in Release 5.0.0 Oct 18, 2024
@wazuhci wazuhci moved this from On hold to In progress in Release 5.0.0 Oct 21, 2024
@wazuhci wazuhci moved this from In progress to On hold in Release 5.0.0 Oct 31, 2024
@wazuhci wazuhci moved this from On hold to In progress in Release 5.0.0 Nov 27, 2024
@Desvelao Desvelao linked a pull request Nov 27, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/enhancement Enhancement issue
Projects
Status: In progress
2 participants