Skip to content

Commit

Permalink
Merge branch 'master' into 4.4-7.16
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Sep 5, 2022
2 parents 6ba7481 + 63e6b70 commit 6b84a9f
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 11 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ All notable changes to the Wazuh app project will be documented in this file.

### Fixed

- Wazuh.yml review: fixed link to web documentation, improved in-file documentation and fixed some grammatical errors. [#4378](https://github.com/wazuh/wazuh-kibana-app/pull/4378)
- Wazuh.yml review: fixed link to web documentation, improved in-file documentation and fixed some grammatical errors. [#4378](https://github.com/wazuh/wazuh-kibana-app/pull/4378) [#4399](https://github.com/wazuh/wazuh-kibana-app/pull/4399)
- Fixed an error during the generation of a group's report, if the request to the Wazuh API fails [#4350](https://github.com/wazuh/wazuh-kibana-app/pull/4350)
- Fixed a problem with the group's report, when the group has no agents [#4350](https://github.com/wazuh/wazuh-kibana-app/pull/4350)
- Fixed path in logo customization section [#4352](https://github.com/wazuh/wazuh-kibana-app/pull/4352)
- Fixed a TypeError in Firefox. Change the Get request that was made with a Kibana core.http.get(/api/check-wazuh) resource to the WzRequest.genericReq resource and it no longer fails, also add a test capture to public/plugin.ts that wraps the request and in case of failure, the error is detected when the browser does not work with the V8 engine. [#4362](https://github.com/wazuh/wazuh-kibana-app/pull/4362)
- Fixed an error of an undefined username hash related to reporting when using Kibana with X-Pack and security was disabled [#4358](https://github.com/wazuh/wazuh-kibana-app/pull/4358)
- Fixed persistence of the plugin registry file between updates [#4359](https://github.com/wazuh/wazuh-kibana-app/pull/4359)
- Fixed searchbar error on SCA Inventory table [#4367](https://github.com/wazuh/wazuh-kibana-app/pull/4367)
- Fixed a routes loop when reinstalling Wazuh indexer [#4373](https://github.com/wazuh/wazuh-kibana-app/pull/4373)

# Removed

Expand Down Expand Up @@ -78,7 +79,7 @@ All notable changes to the Wazuh app project will be documented in this file.

- Replaced the visualization of `Status` panel in `Agents` [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166) [#4196](https://github.com/wazuh/wazuh-kibana-app/pull/4196)
- Replaced the visualization of policy in `Modules/Security configuration assessment/Inventory` [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166)
- Consistency in the colors and labels used for the agent status [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166)
- Consistency in the colors and labels used for the agent status [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166) [#4199](https://github.com/wazuh/wazuh-kibana-app/issues/4199)
- Replaced how the full and partial scan dates are displayed in the `Details` panel of `Vulnerabilities/Inventory` [#4169](https://github.com/wazuh/wazuh-kibana-app/pull/4169)

### Fixed
Expand Down
19 changes: 19 additions & 0 deletions common/api-info/endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -6904,6 +6904,25 @@
}
]
},
{
"name": "/security/user/authenticate",
"documentation": "https://documentation.wazuh.com/4.3/user-manual/api/reference.html#operation/api.controllers.security_controller.login_user",
"description": "This method should be called to get an API token. This token will expire after auth_token_exp_timeout seconds (default: 900). This value can be changed using PUT /security/config",
"summary": "Login",
"tags": [
"Security"
],
"query": [
{
"name": "raw",
"description": "Format response in plain text",
"required": false,
"schema": {
"type": "boolean"
}
}
]
},
{
"name": "/security/users",
"documentation": "https://documentation.wazuh.com/4.3/user-manual/api/reference.html#operation/api.controllers.security_controller.get_users",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASSETS_PUBLIC_URL, PLUGIN_PLATFORM_NAME } from "../../common/constants";
import { ASSETS_PUBLIC_URL, PLUGIN_PLATFORM_NAME } from "./constants";

export const configEquivalences = {
pattern: "Default index pattern to use on the app. If there's no valid index pattern, the app will automatically create one with the name indicated in this option.",
Expand Down
2 changes: 1 addition & 1 deletion kibana.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "wazuh",
"version": "4.3.6-4307",
"version": "4.4.0-4400",
"kibanaVersion": "kibana",
"configPath": [
"wazuh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export const checkIndexPatternObjectService = async (appConfig, checkLogger: Ch
listValidIndexPatterns = await SavedObject.getListOfWazuhValidIndexPatterns(defaultIndexPatterns, HEALTH_CHECK);
checkLogger.info(`Valid index patterns found: ${listValidIndexPatterns.length || 0}`);
if(!AppState.getCurrentPattern()){
// Check the index pattern saved objects can be found using `GET /api/saved_objects/_find` endpoint.
// Related issue: https://github.com/wazuh/wazuh-kibana-app/issues/4293
await validateIntegritySavedObjects([defaultPatternId], checkLogger);

AppState.setCurrentPattern(defaultPatternId);
checkLogger.info(`Index pattern set in cookie: [${defaultPatternId}]`);
}
Expand All @@ -72,8 +76,14 @@ export const checkIndexPatternObjectService = async (appConfig, checkLogger: Ch
if (AppState.getCurrentPattern() && listValidIndexPatterns.length) {
const indexPatternToSelect = listValidIndexPatterns.find(item => item.id === AppState.getCurrentPattern());
if (!indexPatternToSelect){
AppState.setCurrentPattern(listValidIndexPatterns[0].id);
checkLogger.action(`Set index pattern id in cookie: [${listValidIndexPatterns[0].id}]`);
const indexPatternID = listValidIndexPatterns[0].id;

// Check the index pattern saved objects can be found using `GET /api/saved_objects/_find` endpoint.
// Related issue: https://github.com/wazuh/wazuh-kibana-app/issues/4293
await validateIntegritySavedObjects([indexPatternID], checkLogger);

AppState.setCurrentPattern(indexPatternID);
checkLogger.action(`Set index pattern id in cookie: [${indexPatternID}]`);
}
}

Expand All @@ -94,6 +104,10 @@ export const checkIndexPatternObjectService = async (appConfig, checkLogger: Ch
const indexPatternDefaultFound = listValidIndexPatterns.find((indexPattern) => indexPattern.title === defaultPatternId);
checkLogger.info(`Index pattern id exists [${defaultPatternId}]: ${indexPatternDefaultFound ? 'yes': 'no'}`);
if(indexPatternDefaultFound){
// Check the index pattern saved objects can be found using `GET /api/saved_objects/_find` endpoint.
// Related issue: https://github.com/wazuh/wazuh-kibana-app/issues/4293
await validateIntegritySavedObjects([indexPatternDefaultFound.id], checkLogger);

AppState.setCurrentPattern(indexPatternDefaultFound.id);
checkLogger.action(`Index pattern set in cookie: [${indexPatternDefaultFound.id}]`);
}
Expand All @@ -104,3 +118,11 @@ export const checkIndexPatternObjectService = async (appConfig, checkLogger: Ch
}
}
};

// Check the index pattern saved objects can be found using `GET /api/saved_objects/_find` endpoint.
// Related issue: https://github.com/wazuh/wazuh-kibana-app/issues/4293
const validateIntegritySavedObjects = async (indexPatternSavedObjectIDs: string[], checkLogger: CheckLogger): Promise<void> => {
checkLogger.info(`Checking the integrity of saved objects. Validating ${indexPatternSavedObjectIDs.join(',')} can be found...`);
await SavedObject.validateIndexPatternSavedObjectCanBeFound(indexPatternSavedObjectIDs);
checkLogger.info('Integrity of saved objects: [ok]');
};
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,11 @@ export const checkPatternSupportService = (pattern: string, indexType : string)
checkLogger.error(`Error creating index pattern id [${pattern}]: ${error.message || error}`);
}
};

const indexPatternSavedObjectIDs = [pattern];
// Check the index pattern saved objects can be found using `GET /api/saved_objects/_find` endpoint.
// Related issue: https://github.com/wazuh/wazuh-kibana-app/issues/4293
checkLogger.info(`Checking the integrity of saved objects. Validating ${indexPatternSavedObjectIDs.join(',')} can be found...`);
await SavedObject.validateIndexPatternSavedObjectCanBeFound(indexPatternSavedObjectIDs);
checkLogger.info('Integrity of saved objects: [ok]');
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

import React, { useState, useEffect, Fragment } from 'react';
import {categoriesNames} from '../../../../utils/config-equivalences';
import {categoriesNames} from '../../../../../common/config-equivalences';
import { AppNavigate } from '../../../../react-services/app-navigate';
import {
EuiFlexGroup,
Expand Down
2 changes: 1 addition & 1 deletion public/components/settings/configuration/configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
nameEquivalence,
categoriesEquivalence,
formEquivalence
} from '../../../utils/config-equivalences';
} from '../../../../common/config-equivalences';
import store from '../../../redux/store'
import { updateSelectedSettingsSection } from '../../../redux/actions/appStateActions';
import { withUserAuthorizationPrompt, withErrorBoundary, withReduxProvider } from '../../common/hocs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class WzReportingTable extends Component {
async getItems() {
try {
const rawItems = await this.reportingHandler.listReports();
const {reports: items = [], path} = rawItems?.data;
const {reports: items = []} = rawItems?.data;
this.setState({
items,
isProcessing: false,
Expand Down
25 changes: 24 additions & 1 deletion public/react-services/saved-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ import { FieldsStatistics } from '../utils/statistics-fields';
import { FieldsMonitoring } from '../utils/monitoring-fields';
import {
HEALTH_CHECK,
PLUGIN_PLATFORM_NAME,
WAZUH_INDEX_TYPE_ALERTS,
WAZUH_INDEX_TYPE_MONITORING,
WAZUH_INDEX_TYPE_STATISTICS,
} from '../../common/constants';
import { satisfyPluginPlatformVersion } from '../../common/semver';
import { getSavedObjects } from '../kibana-services';
import { webDocumentationLink } from '../../common/services/web_documentation';

export class SavedObject {
/**
Expand Down Expand Up @@ -316,4 +319,24 @@ export class SavedObject {
}
}
};
}

/**
* Check if it exists the index pattern saved objects using the `GET /api/saved_objects/_find` endpoint.
* It is usefull to validate if the endpoint works as expected. Related issue: https://github.com/wazuh/wazuh-kibana-app/issues/4293
* @param {string[]} indexPatternIDs
*/
static async validateIndexPatternSavedObjectCanBeFound(indexPatternIDs){
const indexPatternsSavedObjects = await getSavedObjects().client.find({
type: 'index-pattern',
fields: ['title'],
perPage: 10000
});
const indexPatternsSavedObjectsCanBeFound = indexPatternIDs
.every(indexPatternID => indexPatternsSavedObjects.savedObjects.some(savedObject => savedObject.id === indexPatternID));

if (!indexPatternsSavedObjectsCanBeFound) {
throw new Error(`Saved object for index pattern not found.
Restart the ${PLUGIN_PLATFORM_NAME} service to initialize the index. More information in <a href="${webDocumentationLink('user-manual/wazuh-dashboard/troubleshooting.html#saved-object-for-index-pattern-not-found')}" target="_blank">troubleshooting</a>.`
)};
}
}
2 changes: 1 addition & 1 deletion server/lib/initial-wazuh-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
WAZUH_STATISTICS_DEFAULT_STATUS,
} from '../../common/constants';
import { webDocumentationLink } from '../../common/services/web_documentation';
import { configEquivalences } from '../../public/utils/config-equivalences';
import { configEquivalences } from '../../common/config-equivalences';

/**
* Given a string, this function builds a multine string, each line about 70
Expand Down

0 comments on commit 6b84a9f

Please sign in to comment.