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

[BUG] Plugin crash when searching with a query with syntax errors in Modules/Security events #4237

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to the Wazuh app project will be documented in this file.

### 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)
- Fixed type error when changing screen size in agents section [#4233](https://github.com/wazuh/wazuh-kibana-app/pull/4233)
- Fixed an error when generating a module report after changing the selected agent [#4240](https://github.com/wazuh/wazuh-kibana-app/pull/4240)

Expand Down
13 changes: 4 additions & 9 deletions public/components/common/modules/discover/discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -127,7 +126,6 @@ export const Discover = compose(
sortField: 'timestamp',
sortDirection: 'desc',
isLoading: false,
requestFilters: {},
requestSize: 500,
requestOffset: 0,
itemIdToExpandedRowMap: {},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down