Skip to content

Commit

Permalink
Merge tag 'v4.7.1-2.8.0' of https://github.com/wazuh/wazuh-dashboard-…
Browse files Browse the repository at this point in the history
…plugins into cloud/4.7-hl

Wazuh 4.7.1 for Wazuh Dashboard
  • Loading branch information
asteriscos committed Dec 22, 2023
2 parents f66a544 + beac211 commit 6e9e337
Show file tree
Hide file tree
Showing 11 changed files with 666 additions and 321 deletions.
19 changes: 12 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

All notable changes to the Wazuh app project will be documented in this file.

## Wazuh v4.7.0 - OpenSearch Dashboards 2.8.0 - Revision 04-hl
## Wazuh v4.7.1 - OpenSearch Dashboards 2.8.0 - Revision 03-hl

### Removed
### Added

- Removed the visualization of agent status evolution due to performance problems in environments with heavy load
- Removed the stat of most active agent in the agents section due to performance problems in environments with heavy load
- Support for Wazuh 4.7.1

### Changed
### Fixed

- Allowed the Details panel in Agents section to grow
- Fixed problem when using non latin characters in the username [#6076](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6076)
- Fixed UI crash on retrieving log collection configuration for macos agent. [#6104](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6104)
- Fixed incorrect validation of the agent name on the Deploy new agent window [#6105](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6105)
- Fixed missing columns in the agents table of Groups [#6184](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6184)

## Wazuh v4.7.0 - OpenSearch Dashboards 2.8.0 - Revision 04
## Wazuh v4.7.0 - OpenSearch Dashboards 2.8.0 - Revision 04-hl

### Added

Expand All @@ -26,6 +28,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Changed Network ports table columns for Linux agents. [#5636](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5636)
- Updated development dependencies (`@typescript-eslint/eslint-plugin, @typescript-eslint/parser, eslint, swagger-client`)[#5748](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5748)
- Changed timelion type displays in the management > statistics section to line type displays. [5707](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5707)
- - Allowed the Details panel in Agents section to grow

### Fixed

Expand All @@ -37,6 +40,8 @@ All notable changes to the Wazuh app project will be documented in this file.
### Removed

- Removed views in JSON and XML formats from management settings. [#5747](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5747)
- Removed the visualization of agent status evolution due to performance problems in environments with heavy load
- Removed the stat of most active agent in the agents section due to performance problems in environments with heavy load

## Wazuh v4.6.0 - OpenSearch Dashboards 2.8.0 - Revision 03

Expand Down
4 changes: 2 additions & 2 deletions docker/imposter/api-info/api_info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"data": {
"title": "Wazuh API REST",
"api_version": "4.7.0",
"revision": 1,
"api_version": "4.7.1",
"revision": "00",
"license_name": "GPL 2.0",
"license_url": "https://github.com/wazuh/wazuh/blob/4.5/LICENSE",
"hostname": "imposter",
Expand Down
2 changes: 1 addition & 1 deletion plugins/main/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "wazuh",
"version": "4.7.0-04",
"version": "4.7.1-03",
"opensearchDashboardsVersion": "opensearchDashboards",
"configPath": [
"wazuh"
Expand Down
4 changes: 2 additions & 2 deletions plugins/main/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wazuh",
"version": "4.7.0",
"revision": "04-hl",
"version": "4.7.1",
"revision": "03-hl",
"pluginPlatform": {
"version": "2.8.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
import React, { Component, Fragment } from 'react';

import WzTabSelector, {
WzTabSelectorTab
WzTabSelectorTab,
} from '../util-components/tab-selector';
import WzConfigurationLogCollectionLogs from './log-collection-logs';
import WzConfigurationLogCollectionCommands from './log-collection-commands';
import WzConfigurationLogCollectionWindowsEvents from './log-collection-windowsevents'
import WzConfigurationLogCollectionWindowsEvents from './log-collection-windowsevents';
import WzConfigurationLogCollectionSockets from './log-collection-sockets';
import withWzConfig from '../util-hocs/wz-config';
import { isString } from '../utils/utils';
import {
LOCALFILE_COMMANDS_PROP,
LOCALFILE_LOGS_PROP,
LOCALFILE_WINDOWSEVENT_PROP,
LOGCOLLECTOR_LOCALFILE_PROP } from './types'
import {
LOCALFILE_COMMANDS_PROP,
LOCALFILE_LOGS_PROP,
LOCALFILE_WINDOWSEVENT_PROP,
LOGCOLLECTOR_LOCALFILE_PROP,
} from './types';

class WzConfigurationLogCollection extends Component {
constructor(props) {
Expand All @@ -40,45 +41,94 @@ class WzConfigurationLogCollection extends Component {
...currentConfig,
[LOGCOLLECTOR_LOCALFILE_PROP]: {
...currentConfig[LOGCOLLECTOR_LOCALFILE_PROP],
[LOCALFILE_LOGS_PROP]: currentConfig[LOGCOLLECTOR_LOCALFILE_PROP].localfile.filter(item => typeof item.file !== 'undefined'), // TODO: it needs to be defined to support localfile as `eventchannel`. These doesn't have file property.
[LOCALFILE_WINDOWSEVENT_PROP]: currentConfig[LOGCOLLECTOR_LOCALFILE_PROP].localfile.filter(item => item.logformat === 'eventchannel' || item.logformat === 'eventlog'),
[LOCALFILE_COMMANDS_PROP]: currentConfig[LOGCOLLECTOR_LOCALFILE_PROP].localfile.filter(item => item.logformat === 'command' || item.logformat === 'full_command')
}
[LOCALFILE_LOGS_PROP]: currentConfig[
LOGCOLLECTOR_LOCALFILE_PROP
].localfile.filter(item => typeof item.file !== 'undefined'), // TODO: it needs to be defined to support localfile as `eventchannel`. These doesn't have file property.
[LOCALFILE_WINDOWSEVENT_PROP]: currentConfig[
LOGCOLLECTOR_LOCALFILE_PROP
].localfile.filter(
item =>
item.logformat === 'eventchannel' ||
item.logformat === 'eventlog',
),
[LOCALFILE_COMMANDS_PROP]: currentConfig[
LOGCOLLECTOR_LOCALFILE_PROP
].localfile.filter(
item =>
item.logformat === 'command' ||
item.logformat === 'full_command',
),
},
}
: currentConfig;
return (
<Fragment>
<WzTabSelector>
{ currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_LOGS_PROP].length > 0 &&
<WzTabSelectorTab label="Logs">
<WzConfigurationLogCollectionLogs
currentConfig={currentConfig}
agent={agent}
/>
</WzTabSelectorTab>
}
{ currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_WINDOWSEVENT_PROP].length > 0 &&
<WzTabSelectorTab label="Windows Events">
<WzConfigurationLogCollectionWindowsEvents
currentConfig={currentConfig}
agent={agent}
/>
</WzTabSelectorTab>
}
{ currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_COMMANDS_PROP].length > 0 &&
<WzTabSelectorTab label="Commands">
<WzConfigurationLogCollectionCommands
currentConfig={currentConfig}
agent={agent}
/>
</WzTabSelectorTab>
}
<WzTabSelectorTab label="Sockets">

const tabsToRender = [
{
condition:
currentConfig[LOGCOLLECTOR_LOCALFILE_PROP] &&
currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_LOGS_PROP]
.length > 0,
component: (
<WzTabSelectorTab label='Logs'>
<WzConfigurationLogCollectionLogs
currentConfig={currentConfig}
agent={agent}
/>
</WzTabSelectorTab>
),
},
{
condition:
currentConfig[LOGCOLLECTOR_LOCALFILE_PROP] &&
currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][
LOCALFILE_WINDOWSEVENT_PROP
].length > 0,
component: (
<WzTabSelectorTab label='Windows Events'>
<WzConfigurationLogCollectionWindowsEvents
currentConfig={currentConfig}
agent={agent}
/>
</WzTabSelectorTab>
),
},
{
condition:
currentConfig[LOGCOLLECTOR_LOCALFILE_PROP] &&
currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_COMMANDS_PROP]
.length > 0,
component: (
<WzTabSelectorTab label='Commands'>
<WzConfigurationLogCollectionCommands
currentConfig={currentConfig}
agent={agent}
/>
</WzTabSelectorTab>
),
},
{
condition: true, // Will always render
component: (
<WzTabSelectorTab label='Sockets'>
<WzConfigurationLogCollectionSockets
currentConfig={currentConfig}
agent={agent}
/>
</WzTabSelectorTab>
),
},
];

return (
<Fragment>
<WzTabSelector>
{tabsToRender
.filter(tab => tab.condition)
.map((tab, index) =>
React.cloneElement(tab.component, {
key: `WzTabSelectorTab_${index}`,
}),
)}
</WzTabSelector>
</Fragment>
);
Expand All @@ -87,7 +137,7 @@ class WzConfigurationLogCollection extends Component {

const sections = [
{ component: 'logcollector', configuration: 'localfile' },
{ component: 'logcollector', configuration: 'socket' }
{ component: 'logcollector', configuration: 'socket' },
];

export default withWzConfig(sections)(WzConfigurationLogCollection);
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class WzTabSelector extends Component {
constructor(props) {
super(props);
this.state = {
selectedTab: this.props.children[0].props.label
selectedTab: this.props.children.find(
child => child.props?.label !== undefined,
)?.props?.label,
};
}
changeSelectedTab(tab) {
Expand All @@ -28,24 +30,26 @@ class WzTabSelector extends Component {
render() {
const { selectedTab } = this.state;
const { children, container, spacer } = this.props;
const activeTabContent = children.filter(child => child).find(
child => child.props.label === selectedTab
);
const activeTabContent = children
.filter(child => child)
.find(child => child.props.label === selectedTab);
return (
<Fragment>
<EuiTabs>
{children.filter(child => child).map(child => {
const { label } = child.props;
return (
<EuiTab
onClick={() => this.changeSelectedTab(label)}
isSelected={label === selectedTab}
key={`tab-${label}`}
>
{label}
</EuiTab>
);
})}
{children
.filter(child => child)
.map(child => {
const { label } = child.props;
return (
<EuiTab
onClick={() => this.changeSelectedTab(label)}
isSelected={label === selectedTab}
key={`tab-${label}`}
>
{label}
</EuiTab>
);
})}
</EuiTabs>
{(container && container(activeTabContent)) || (
<div>
Expand All @@ -60,7 +64,7 @@ class WzTabSelector extends Component {

WzTabSelector.propTypes = {
children: PropTypes.array.isRequired,
spacer: PropTypes.string
spacer: PropTypes.string,
};

export default WzTabSelector;
Expand All @@ -75,5 +79,5 @@ export class WzTabSelectorTab extends Component {
}

WzTabSelectorTab.propTypes = {
label: PropTypes.string
label: PropTypes.string,
};
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class WzGroupAgentsTable extends Component {
align: 'left',
searchable: true,
sortable: true,
show: true,
},
{
field: 'status',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,23 @@ describe('Validations', () => {
const invalidAgentName = '?';
const result = validateAgentName(invalidAgentName);
expect(result).toBe(
'The minimum length is 2 characters. The character is not valid. Allowed characters are A-Z, a-z, ".", "-", "_"',
'The minimum length is 2 characters. The character "?" is not valid. Allowed characters are A-Z, a-z, 0-9, ".", "-", "_"',
);
});

test('should return an error message for invalid format', () => {
test('should return an error message for invalid format of 1 character', () => {
const invalidAgentName = 'agent$name';
const result = validateAgentName(invalidAgentName);
expect(result).toBe(
'The character is not valid. Allowed characters are A-Z, a-z, ".", "-", "_"',
'The character "$" is not valid. Allowed characters are A-Z, a-z, 0-9, ".", "-", "_"',
);
});

test('should return an error message for invalid format of more than 1 character', () => {
const invalidAgentName = 'agent$?name';
const result = validateAgentName(invalidAgentName);
expect(result).toBe(
'The characters "$,?" are not valid. Allowed characters are A-Z, a-z, 0-9, ".", "-", "_"',
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,26 @@ export const validateAgentName = (value: any) => {
if (value.length === 0) {
return undefined;
}
const regex = /^[A-Za-z.\-_,]+$/;
let invalidCharacters = validateCharacters(value);
if (value.length < 2) {
return `The minimum length is 2 characters.${
invalidCharacters && ` ${invalidCharacters}`
}`;
}
return `${invalidCharacters}`;
};

const isLengthValid = value.length >= 2 && value.length <= 63;
const isFormatValid = regex.test(value);
if (!isFormatValid && !isLengthValid) {
return 'The minimum length is 2 characters. The character is not valid. Allowed characters are A-Z, a-z, ".", "-", "_"';
} else if (!isLengthValid) {
return 'The minimum length is 2 characters.';
} else if (!isFormatValid) {
return 'The character is not valid. Allowed characters are A-Z, a-z, ".", "-", "_"';
const validateCharacters = (value: any) => {
const regex = /^[a-z0-9.\-_,]+$/i;
const invalidCharacters = [
...new Set(value.split('').filter(char => !regex.test(char))),
];
if (invalidCharacters.length > 1) {
return `The characters "${invalidCharacters.join(
',',
)}" are not valid. Allowed characters are A-Z, a-z, 0-9, ".", "-", "_"`;
} else if (invalidCharacters.length === 1) {
return `The character "${invalidCharacters[0]}" is not valid. Allowed characters are A-Z, a-z, 0-9, ".", "-", "_"`;
}
return '';
};
Loading

0 comments on commit 6e9e337

Please sign in to comment.