From ef1b06e49e8641daa6030bbc35d5e967cea6502d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20David=20Guti=C3=A9rrez?= Date: Thu, 9 Jun 2022 16:18:27 +0200 Subject: [PATCH 1/2] fix: fixed plugin UI crash when there is an error related to wrong query syntax in Modules/Security events Replaced the error level from `CRITICAL` to `BUSINESS`. With this change, a toast will be displayed with the error. Removed the storing of the error in the plugin logs related to UI. Removed unused variable --- .../components/common/modules/discover/discover.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/public/components/common/modules/discover/discover.tsx b/public/components/common/modules/discover/discover.tsx index 84b2cadfbd..5ce7937371 100644 --- a/public/components/common/modules/discover/discover.tsx +++ b/public/components/common/modules/discover/discover.tsx @@ -87,7 +87,6 @@ export const Discover = compose( sortField: string; sortDirection: Direction; isLoading: boolean; - requestFilters: object; requestSize: number; requestOffset: number; query: { language: 'kuery' | 'lucene'; query: string }; @@ -127,7 +126,6 @@ export const Discover = compose( sortField: 'timestamp', sortDirection: 'desc', isLoading: false, - requestFilters: {}, requestSize: 500, requestOffset: 0, itemIdToExpandedRowMap: {}, @@ -171,8 +169,7 @@ export const Discover = compose( const options = { context: `${Discover.name}.componentDidMount`, level: UI_LOGGER_LEVELS.ERROR, - severity: UI_ERROR_SEVERITIES.CRITICAL, - store: true, + severity: UI_ERROR_SEVERITIES.BUSINESS, error: { error: error, message: error.message || error, @@ -231,8 +228,7 @@ export const Discover = compose( const options = { context: `${Discover.name}.componentDidUpdate`, level: UI_LOGGER_LEVELS.ERROR, - severity: UI_ERROR_SEVERITIES.CRITICAL, - store: true, + severity: UI_ERROR_SEVERITIES.BUSINESS, error: { error: error, message: error.message || error, @@ -421,9 +417,9 @@ export const Discover = compose( async getAlerts() { if (!this.indexPattern || this.state.isLoading) return; //compare filters so we only make a request into Elasticsearch if needed - const newFilters = this.buildFilter(); try { this.setState({ isLoading: true }); + const newFilters = this.buildFilter(); const alerts = await GenericRequest.request('POST', `/elastic/alerts`, { index: this.indexPattern.title, body: newFilters, @@ -433,13 +429,12 @@ export const Discover = compose( alerts: alerts.data.hits.hits, total: alerts.data.hits.total.value, isLoading: false, - requestFilters: newFilters, }); this.props.updateTotalHits(alerts.data.hits.total.value); } } catch (error) { if (this._isMount) { - this.setState({ alerts: [], total: 0, isLoading: false, requestFilters: newFilters }); + this.setState({ alerts: [], total: 0, isLoading: false }); this.props.updateTotalHits(0); } throw error; From ed76f5462424d4d900f511d3b5529d8ff5c22a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20David=20Guti=C3=A9rrez?= Date: Thu, 9 Jun 2022 16:49:17 +0200 Subject: [PATCH 2/2] changelog: Add PR entry --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fc71d4d94..067d24c57f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the Wazuh app project will be documented in this file. +## Wazuh v4.3.5 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4306 + +### Fixed + +- Fixed a UI crash due to a query with syntax errors in `Modules/Security events` [#4237](https://github.com/wazuh/wazuh-kibana-app/pull/4237) + ## Wazuh v4.3.4 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4305 ### Added