From 719963c8cb3fbbadf6f0151d8215a4e869e2e4ae Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Mon, 16 Dec 2024 09:03:04 -0300 Subject: [PATCH 01/20] fix(get-updates): improve error handling by renaming variable for clarity and adjusting error response structure --- .../server/services/updates/get-updates.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index 2b8d50df05..25fec054f7 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -81,16 +81,16 @@ export const getUpdates = async ( api_id: api.id, status: getStatus(), }; - } catch (e: any) { - const error = { - title: e.response?.data?.title, - detail: e.response?.data?.detail ?? e.message, + } catch (error: any) { + const errorResponse = { + title: error.response?.data?.title, + detail: error.response?.data?.detail ?? error.message, }; return { api_id: api.id, status: API_UPDATES_STATUS.ERROR, - error, + error: errorResponse, }; } }), @@ -109,8 +109,8 @@ export const getUpdates = async ( error instanceof Error ? error.message : typeof error === 'string' - ? error - : 'Error trying to get available updates'; + ? error + : 'Error trying to get available updates'; const { logger } = getWazuhCheckUpdatesServices(); From 85ef0866d53aee847c32768b9e7ac3568bc17b47 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Mon, 16 Dec 2024 14:23:07 -0300 Subject: [PATCH 02/20] fix(plugin-services): update WazuhCheckUpdatesServices type to include Logger for improved service management --- plugins/wazuh-check-updates/server/plugin-services.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/wazuh-check-updates/server/plugin-services.ts b/plugins/wazuh-check-updates/server/plugin-services.ts index 016c19a7a6..98686bd879 100644 --- a/plugins/wazuh-check-updates/server/plugin-services.ts +++ b/plugins/wazuh-check-updates/server/plugin-services.ts @@ -1,6 +1,7 @@ import { CoreStart, ISavedObjectsRepository, + Logger, } from 'opensearch-dashboards/server'; import { createGetterSetter } from '../../../src/plugins/opensearch_dashboards_utils/common'; import { WazuhCorePluginStart } from '../../wazuh-core/server'; @@ -11,4 +12,4 @@ export const [getCore, setCore] = createGetterSetter('Core'); export const [getWazuhCore, setWazuhCore] = createGetterSetter('WazuhCore'); export const [getWazuhCheckUpdatesServices, setWazuhCheckUpdatesServices] = - createGetterSetter('WazuhCheckUpdatesServices'); + createGetterSetter<{ logger: Logger }>('WazuhCheckUpdatesServices'); From 0a3faff128c872ddb730c54395ebafb46f2754c9 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Mon, 16 Dec 2024 14:23:36 -0300 Subject: [PATCH 03/20] fix(get-updates): use IAPIHost type for host management to enhance type safety and code clarity in update services --- .../wazuh-check-updates/server/services/updates/get-updates.ts | 3 ++- plugins/wazuh-core/server/services/manage-hosts.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index 25fec054f7..5472a04731 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -9,6 +9,7 @@ import { getWazuhCheckUpdatesServices, getWazuhCore, } from '../../plugin-services'; +import { IAPIHost } from "../../../../wazuh-core/server/services"; export const getUpdates = async ( queryApi = false, @@ -25,7 +26,7 @@ export const getUpdates = async ( const { manageHosts, api: wazuhApiClient } = getWazuhCore(); - const hosts: { id: string }[] = await manageHosts.get(); + const hosts = await manageHosts.get() as IAPIHost[]; const apisAvailableUpdates = await Promise.all( hosts?.map(async api => { diff --git a/plugins/wazuh-core/server/services/manage-hosts.ts b/plugins/wazuh-core/server/services/manage-hosts.ts index 84165d95e2..317096abd4 100644 --- a/plugins/wazuh-core/server/services/manage-hosts.ts +++ b/plugins/wazuh-core/server/services/manage-hosts.ts @@ -15,7 +15,7 @@ import { ServerAPIClient } from './server-api-client'; import { API_USER_STATUS_RUN_AS } from '../../common/api-user-status-run-as'; import { HTTP_STATUS_CODES } from '../../common/constants'; -interface IAPIHost { +export interface IAPIHost { id: string; url: string; username: string; From e41576a6bfc0ab3cdce9e3f9961d8f1aa8704ace Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Mon, 16 Dec 2024 14:23:56 -0300 Subject: [PATCH 04/20] fix(get-updates): add logger for improved debugging of API status errors in update retrieval process --- .../server/services/updates/get-updates.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index 5472a04731..973fe24d0d 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -15,6 +15,8 @@ export const getUpdates = async ( queryApi = false, forceQuery = false, ): Promise => { + const { logger } = getWazuhCheckUpdatesServices(); + try { if (!queryApi) { const availableUpdates = (await getSavedObject( @@ -83,6 +85,7 @@ export const getUpdates = async ( status: getStatus(), }; } catch (error: any) { + logger.debug('[ERROR]: Cannot get the API status'); const errorResponse = { title: error.response?.data?.title, detail: error.response?.data?.detail ?? error.message, @@ -113,8 +116,6 @@ export const getUpdates = async ( ? error : 'Error trying to get available updates'; - const { logger } = getWazuhCheckUpdatesServices(); - logger.error(message); return Promise.reject(error); } From 33befd25a1cd7815ee8455c963b680c2a54df36a Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Mon, 16 Dec 2024 14:53:06 -0300 Subject: [PATCH 05/20] fix(get-updates): refactor update retrieval to include version handling and optimize status checking logic for better clarity --- .../server/services/updates/get-updates.ts | 75 +++++++++++++------ 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index 973fe24d0d..44467e2aa1 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -9,7 +9,7 @@ import { getWazuhCheckUpdatesServices, getWazuhCore, } from '../../plugin-services'; -import { IAPIHost } from "../../../../wazuh-core/server/services"; +import { IAPIHost } from '../../../../wazuh-core/server/services'; export const getUpdates = async ( queryApi = false, @@ -26,9 +26,30 @@ export const getUpdates = async ( return availableUpdates; } + const getStatus = ({ + update_check, + last_available_major, + last_available_minor, + last_available_patch, + }: ResponseApiAvailableUpdates) => { + if (update_check === false) { + return API_UPDATES_STATUS.DISABLED; + } + + if ( + last_available_major?.tag || + last_available_minor?.tag || + last_available_patch?.tag + ) { + return API_UPDATES_STATUS.AVAILABLE_UPDATES; + } + + return API_UPDATES_STATUS.UP_TO_DATE; + }; + const { manageHosts, api: wazuhApiClient } = getWazuhCore(); - const hosts = await manageHosts.get() as IAPIHost[]; + const hosts = (await manageHosts.get()) as IAPIHost[]; const apisAvailableUpdates = await Promise.all( hosts?.map(async api => { @@ -39,6 +60,25 @@ export const getUpdates = async ( apiHostID: api.id, forceRefresh: true, }; + let currentVersion: string | undefined = undefined; + let availableUpdates: ResponseApiAvailableUpdates = {}; + + try { + const { + data: { + data: { api_version }, + }, + } = await wazuhApiClient.client.asInternalUser.request( + 'GET', + '/', + {}, + options, + ); + currentVersion = `v${api_version}`; + } catch { + logger.debug('[ERROR]: Cannot get the API version'); + } + try { const response = await wazuhApiClient.client.asInternalUser.request( method, @@ -47,42 +87,30 @@ export const getUpdates = async ( options, ); - const update = response.data.data as ResponseApiAvailableUpdates; + availableUpdates = response.data.data as ResponseApiAvailableUpdates; const { - current_version, update_check, last_available_major, last_available_minor, last_available_patch, last_check_date, - } = update; - - const getStatus = () => { - if (update_check === false) { - return API_UPDATES_STATUS.DISABLED; - } - - if ( - last_available_major?.tag || - last_available_minor?.tag || - last_available_patch?.tag - ) { - return API_UPDATES_STATUS.AVAILABLE_UPDATES; - } - - return API_UPDATES_STATUS.UP_TO_DATE; - }; + } = availableUpdates; + + // If for some reason, the previous request fails + if (currentVersion === undefined) { + currentVersion = availableUpdates.current_version; + } return { - current_version, + current_version: currentVersion, update_check, last_available_major, last_available_minor, last_available_patch, last_check_date: last_check_date || undefined, api_id: api.id, - status: getStatus(), + status: getStatus(availableUpdates), }; } catch (error: any) { logger.debug('[ERROR]: Cannot get the API status'); @@ -94,6 +122,7 @@ export const getUpdates = async ( return { api_id: api.id, status: API_UPDATES_STATUS.ERROR, + current_version: currentVersion, error: errorResponse, }; } From b9740f187785827984a05bb6477fd3085200ea2c Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 11:16:52 -0300 Subject: [PATCH 06/20] fix(get-updates): update test cases to handle version formatting and improve mocking for Wazuh core interactions --- .../services/updates/get-updates.test.ts | 104 ++++++++++-------- 1 file changed, 57 insertions(+), 47 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 3277b9dd63..2497e37a50 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -17,6 +17,14 @@ jest.mock('../saved-object/set-saved-object'); const mockedGetWazuhCore = getWazuhCore as jest.Mock; const mockedGetWazuhCheckUpdatesServices = getWazuhCheckUpdatesServices as jest.Mock; +mockedGetWazuhCheckUpdatesServices.mockImplementation(() => ({ + logger: { + debug: jest.fn(), + info: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + }, +})); jest.mock('../../plugin-services'); describe('getUpdates function', () => { @@ -30,7 +38,7 @@ describe('getUpdates function', () => { apis_available_updates: [ { api_id: 'api id', - current_version: '4.3.1', + current_version: 'v4.3.1', status: API_UPDATES_STATUS.UP_TO_DATE, last_available_patch: { description: @@ -54,15 +62,6 @@ describe('getUpdates function', () => { }, })); - mockedGetWazuhCheckUpdatesServices.mockImplementation(() => ({ - logger: { - debug: jest.fn(), - info: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }, - })); - const updates = await getUpdates(); expect(getSavedObject).toHaveBeenCalledTimes(1); @@ -73,7 +72,7 @@ describe('getUpdates function', () => { apis_available_updates: [ { api_id: 'api id', - current_version: '4.3.1', + current_version: 'v4.3.1', status: API_UPDATES_STATUS.UP_TO_DATE, last_available_patch: { description: @@ -94,45 +93,52 @@ describe('getUpdates function', () => { test('should return available updates from api', async () => { mockedSetSavedObject.mockImplementation(() => ({})); - mockedGetWazuhCore.mockImplementation(() => ({ - api: { - client: { - asInternalUser: { - request: jest.fn().mockImplementation(() => ({ - data: { - data: { - uuid: '7f828fd6-ef68-4656-b363-247b5861b84c', - current_version: '4.3.1', - last_available_patch: { - description: - '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', - published_date: '2022-05-18T10:12:43Z', - semver: { - major: 4, - minor: 3, - patch: 8, + mockedGetWazuhCore.mockImplementationOnce(() => { + return { + api: { + client: { + asInternalUser: { + request: jest + .fn() + .mockImplementationOnce(() => ({ + data: { + data: { + api_version: '4.3.1', }, - tag: 'v4.3.8', - title: 'Wazuh v4.3.8', }, - }, - }, - })), + })) + .mockImplementationOnce(() => ({ + data: { + data: { + uuid: '7f828fd6-ef68-4656-b363-247b5861b84c', + current_version: 'v4.3.1', + update_check: undefined, + last_available_major: undefined, + last_available_minor: undefined, + last_available_patch: { + description: + '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', + published_date: '2022-05-18T10:12:43Z', + semver: { + major: 4, + minor: 3, + patch: 8, + }, + tag: 'v4.3.8', + title: 'Wazuh v4.3.8', + }, + last_check_date: undefined, + }, + }, + })), + }, }, }, - }, - manageHosts: { - get: jest.fn(() => [{ id: 'api id' }]), - }, - })); - mockedGetWazuhCheckUpdatesServices.mockImplementation(() => ({ - logger: { - debug: jest.fn(), - info: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }, - })); + manageHosts: { + get: jest.fn(() => [{ id: 'api id' }]), + }, + }; + }); const updates = await getUpdates(true); @@ -141,8 +147,11 @@ describe('getUpdates function', () => { apis_available_updates: [ { api_id: 'api id', - current_version: '4.3.1', + current_version: 'v4.3.1', status: API_UPDATES_STATUS.AVAILABLE_UPDATES, + update_check: undefined, + last_available_major: undefined, + last_available_minor: undefined, last_available_patch: { description: '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', @@ -155,6 +164,7 @@ describe('getUpdates function', () => { tag: 'v4.3.8', title: 'Wazuh v4.3.8', }, + last_check_date: undefined, }, ], }); From c00c7fb63b827ee73d4d3ae07abc0f8aab7695c5 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 11:32:04 -0300 Subject: [PATCH 07/20] fix(get-updates): enhance tests by mocking last_available_patch for clearer version handling and improved stability --- .../services/updates/get-updates.test.ts | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 2497e37a50..54eb0d7340 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -12,6 +12,7 @@ const mockedGetSavedObject = getSavedObject as jest.Mock; jest.mock('../saved-object/get-saved-object'); const mockedSetSavedObject = setSavedObject as jest.Mock; +mockedSetSavedObject.mockImplementation(() => ({})); jest.mock('../saved-object/set-saved-object'); const mockedGetWazuhCore = getWazuhCore as jest.Mock; @@ -92,7 +93,18 @@ describe('getUpdates function', () => { }); test('should return available updates from api', async () => { - mockedSetSavedObject.mockImplementation(() => ({})); + const last_available_patch = { + description: + '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', + published_date: '2022-05-18T10:12:43Z', + semver: { + major: 4, + minor: 3, + patch: 8, + }, + tag: 'v4.3.8', + title: 'Wazuh v4.3.8', + }; mockedGetWazuhCore.mockImplementationOnce(() => { return { api: { @@ -115,18 +127,7 @@ describe('getUpdates function', () => { update_check: undefined, last_available_major: undefined, last_available_minor: undefined, - last_available_patch: { - description: - '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', - published_date: '2022-05-18T10:12:43Z', - semver: { - major: 4, - minor: 3, - patch: 8, - }, - tag: 'v4.3.8', - title: 'Wazuh v4.3.8', - }, + last_available_patch, last_check_date: undefined, }, }, @@ -152,18 +153,7 @@ describe('getUpdates function', () => { update_check: undefined, last_available_major: undefined, last_available_minor: undefined, - last_available_patch: { - description: - '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', - published_date: '2022-05-18T10:12:43Z', - semver: { - major: 4, - minor: 3, - patch: 8, - }, - tag: 'v4.3.8', - title: 'Wazuh v4.3.8', - }, + last_available_patch, last_check_date: undefined, }, ], From 0b425859558670d1c9bcfcee00ef9cfd794da536 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 11:40:21 -0300 Subject: [PATCH 08/20] fix(get-updates): reorganize imports in test file for better readability and consistency with common constants and types --- .../server/services/updates/get-updates.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 54eb0d7340..1664ef69b0 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -1,10 +1,11 @@ -import { getSavedObject } from '../saved-object/get-saved-object'; -import { setSavedObject } from '../saved-object/set-saved-object'; +import { SAVED_OBJECT_UPDATES } from '../../../common/constants'; +import { API_UPDATES_STATUS } from '../../../common/types'; import { getWazuhCheckUpdatesServices, getWazuhCore, } from '../../plugin-services'; -import { API_UPDATES_STATUS } from '../../../common/types'; +import { getSavedObject } from '../saved-object/get-saved-object'; +import { setSavedObject } from '../saved-object/set-saved-object'; import { getUpdates } from './get-updates'; import { SAVED_OBJECT_UPDATES } from '../../../common/constants'; From aa4c03fa17c70599b621048c95289f3fe5bff985 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 11:41:09 -0300 Subject: [PATCH 09/20] fix(get-updates): refactor test setup to improve mocking of saved objects and requests for more accurate updates handling --- .../services/updates/get-updates.test.ts | 142 ++++++++---------- 1 file changed, 62 insertions(+), 80 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 1664ef69b0..6c3e1210dc 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -7,16 +7,36 @@ import { import { getSavedObject } from '../saved-object/get-saved-object'; import { setSavedObject } from '../saved-object/set-saved-object'; import { getUpdates } from './get-updates'; -import { SAVED_OBJECT_UPDATES } from '../../../common/constants'; -const mockedGetSavedObject = getSavedObject as jest.Mock; +const mockGetSavedObject = getSavedObject as jest.Mock; jest.mock('../saved-object/get-saved-object'); -const mockedSetSavedObject = setSavedObject as jest.Mock; -mockedSetSavedObject.mockImplementation(() => ({})); +const mockSetSavedObject = setSavedObject as jest.Mock; +mockSetSavedObject.mockImplementation(() => ({})); jest.mock('../saved-object/set-saved-object'); -const mockedGetWazuhCore = getWazuhCore as jest.Mock; +const mockGetWazuhCore = getWazuhCore as jest.Mock; +const mockRequest = jest.fn(); +const mockManageHosts = { + get: jest.fn(() => [{ id: 'api id' }]), +}; +const mockGetHostsEntries = jest.fn(() => []); +mockGetWazuhCore.mockImplementationOnce(() => { + return { + api: { + client: { + asInternalUser: { + request: mockRequest, + }, + }, + }, + manageHosts: mockManageHosts, + serverAPIHostEntries: { + getHostsEntries: mockGetHostsEntries, + }, + }; +}); + const mockedGetWazuhCheckUpdatesServices = getWazuhCheckUpdatesServices as jest.Mock; mockedGetWazuhCheckUpdatesServices.mockImplementation(() => ({ @@ -35,62 +55,38 @@ describe('getUpdates function', () => { }); test('should return available updates from saved object', async () => { - mockedGetSavedObject.mockImplementation(() => ({ - last_check_date: '2023-09-30T14:00:00.000Z', + const last_available_patch = { + description: + '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', + published_date: '2022-05-18T10:12:43Z', + semver: { + major: 4, + minor: 3, + patch: 8, + }, + tag: 'v4.3.8', + title: 'Wazuh v4.3.8', + }; + const last_check_date = '2023-09-30T14:00:00.000Z'; + const savedObject = { + last_check_date, apis_available_updates: [ { api_id: 'api id', current_version: 'v4.3.1', status: API_UPDATES_STATUS.UP_TO_DATE, - last_available_patch: { - description: - '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', - published_date: '2022-05-18T10:12:43Z', - semver: { - major: 4, - minor: 3, - patch: 8, - }, - tag: 'v4.3.8', - title: 'Wazuh v4.3.8', - }, + last_available_patch, }, ], - })); - - mockedGetWazuhCore.mockImplementation(() => ({ - serverAPIHostEntries: { - getHostsEntries: jest.fn(() => []), - }, - })); + }; + mockGetSavedObject.mockImplementation(() => savedObject); const updates = await getUpdates(); expect(getSavedObject).toHaveBeenCalledTimes(1); expect(getSavedObject).toHaveBeenCalledWith(SAVED_OBJECT_UPDATES); - expect(updates).toEqual({ - last_check_date: '2023-09-30T14:00:00.000Z', - apis_available_updates: [ - { - api_id: 'api id', - current_version: 'v4.3.1', - status: API_UPDATES_STATUS.UP_TO_DATE, - last_available_patch: { - description: - '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', - published_date: '2022-05-18T10:12:43Z', - semver: { - major: 4, - minor: 3, - patch: 8, - }, - tag: 'v4.3.8', - title: 'Wazuh v4.3.8', - }, - }, - ], - }); + expect(updates).toEqual(savedObject); }); test('should return available updates from api', async () => { @@ -106,41 +102,27 @@ describe('getUpdates function', () => { tag: 'v4.3.8', title: 'Wazuh v4.3.8', }; - mockedGetWazuhCore.mockImplementationOnce(() => { - return { - api: { - client: { - asInternalUser: { - request: jest - .fn() - .mockImplementationOnce(() => ({ - data: { - data: { - api_version: '4.3.1', - }, - }, - })) - .mockImplementationOnce(() => ({ - data: { - data: { - uuid: '7f828fd6-ef68-4656-b363-247b5861b84c', - current_version: 'v4.3.1', - update_check: undefined, - last_available_major: undefined, - last_available_minor: undefined, - last_available_patch, - last_check_date: undefined, - }, - }, - })), - }, + mockRequest + .mockImplementationOnce(() => ({ + data: { + data: { + api_version: '4.3.1', }, }, - manageHosts: { - get: jest.fn(() => [{ id: 'api id' }]), + })) + .mockImplementationOnce(() => ({ + data: { + data: { + uuid: '7f828fd6-ef68-4656-b363-247b5861b84c', + current_version: 'v4.3.1', + update_check: undefined, + last_available_major: undefined, + last_available_minor: undefined, + last_available_patch, + last_check_date: undefined, + }, }, - }; - }); + })); const updates = await getUpdates(true); From de85db7d7ac0c6dd7b0621128fd11d4981d4cca6 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 11:49:06 -0300 Subject: [PATCH 10/20] fix(get-updates): standardize api_id and version formatting in tests for consistent updates handling across all scenarios --- .../services/updates/get-updates.test.ts | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 6c3e1210dc..d96e31e6d3 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -8,6 +8,8 @@ import { getSavedObject } from '../saved-object/get-saved-object'; import { setSavedObject } from '../saved-object/set-saved-object'; import { getUpdates } from './get-updates'; +const API_ID = 'api id'; + const mockGetSavedObject = getSavedObject as jest.Mock; jest.mock('../saved-object/get-saved-object'); @@ -18,7 +20,7 @@ jest.mock('../saved-object/set-saved-object'); const mockGetWazuhCore = getWazuhCore as jest.Mock; const mockRequest = jest.fn(); const mockManageHosts = { - get: jest.fn(() => [{ id: 'api id' }]), + get: jest.fn(() => [{ id: API_ID }]), }; const mockGetHostsEntries = jest.fn(() => []); mockGetWazuhCore.mockImplementationOnce(() => { @@ -55,25 +57,27 @@ describe('getUpdates function', () => { }); test('should return available updates from saved object', async () => { + const semver = { + major: 4, + minor: 3, + patch: 1, + }; + const version = `${semver.major}.${semver.minor}.${semver.patch}`; const last_available_patch = { description: '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', published_date: '2022-05-18T10:12:43Z', - semver: { - major: 4, - minor: 3, - patch: 8, - }, - tag: 'v4.3.8', - title: 'Wazuh v4.3.8', + semver, + tag: `v${version}`, + title: `Wazuh v${version}`, }; const last_check_date = '2023-09-30T14:00:00.000Z'; const savedObject = { last_check_date, apis_available_updates: [ { - api_id: 'api id', - current_version: 'v4.3.1', + api_id: API_ID, + current_version: `v${version}`, status: API_UPDATES_STATUS.UP_TO_DATE, last_available_patch, }, @@ -90,23 +94,25 @@ describe('getUpdates function', () => { }); test('should return available updates from api', async () => { + const semver = { + major: 4, + minor: 3, + patch: 1, + }; + const version = `${semver.major}.${semver.minor}.${semver.patch}`; const last_available_patch = { description: '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', published_date: '2022-05-18T10:12:43Z', - semver: { - major: 4, - minor: 3, - patch: 8, - }, - tag: 'v4.3.8', - title: 'Wazuh v4.3.8', + semver, + tag: `v${version}`, + title: `Wazuh v${version}`, }; mockRequest .mockImplementationOnce(() => ({ data: { data: { - api_version: '4.3.1', + api_version: version, }, }, })) @@ -114,7 +120,7 @@ describe('getUpdates function', () => { data: { data: { uuid: '7f828fd6-ef68-4656-b363-247b5861b84c', - current_version: 'v4.3.1', + current_version: `v${version}`, update_check: undefined, last_available_major: undefined, last_available_minor: undefined, @@ -130,8 +136,8 @@ describe('getUpdates function', () => { last_check_date: expect.any(Date), apis_available_updates: [ { - api_id: 'api id', - current_version: 'v4.3.1', + api_id: API_ID, + current_version: `v${version}`, status: API_UPDATES_STATUS.AVAILABLE_UPDATES, update_check: undefined, last_available_major: undefined, From 66ff7a16e87607fa7fec70610db7389fd4689dda Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:02:23 -0300 Subject: [PATCH 11/20] fix(get-updates): improve error handling and add tests for undefined api_version scenarios in update fetching logic --- .../services/updates/get-updates.test.ts | 109 +++++++++++++++++- .../server/services/updates/get-updates.ts | 8 +- 2 files changed, 113 insertions(+), 4 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index d96e31e6d3..be8022bb5f 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -23,7 +23,7 @@ const mockManageHosts = { get: jest.fn(() => [{ id: API_ID }]), }; const mockGetHostsEntries = jest.fn(() => []); -mockGetWazuhCore.mockImplementationOnce(() => { +mockGetWazuhCore.mockImplementation(() => { return { api: { client: { @@ -148,4 +148,111 @@ describe('getUpdates function', () => { ], }); }); + + it('should return available updates from api when in the first request, api_version is undefined', async () => { + const semver = { + major: 4, + minor: 3, + patch: 1, + }; + const version = `${semver.major}.${semver.minor}.${semver.patch}`; + const last_available_patch = { + description: + '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', + published_date: '2022-05-18T10:12:43Z', + semver, + tag: `v${version}`, + title: `Wazuh v${version}`, + }; + mockRequest + .mockImplementationOnce(() => ({ + data: { + data: { + api_version: undefined, + }, + }, + })) + .mockImplementationOnce(() => ({ + data: { + data: { + uuid: '7f828fd6-ef68-4656-b363-247b5861b84c', + current_version: `v${version}`, + update_check: undefined, + last_available_major: undefined, + last_available_minor: undefined, + last_available_patch, + last_check_date: undefined, + }, + }, + })); + + const updates = await getUpdates(true); + + expect(updates).toEqual({ + last_check_date: expect.any(Date), + apis_available_updates: [ + { + api_id: API_ID, + current_version: `v${version}`, + status: API_UPDATES_STATUS.AVAILABLE_UPDATES, + update_check: undefined, + last_available_major: undefined, + last_available_minor: undefined, + last_available_patch, + last_check_date: undefined, + }, + ], + }); + }); + it('should return available updates from api when the first request fail', async () => { + const semver = { + major: 4, + minor: 3, + patch: 1, + }; + const version = `${semver.major}.${semver.minor}.${semver.patch}`; + const last_available_patch = { + description: + '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', + published_date: '2022-05-18T10:12:43Z', + semver, + tag: `v${version}`, + title: `Wazuh v${version}`, + }; + mockRequest + .mockImplementationOnce(() => { + throw new Error('Error'); + }) + .mockImplementationOnce(() => ({ + data: { + data: { + uuid: '7f828fd6-ef68-4656-b363-247b5861b84c', + current_version: `v${version}`, + update_check: undefined, + last_available_major: undefined, + last_available_minor: undefined, + last_available_patch, + last_check_date: undefined, + }, + }, + })); + + const updates = await getUpdates(true); + + expect(updates).toEqual({ + last_check_date: expect.any(Date), + apis_available_updates: [ + { + api_id: API_ID, + current_version: `v${version}`, + status: API_UPDATES_STATUS.AVAILABLE_UPDATES, + update_check: undefined, + last_available_major: undefined, + last_available_minor: undefined, + last_available_patch, + last_check_date: undefined, + }, + ], + }); + }); }); diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index 44467e2aa1..5caaa054f3 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -74,7 +74,9 @@ export const getUpdates = async ( {}, options, ); - currentVersion = `v${api_version}`; + if (api_version !== undefined) { + currentVersion = `v${api_version}`; + } } catch { logger.debug('[ERROR]: Cannot get the API version'); } @@ -142,8 +144,8 @@ export const getUpdates = async ( error instanceof Error ? error.message : typeof error === 'string' - ? error - : 'Error trying to get available updates'; + ? error + : 'Error trying to get available updates'; logger.error(message); return Promise.reject(error); From 1654ad9692f8a20af95ecad6e1f27ea9ac42908a Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:06:29 -0300 Subject: [PATCH 12/20] fix(get-updates): enhance error response handling and add test for dual request failure in update fetching logic --- .../services/updates/get-updates.test.ts | 40 +++++++++++++++++++ .../server/services/updates/get-updates.ts | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index be8022bb5f..795032cfa3 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -255,4 +255,44 @@ describe('getUpdates function', () => { ], }); }); + it('should return error from api when both requests fail', async () => { + const semver = { + major: 4, + minor: 3, + patch: 1, + }; + const version = `${semver.major}.${semver.minor}.${semver.patch}`; + const last_available_patch = { + description: + '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', + published_date: '2022-05-18T10:12:43Z', + semver, + tag: `v${version}`, + title: `Wazuh v${version}`, + }; + mockRequest + .mockImplementationOnce(() => { + throw new Error('Error'); + }) + .mockImplementationOnce(() => { + throw new Error('Error'); + }); + + const updates = await getUpdates(true); + + expect(updates).toEqual({ + last_check_date: expect.any(Date), + apis_available_updates: [ + { + api_id: API_ID, + current_version: undefined, + status: API_UPDATES_STATUS.ERROR, + error: { + detail: 'Error', + title: 'Error', + }, + }, + ], + }); + }); }); diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index 5caaa054f3..b87da612bc 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -117,7 +117,7 @@ export const getUpdates = async ( } catch (error: any) { logger.debug('[ERROR]: Cannot get the API status'); const errorResponse = { - title: error.response?.data?.title, + title: error.response?.data?.title ?? error.message, detail: error.response?.data?.detail ?? error.message, }; From 2e226f8b3ee555c78fa9be57c4bab52c209a61ba Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:06:39 -0300 Subject: [PATCH 13/20] fix(get-updates): remove unnecessary mock data from tests for clearer error handling in dual request failure scenarios --- .../server/services/updates/get-updates.test.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 795032cfa3..ff7e4a0a78 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -256,20 +256,6 @@ describe('getUpdates function', () => { }); }); it('should return error from api when both requests fail', async () => { - const semver = { - major: 4, - minor: 3, - patch: 1, - }; - const version = `${semver.major}.${semver.minor}.${semver.patch}`; - const last_available_patch = { - description: - '## Manager\r\n\r\n### Fixed\r\n\r\n- Fixed a crash when overwrite rules are triggered...', - published_date: '2022-05-18T10:12:43Z', - semver, - tag: `v${version}`, - title: `Wazuh v${version}`, - }; mockRequest .mockImplementationOnce(() => { throw new Error('Error'); From de897066bc48589fe1a12e01e146fa760b3aa50f Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:09:44 -0300 Subject: [PATCH 14/20] fix(get-updates): add test for handling API errors on secondary request in update retrieval logic --- .../services/updates/get-updates.test.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index ff7e4a0a78..6f1c8dbc47 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -255,6 +255,42 @@ describe('getUpdates function', () => { ], }); }); + it('should return available updates from api when the second request fail', async () => { + const semver = { + major: 4, + minor: 3, + patch: 1, + }; + const version = `${semver.major}.${semver.minor}.${semver.patch}`; + mockRequest + .mockImplementationOnce(() => ({ + data: { + data: { + api_version: version, + }, + }, + })) + .mockImplementationOnce(() => { + throw new Error('Error'); + }); + + const updates = await getUpdates(true); + + expect(updates).toEqual({ + last_check_date: expect.any(Date), + apis_available_updates: [ + { + api_id: API_ID, + current_version: `v${version}`, + status: API_UPDATES_STATUS.ERROR, + error: { + detail: 'Error', + title: 'Error', + }, + }, + ], + }); + }); it('should return error from api when both requests fail', async () => { mockRequest .mockImplementationOnce(() => { From d830303505c5f8418a17f7becafc84d4405ec885 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:11:05 -0300 Subject: [PATCH 15/20] fix(get-updates): add test for retrieving updates when initial API version is undefined and secondary request fails --- .../services/updates/get-updates.test.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 6f1c8dbc47..a8ce2a0481 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -204,6 +204,42 @@ describe('getUpdates function', () => { ], }); }); + it('should return available updates from api when in the first request, api_version is undefined and the second request fail', async () => { + const semver = { + major: 4, + minor: 3, + patch: 1, + }; + const version = `${semver.major}.${semver.minor}.${semver.patch}`; + mockRequest + .mockImplementationOnce(() => ({ + data: { + data: { + api_version: undefined, + }, + }, + })) + .mockImplementationOnce(() => { + throw new Error('Error'); + }); + + const updates = await getUpdates(true); + + expect(updates).toEqual({ + last_check_date: expect.any(Date), + apis_available_updates: [ + { + api_id: API_ID, + current_version: undefined, + status: API_UPDATES_STATUS.ERROR, + error: { + detail: 'Error', + title: 'Error', + }, + }, + ], + }); + }); it('should return available updates from api when the first request fail', async () => { const semver = { major: 4, From baaa0e5daf0d47c109de9e6c7e9d70b663853503 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:11:34 -0300 Subject: [PATCH 16/20] fix(get-updates): refactor test cases to use 'it' for better consistency in update retrieval tests --- .../server/services/updates/get-updates.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index a8ce2a0481..674a121c32 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -56,7 +56,7 @@ describe('getUpdates function', () => { jest.clearAllMocks(); }); - test('should return available updates from saved object', async () => { + it('should return available updates from saved object', async () => { const semver = { major: 4, minor: 3, @@ -93,7 +93,7 @@ describe('getUpdates function', () => { expect(updates).toEqual(savedObject); }); - test('should return available updates from api', async () => { + it('should return available updates from api', async () => { const semver = { major: 4, minor: 3, From 6b30220760b8a46c766d968732aae929622579da Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:13:49 -0300 Subject: [PATCH 17/20] fix(get-updates): simplify test descriptions to improve readability in update retrieval tests --- .../server/services/updates/get-updates.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index 674a121c32..ecdc932c86 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -149,7 +149,7 @@ describe('getUpdates function', () => { }); }); - it('should return available updates from api when in the first request, api_version is undefined', async () => { + it('should return updates when api version undefined on first request', async () => { const semver = { major: 4, minor: 3, @@ -204,7 +204,7 @@ describe('getUpdates function', () => { ], }); }); - it('should return available updates from api when in the first request, api_version is undefined and the second request fail', async () => { + it('should return updates when api version undefined first request and second request fails', async () => { const semver = { major: 4, minor: 3, @@ -240,7 +240,7 @@ describe('getUpdates function', () => { ], }); }); - it('should return available updates from api when the first request fail', async () => { + it('should return updates when first request fails', async () => { const semver = { major: 4, minor: 3, @@ -291,7 +291,7 @@ describe('getUpdates function', () => { ], }); }); - it('should return available updates from api when the second request fail', async () => { + it('should return updates when second request fails', async () => { const semver = { major: 4, minor: 3, @@ -327,7 +327,7 @@ describe('getUpdates function', () => { ], }); }); - it('should return error from api when both requests fail', async () => { + it('should return error when both requests fail', async () => { mockRequest .mockImplementationOnce(() => { throw new Error('Error'); From 568e8014c52e5d2e875b6743856368141e042293 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 12:14:41 -0300 Subject: [PATCH 18/20] fix(get-updates): enhance test descriptions for clarity in update availability cases and error handling scenarios --- .../server/services/updates/get-updates.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts index ecdc932c86..a44cc16f61 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.test.ts @@ -93,7 +93,7 @@ describe('getUpdates function', () => { expect(updates).toEqual(savedObject); }); - it('should return available updates from api', async () => { + it('should return available updates from api when both requests succeed', async () => { const semver = { major: 4, minor: 3, @@ -204,7 +204,7 @@ describe('getUpdates function', () => { ], }); }); - it('should return updates when api version undefined first request and second request fails', async () => { + it('should return updates when api version undefined on first request and second request fails', async () => { const semver = { major: 4, minor: 3, From 2019bcedb6e00e5a7db1fbc0cd3094423dfb6703 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 14:24:25 -0300 Subject: [PATCH 19/20] fix(changelog): update entries for issue #7177 and add fix for incorrect Wazuh API version display after upgrade --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21cd28249e..b755a46daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,8 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed the check updates UI was displayed despite it could be configured as disabled [#7156](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7156) - Fixed filter by value in document details in safari [#7151](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7151) - Fixed error message to prevent pass no strings to the wazuh logger [#7167](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7167) -- Fixed the rendering of the `data.vunerability.reference` in the table and flyout [#7177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7177) +- Fixed the rendering of the `data.vunerability.reference` in the table and flyout [#7177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7177)\ +- Fixed incorrect or empty Wazuh API version displayed after upgrade [#440](https://github.com/wazuh/wazuh-dashboard/issues/440) ### Removed From 3252cf376768cd4c37665109bce3cce2cdd14909 Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 17 Dec 2024 14:25:28 -0300 Subject: [PATCH 20/20] fix(changelog): correct rendering entry for vulnerability reference and clarify Wazuh API version display issue after upgrade --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b755a46daa..a7a31bda1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed the check updates UI was displayed despite it could be configured as disabled [#7156](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7156) - Fixed filter by value in document details in safari [#7151](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7151) - Fixed error message to prevent pass no strings to the wazuh logger [#7167](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7167) -- Fixed the rendering of the `data.vunerability.reference` in the table and flyout [#7177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7177)\ +- Fixed the rendering of the `data.vunerability.reference` in the table and flyout [#7177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7177) - Fixed incorrect or empty Wazuh API version displayed after upgrade [#440](https://github.com/wazuh/wazuh-dashboard/issues/440) ### Removed