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

Implement embeddable dashboard on GDPR #6506

Open
wants to merge 19 commits into
base: 4.9.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ff83888
feat(GDPR): replace the dashboard on GDPR application
Desvelao Mar 13, 2024
0fff07f
fix: fix ids dashboards panels
Desvelao Mar 14, 2024
968104d
rename(gdpr): rename dashboard files
Desvelao Mar 14, 2024
f0c7f8a
fix(gdpr): add id to visualizations
Desvelao Mar 14, 2024
21d6df6
fix(gdpr): fix import of styles in the loading component
Desvelao Mar 14, 2024
477b96f
fix(gdpr): fix dashboards
Desvelao Mar 15, 2024
a1708ef
Merge branch '4.9.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao Apr 11, 2024
13e4d55
feat(gdpr): use data source on Dashboard and Events tabs
Desvelao Apr 11, 2024
cbfa268
fix(gdpr): remove comment
Desvelao Apr 15, 2024
c6b89e6
fix(gdpr): add date range to Dashboard query
Desvelao Apr 15, 2024
889b51d
remove(gdpr): visualizations on server side
Desvelao Apr 15, 2024
83566f3
Merge branch '4.9.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao May 3, 2024
23e511e
feat(gdpr): hide filter control on the search bar of controls
Desvelao May 3, 2024
ad4416e
feat(gdpr): move sample data warning on the dashboard
Desvelao May 3, 2024
15b621f
Merge branch '4.9.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao May 8, 2024
91f2c57
fix: repeated request on WazuhFlyoutDiscover
Desvelao May 8, 2024
1198d3f
Merge branch '4.9.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao May 8, 2024
8b85f1c
changelog: add pull request entry
Desvelao May 8, 2024
fb09beb
Merge branch '4.9.0' of https://github.com/wazuh/wazuh-kibana-app int…
Desvelao May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -18,7 +18,7 @@ All notable changes to the Wazuh app project will be documented in this file.

### Changed

- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649)
- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506)
- Develop logic of a new index for the fim module [#6227](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6227)
- Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250)
- Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573)
Expand Down
1 change: 1 addition & 0 deletions plugins/main/common/constants.ts
Expand Up @@ -230,6 +230,7 @@ export const DATA_SOURCE_FILTER_CONTROLLED_REGULATORY_COMPLIANCE_REQUIREMENT =
export const DATA_SOURCE_FILTER_CONTROLLED_PCI_DSS_EXIST = 'pci-dss-exist';
export const DATA_SOURCE_FILTER_CONTROLLED_VULNERABILITIES_RULE_GROUP =
'vulnerabilities-rule-group';
export const DATA_SOURCE_FILTER_CONTROLLED_GDPR_EXIST = 'gdpr-rule-exist';
export const DATA_SOURCE_FILTER_CONTROLLED_DOCKER_RULE_GROUP =
'docker-rule-group';
export const DATA_SOURCE_FILTER_CONTROLLED_MITRE_ATTACK_RULE =
Expand Down
@@ -0,0 +1,42 @@
import { tFilter } from '../../../index';
import { DATA_SOURCE_FILTER_CONTROLLED_GDPR_EXIST } from '../../../../../../../common/constants';
import { AlertsDataSource } from '../alerts-data-source';

const KEY_EXIST = 'rule.gdpr';

