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

4.0-7.10 Backend organization #2781

Merged
merged 7 commits into from
Jan 14, 2021
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
2 changes: 1 addition & 1 deletion .kibana-plugin-helpers.bak.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"init.js",
"server/**/*",
"public/**/*",
"util/**/*"
"common/**/*"
]
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Find more information about this on the LICENSE file.
*/
export const TabDescription = {
export const WAZUH_MODULES = {
general: {
title: 'Security events',
description:
Expand Down
2 changes: 1 addition & 1 deletion public/components/add-modules-data/WzSampleDataWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import WzReduxProvider from '../../redux/wz-redux-provider';
import { withUserAuthorizationPrompt } from '../../components/common/hocs/withUserAuthorization';
import store from '../../redux/store';
import { updateSelectedSettingsSection } from '../../redux/actions/appStateActions';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../util/constants';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../common/constants';

export class WzSampleDataProvider extends Component {
constructor(props) {
Expand Down
4 changes: 2 additions & 2 deletions public/components/add-modules-data/add-modules-data-main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import WzModuleGuide from './module-guide';
import WzSampleData from './sample-data';
import modeGuides from './guides';

import { TabDescription } from '../../../server/reporting/tab-description';
import { WAZUH_MODULES } from '../../../common/wazuh-modules';
import { updateGlobalBreadcrumb } from '../../redux/actions/globalBreadcrumbActions';
import store from '../../redux/store';

Expand Down Expand Up @@ -70,7 +70,7 @@ export default class WzAddModulesData extends Component<IPropsWzAddModulesData,
// layout='horizontal'
// icon={(<EuiIcon size='xl' type={extension.icon} />) }
// title={extension.name}
// description={(TabDescription[extension.id] && TabDescription[extension.id].description) || extension.description}
// description={(WAZUH_MODULES[extension.id] && WAZUH_MODULES[extension.id].description) || extension.description}
// onClick={() => this.changeGuide(extension.id) }
// />
// </EuiFlexItem>
Expand Down
2 changes: 1 addition & 1 deletion public/components/add-modules-data/sample-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { getToasts } from '../../kibana-services';
import { WzRequest } from '../../react-services/wz-request';
import { AppState } from '../../react-services/app-state';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../util/constants';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../common/constants';

export default class WzSampleData extends Component {
categories: { title: string, description: string, image: string, categorySampleAlertsIndex: string }[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { EuiPanel, EuiFlexGroup, EuiButtonEmpty, EuiFlexItem, EuiText, EuiLoadingSpinner, EuiFieldSearch, EuiHorizontalRule, EuiIcon, EuiBasicTable } from "@elastic/eui";
import { useApiRequest } from '../../../common/hooks/useApiRequest';
import { KeyEquivalence } from '../../../../../util/csv-key-equivalence';
import { KeyEquivalence } from '../../../../../common/csv-key-equivalence';
import { AppState } from '../../../../react-services/app-state';


Expand Down
10 changes: 5 additions & 5 deletions public/components/common/modules/agents-current-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { updateGlobalBreadcrumb } from '../../../redux/actions/globalBreadcrumbA
import { updateCurrentTab } from '../../../redux/actions/appStateActions';
import store from '../../../redux/store';
import { connect } from 'react-redux';
import { TabDescription } from '../../../../server/reporting/tab-description';
import { WAZUH_MODULES } from '../../../../common/wazuh-modules';
import { getAngularModule } from '../../../kibana-services';

class WzCurrentAgentsSection extends Component {
Expand All @@ -29,7 +29,7 @@ class WzCurrentAgentsSection extends Component {
}

setGlobalBreadcrumb() {
if (TabDescription[this.props.currentTab]) {
if (WAZUH_MODULES[this.props.currentTab]) {
const breadcrumb = [
{ text: '' },
{
Expand All @@ -45,7 +45,7 @@ class WzCurrentAgentsSection extends Component {
className: 'wz-global-breadcrumb-btn euiBreadcrumb--truncate',
truncate: false,
},
{ text: TabDescription[this.props.currentTab].title },
{ text: WAZUH_MODULES[this.props.currentTab].title },
];
store.dispatch(updateGlobalBreadcrumb(breadcrumb));
}
Expand Down Expand Up @@ -74,10 +74,10 @@ class WzCurrentAgentsSection extends Component {
render() {
return (
<span>
{this.props.currentTab && TabDescription[this.props.currentTab] && TabDescription[this.props.currentTab].title && (
{this.props.currentTab && WAZUH_MODULES[this.props.currentTab] && WAZUH_MODULES[this.props.currentTab].title && (
<EuiTitle size='s'>
<h2>
{TabDescription[this.props.currentTab].title}
{WAZUH_MODULES[this.props.currentTab].title}
</h2>
</EuiTitle>)}
</span>
Expand Down
2 changes: 1 addition & 1 deletion public/components/common/modules/discover/discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export const Discover = compose(

const alerts = await GenericRequest.request(
'POST',
`/elastic/esAlerts`,
`/elastic/alerts`,
{
index: AppState.getCurrentPattern(),
body: newFilters
Expand Down
29 changes: 28 additions & 1 deletion public/components/common/modules/discover/row-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,32 @@ export class RowDetails extends Component {
);
}

getValueAsString(value) {
if (value && typeof value === 'object' && value.constructor === Object) {
let list: any[] = [];
Object.keys(value).forEach((key, idx) => {
list.push(
<span key={key}>
{key}:&nbsp;
{value[key]}
{idx < Object.keys(value).length - 1 && ', '}
<br />
</span>
);
});
return (
<ul>
<li>
{list}
</li>
</ul>
);
} else {

return value.toString();
}
}

getFormattedDetails(value) {

if (Array.isArray(value) && value[0].type) {
Expand All @@ -382,9 +408,10 @@ export class RowDetails extends Component {
})
return <span>{name}: {link}</span>
} else {
const _value = typeof value === 'string' ? value : this.getValueAsString(value);
return (
<WzTextWithTooltipTruncated position='top'>
{value}
{_value}
</WzTextWithTooltipTruncated>
);
}
Expand Down
4 changes: 2 additions & 2 deletions public/components/common/modules/main-agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import store from '../../../redux/store';
import { FilterHandler } from '../../../utils/filter-handler';
import { AppState } from '../../../react-services/app-state';
import { ReportingService } from '../../../react-services/reporting';
import { TabDescription } from '../../../../server/reporting/tab-description';
import { WAZUH_MODULES } from '../../../../common/wazuh-modules';
import { Events, Dashboard, Loader, Settings } from '../../common/modules';
import WzReduxProvider from '../../../redux/wz-redux-provider';
import { AgentInfo } from '../../common/welcome/agents-info';
Expand Down Expand Up @@ -90,7 +90,7 @@ export class MainModuleAgent extends Component {
},
{ agent: this.props.agent },
{
text: TabDescription[this.props.section].title,
text: WAZUH_MODULES[this.props.section].title,
className: 'wz-global-breadcrumb-popover'
},
];
Expand Down
10 changes: 5 additions & 5 deletions public/components/common/modules/main-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { updateGlobalBreadcrumb } from '../../../redux/actions/globalBreadcrumbA
import store from '../../../redux/store';
import { ReportingService } from '../../../react-services/reporting';
import { AppNavigate } from '../../../react-services/app-navigate';
import { TabDescription } from '../../../../server/reporting/tab-description';
import { WAZUH_MODULES } from '../../../../common/wazuh-modules';
import { Events, Dashboard, Loader, Settings } from '../../common/modules';
import OverviewActions from '../../../controllers/overview/components/overview-actions/overview-actions';
import { MainFim } from '../../agents/fim';
Expand Down Expand Up @@ -55,7 +55,7 @@ export class MainModuleOverview extends Component {

setGlobalBreadcrumb() {
const currentAgent = store.getState().appStateReducers.currentAgentData;
if (TabDescription[this.props.currentTab]) {
if (WAZUH_MODULES[this.props.currentTab]) {
let breadcrumb = [
{
text: '',
Expand All @@ -70,7 +70,7 @@ export class MainModuleOverview extends Component {
href: "#/overview"
},
{
text: TabDescription[this.props.section].title
text: WAZUH_MODULES[this.props.section].title
},
];
store.dispatch(updateGlobalBreadcrumb(breadcrumb));
Expand Down Expand Up @@ -104,7 +104,7 @@ export class MainModuleOverview extends Component {
<span style={{ display: 'inline-flex' }}>
<EuiTitle size="s">
<h1>
<span>&nbsp;{TabDescription[this.props.section].title}&nbsp;&nbsp;</span>
<span>&nbsp;{WAZUH_MODULES[this.props.section].title}&nbsp;&nbsp;</span>
</h1>
</EuiTitle>
<EuiPopover
Expand All @@ -122,7 +122,7 @@ export class MainModuleOverview extends Component {
closePopover={() => { this.setState({ isDescPopoverOpen: false }) }}>
<EuiPopoverTitle>Module description</EuiPopoverTitle>
<div style={{ width: '400px' }}>
{TabDescription[this.props.section].description}
{WAZUH_MODULES[this.props.section].description}
</div>
</EuiPopover>
</span>
Expand Down
12 changes: 6 additions & 6 deletions public/components/common/modules/overview-current-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { updateGlobalBreadcrumb } from '../../../redux/actions/globalBreadcrumbA
import { updateCurrentTab } from '../../../redux/actions/appStateActions';
import store from '../../../redux/store';
import { connect } from 'react-redux';
import { TabDescription } from '../../../../server/reporting/tab-description';
import { WAZUH_MODULES } from '../../../../common/wazuh-modules';
import { AppNavigate } from '../../../react-services/app-navigate'

class WzCurrentOverviewSection extends Component {
Expand All @@ -40,19 +40,19 @@ class WzCurrentOverviewSection extends Component {
setGlobalBreadcrumb() {
const currentAgent = store.getState().appStateReducers.currentAgentData;

if(TabDescription[this.props.currentTab]){
if(WAZUH_MODULES[this.props.currentTab]){
const breadcrumb = currentAgent.id ? [
{ text: '' },
{ text: 'Modules', href: '/app/wazuh#/overview' },
{ agent: currentAgent },
{ text: TabDescription[this.props.currentTab].title},
{ text: WAZUH_MODULES[this.props.currentTab].title},
] :
[
{ text: '' },
{ text: 'Modules', href: '/app/wazuh#/overview' },


{ text: TabDescription[this.props.currentTab].title},
{ text: WAZUH_MODULES[this.props.currentTab].title},
];
store.dispatch(updateGlobalBreadcrumb(breadcrumb));
$('#breadcrumbNoTitle').attr("title","");
Expand Down Expand Up @@ -80,10 +80,10 @@ class WzCurrentOverviewSection extends Component {
render() {
return (
<span>
{/*this.props.currentTab && TabDescription[this.props.currentTab] && TabDescription[this.props.currentTab].title && (
{/*this.props.currentTab && WAZUH_MODULES[this.props.currentTab] && WAZUH_MODULES[this.props.currentTab].title && (
<EuiTitle size='s'>
<h2>
{TabDescription[this.props.currentTab].title}
{WAZUH_MODULES[this.props.currentTab].title}
</h2>
</EuiTitle>)*/}
</span>
frankeros marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
6 changes: 3 additions & 3 deletions public/components/common/welcome/agents-welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
} from '@elastic/eui';
import { FimEventsTable, ScaScan, MitreTopTactics, RequirementVis } from './components';
import { AgentInfo } from './agents-info';
import { TabDescription } from '../../../../server/reporting/tab-description';
import { WAZUH_MODULES } from '../../../../common/wazuh-modules';
import store from '../../../redux/store';
import { updateGlobalBreadcrumb } from '../../../redux/actions/globalBreadcrumbActions';
import { ActionAgents } from '../../../react-services/action-agents';
Expand Down Expand Up @@ -346,9 +346,9 @@ export class AgentsWelcome extends Component {
layout="horizontal"
icon={<EuiIcon size="xl" type={icon} color="primary" />}
className="homSynopsis__card"
title={TabDescription[tab].title}
title={WAZUH_MODULES[tab].title}
onClick={() => this.props.switchTab(tab)}
description={TabDescription[tab].description}
description={WAZUH_MODULES[tab].description}
/>
</EuiFlexItem>
);
Expand Down
6 changes: 3 additions & 3 deletions public/components/common/welcome/overview-welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { updateGlobalBreadcrumb } from '../../../redux/actions/globalBreadcrumbA
import { updateCurrentTab } from '../../../redux/actions/appStateActions';
import store from '../../../redux/store';
import './welcome.scss';
import { TabDescription } from '../../../../server/reporting/tab-description';
import { WAZUH_MODULES } from '../../../../common/wazuh-modules';

export class OverviewWelcome extends Component {
constructor(props) {
Expand Down Expand Up @@ -58,10 +58,10 @@ export class OverviewWelcome extends Component {
layout="horizontal"
icon={<EuiIcon size="xl" type={icon} color="primary" />}
className="homSynopsis__card"
title={TabDescription[tab].title}
title={WAZUH_MODULES[tab].title}
onClick={() => store.dispatch(updateCurrentTab(tab))}
data-test-subj={`overviewWelcome${this.strtools.capitalize(tab)}`}
description={TabDescription[tab].description}
description={WAZUH_MODULES[tab].description}
/>
</EuiFlexItem>
);
Expand Down
2 changes: 1 addition & 1 deletion public/components/health-check/health-check.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ApiCheck } from '../../react-services/wz-api-check';
import { WzRequest } from '../../react-services/wz-request';
import { SavedObject } from '../../react-services/saved-objects';
import { ErrorHandler } from '../../react-services/error-handler';
import { WAZUH_MONITORING_PATTERN } from '../../../util/constants';
import { WAZUH_MONITORING_PATTERN } from '../../../common/constants';
import { checkKibanaSettings, checkKibanaSettingsTimeFilter } from './lib';

export class HealthCheck extends Component {
Expand Down
2 changes: 1 addition & 1 deletion public/components/health-check/lib/check-time-filter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AxiosResponse } from 'axios';
import { GenericRequest } from '../../../react-services';
import { WAZUH_TIME_FILTER_DEFAULT } from '../../../../util/constants'
import { WAZUH_TIME_FILTER_DEFAULT } from '../../../../common/constants'
import { getDataPlugin } from '../../../kibana-services';

type userValue<T> = { userValue: T }
Expand Down
10 changes: 5 additions & 5 deletions public/components/overview/compliance-table/compliance-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { I18nProvider } from '@kbn/i18n/react';
import { ComplianceRequirements } from './components/requirements';
import { ComplianceSubrequirements } from './components/subrequirements';
import { getElasticAlerts, getIndexPattern, IFilterParams } from '../mitre/lib';
import { pciRequirementsFile } from '../../../../server/integration-files/pci-requirements';
import { gdprRequirementsFile } from '../../../../server/integration-files/gdpr-requirements';
import { hipaaRequirementsFile } from '../../../../server/integration-files/hipaa-requirements';
import { nistRequirementsFile } from '../../../../server/integration-files/nist-requirements';
import { tscRequirementsFile } from '../../../../server/integration-files/tsc-requirements';
import { pciRequirementsFile } from '../../../../common/compliance-requirements/pci-requirements';
import { gdprRequirementsFile } from '../../../../common/compliance-requirements/gdpr-requirements';
import { hipaaRequirementsFile } from '../../../../common/compliance-requirements/hipaa-requirements';
import { nistRequirementsFile } from '../../../../common/compliance-requirements/nist-requirements';
import { tscRequirementsFile } from '../../../../common/compliance-requirements/tsc-requirements';
import { KbnSearchBar } from '../../kbn-search-bar';
import { getDataPlugin } from '../../../kibana-services';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
import { AppNavigate } from '../../../../../react-services/app-navigate';
import { AppState } from '../../../../../react-services/app-state';
import { RequirementFlyout } from '../requirement-flyout/requirement-flyout'
import { WAZUH_ALERTS_PATTERN } from '../../../../../../util/constants';
import { WAZUH_ALERTS_PATTERN } from '../../../../../../common/constants';
import { getDataPlugin } from '../../../../../kibana-services';

export class ComplianceSubrequirements extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { mitreTechniques, getElasticAlerts, IFilterParams } from '../../lib'
import { ITactic } from '../../';
import { withWindowSize } from '../../../../../components/common/hocs/withWindowSize';
import { WzRequest } from '../../../../../react-services/wz-request';
import {WAZUH_ALERTS_PATTERN} from '../../../../../../util/constants';
import {WAZUH_ALERTS_PATTERN} from '../../../../../../common/constants';
import { AppState } from '../../../../../react-services/app-state';
import { WzFieldSearchDelay } from '../../../../common/search'
import { getDataPlugin } from '../../../../../kibana-services';
Expand Down
2 changes: 1 addition & 1 deletion public/components/overview/mitre/lib/elastic-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function getElasticAlerts(indexPattern, filterParams:IFilterParams,
}
const searchResponse: IWzResponse = await GenericRequest.request(
'POST',
'/elastic/esAlerts',
'/elastic/alerts',
search
);
return searchResponse;
Expand Down
2 changes: 1 addition & 1 deletion public/components/security/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Policies } from './policies/policies';
import { RolesMapping } from './roles-mapping/roles-mapping';
import { withReduxProvider, withGlobalBreadcrumb, withUserAuthorizationPrompt } from '../common/hocs';
import { compose } from 'redux';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../util/constants';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../common/constants';
import { updateSecuritySection } from '../../redux/actions/securityActions';

const tabs = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
decodeJsonRule,
getSelectedUsersFromRules,
} from '../helpers/rule-editor.helper';
import { WAZUH_SECURITY_PLUGIN_OPEN_DISTRO_FOR_ELASTICSEARCH } from '../../../../../util/constants';
import { WAZUH_SECURITY_PLUGIN_OPEN_DISTRO_FOR_ELASTICSEARCH } from '../../../../../common/constants';
import 'brace/mode/json';
import 'brace/snippets/json';
import 'brace/ext/language_tools';
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 @@ -31,7 +31,7 @@ import store from '../../../redux/store'
import { updateSelectedSettingsSection } from '../../../redux/actions/appStateActions';
import { withUserAuthorizationPrompt } from '../../common/hocs/withUserAuthorization'
import { EuiSpacer } from '@elastic/eui';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../../util/constants';
import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../../common/constants';

export type ISetting = {
setting: string
Expand Down
Loading