export class AlertsGDPRDataSource extends AlertsDataSource {
constructor(id: string, title: string) {
super(id, title);
}

private getFilterExist() {
return [
{
meta: {
index: this.id,
negate: false,
disabled: false,
alias: null,
type: 'exists',
key: KEY_EXIST,
value: 'exists',
params: {
query: null,
type: 'phrase',
},
controlledBy: DATA_SOURCE_FILTER_CONTROLLED_GDPR_EXIST,
},
exists: {
field: KEY_EXIST,
},
$state: {
store: 'appState',
},
} as tFilter,
];
}

getFixedFilters(): tFilter[] {
return [...this.getFilterExist(), ...super.getFixedFilters()];
}
}
@@ -0,0 +1 @@
export * from './alerts-gdpr-data-source';
Expand Up @@ -9,5 +9,6 @@ export * from './vulnerabilities';
export * from './mitre-attack';
export * from './pci-dss';
export * from './virustotal';
export * from './alerts-gdpr';
export * from './alerts-configuration-assessment';
export * from './alerts-google-cloud';
25 changes: 23 additions & 2 deletions plugins/main/public/components/common/modules/modules-defaults.tsx
Expand Up @@ -49,11 +49,11 @@ import { mitreAttackColumns } from '../../overview/mitre/events/mitre-attack-col
import { virustotalColumns } from '../../overview/virustotal/events/virustotal-columns';
import { malwareDetectionColumns } from '../../overview/malware-detection/events/malware-detection-columns';
import { WAZUH_VULNERABILITIES_PATTERN } from '../../../../common/constants';
import { DashboardGDPR } from '../../overview/gdpr/dashboards/dashboard';
import { DashboardPCIDSS } from '../../overview/pci/dashboards/dashboard';
import { DashboardDocker } from '../../overview/docker/dashboards';
import { DashboardMalwareDetection } from '../../overview/malware-detection/dashboard';
import { DashboardFIM } from '../../overview/fim/dashboard/dashboard';
import { MitreAttackDataSource } from '../data-source/pattern/alerts/mitre-attack/mitre-attack-data-source';
import {
AlertsDockerDataSource,
AlertsDataSource,
Expand All @@ -64,6 +64,8 @@ import {
AlertsGoogleCloudDataSource,
AlertsMalwareDetectionDataSource,
AlertsFIMDataSource,
MitreAttackDataSource,
AlertsGDPRDataSource,
AlertsConfigurationAssessmentDataSource,
} from '../data-source';

Expand Down Expand Up @@ -379,7 +381,26 @@ export const ModulesDefaults = {
},
gdpr: {
init: 'dashboard',
tabs: RegulatoryComplianceTabs(gdprColumns),
tabs: [
{
id: 'dashboard',
name: 'Dashboard',
buttons: [ButtonModuleExploreAgent, ButtonModuleGenerateReport],
component: DashboardGDPR,
},
{
id: 'inventory',
name: 'Controls',
buttons: [ButtonModuleExploreAgent],
component: props => (
<ComplianceTable {...props} DataSource={AlertsGDPRDataSource} />
),
},
renderDiscoverTab({
tableColumns: gdprColumns,
DataSource: AlertsGDPRDataSource,
}),
],
availableFor: ['manager', 'agent'],
},
tsc: {
Expand Down
Expand Up @@ -79,11 +79,10 @@ const WazuhFlyoutDiscoverComponent = (props: WazuhDiscoverProps) => {
: undefined;
// table states
const [pagination, setPagination] = useState<
EuiBasicTableProps<any>['pagination']
Omit<EuiBasicTableProps<any>['pagination'], 'totalItemCount'>
>({
pageIndex: 0,
pageSize: DEFAULT_PAGE_SIZE,
totalItemCount: 0,
});
const [sorting, setSorting] = useState<EuiBasicTableProps<any>['sorting']>({
sort: { field: timeField || '@timestamp', direction: 'desc' },
Expand Down Expand Up @@ -146,13 +145,8 @@ const WazuhFlyoutDiscoverComponent = (props: WazuhDiscoverProps) => {
sorting: parseSorting,
})
.then((response: SearchResponse) => {
const totalHits = response?.hits?.total || 0;
setPagination({
...pagination,
totalItemCount:
totalHits > MAX_ENTRIES_PER_QUERY
? MAX_ENTRIES_PER_QUERY
: totalHits,
});
setResults(response);
})
Expand Down Expand Up @@ -197,7 +191,6 @@ const WazuhFlyoutDiscoverComponent = (props: WazuhDiscoverProps) => {
setPagination({
pageIndex,
pageSize,
totalItemCount: results?.hits?.total || 0,
});
setSorting({ sort: { field, direction: direction as Direction } });
};
Expand Down Expand Up @@ -325,7 +318,13 @@ const WazuhFlyoutDiscoverComponent = (props: WazuhDiscoverProps) => {
itemIdToExpandedRowMap={itemIdToExpandedRowMap}
isExpandable={isExpanded}
columns={getColumns()}
pagination={pagination}
pagination={{
...pagination,
totalItemCount:
(results?.hits?.total ?? 0) > MAX_ENTRIES_PER_QUERY
? MAX_ENTRIES_PER_QUERY
: results?.hits?.total ?? 0,
}}
sorting={sorting}
onChange={onTableChange}
/>
Expand Down