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 TSC #6517

Draft
wants to merge 16 commits into
base: 4.9.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions plugins/main/common/constants.ts
Expand Up @@ -227,6 +227,7 @@ export const DATA_SOURCE_FILTER_CONTROLLED_PINNED_AGENT = 'pinned-agent';
export const DATA_SOURCE_FILTER_CONTROLLED_CLUSTER_MANAGER = 'cluster-manager';
export const DATA_SOURCE_FILTER_CONTROLLED_VULNERABILITIES_RULE_GROUP =
'vulnerabilities-rule-group';
export const DATA_SOURCE_FILTER_CONTROLLED_TSC_EXIST = 'tsc-rule-exist';
export const DATA_SOURCE_FILTER_CONTROLLED_MITRE_ATTACK_RULE =
'mitre-attack-rule';
export const DATA_SOURCE_FILTER_CONTROLLED_MITRE_ATTACK_RULE_ID =
Expand Down
@@ -0,0 +1,42 @@
import { tFilter } from '../../../index';
import { DATA_SOURCE_FILTER_CONTROLLED_TSC_EXIST } from '../../../../../../../common/constants';
import { AlertsDataSource } from '../alerts-data-source';

const KEY_EXIST = 'rule.tsc';

export class AlertsTSCDataSource 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_TSC_EXIST,
},
exists: {
field: KEY_EXIST,
},
$state: {
store: 'appState',
},
} as tFilter,
];
}

getFixedFilters(): tFilter[] {
return [...this.getFilterExist(), ...super.getFixedFilters()];
}
}
@@ -0,0 +1 @@
export * from './alerts-tsc-data-souce';
Expand Up @@ -3,6 +3,7 @@ export * from './alerts-data-source-repository';
export * from './alerts-data-source';
export * from './alerts-malware-detection';
export * from './alerts-aws';
export * from './alerts-tsc';
export * from './vulnerabilities';
export * from './mitre-attack';
export * from './virustotal';
Expand Up @@ -48,6 +48,7 @@ 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 { DashboardTSC } from '../../overview/tsc/dashboards/dashboard';
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';
Expand All @@ -58,6 +59,7 @@ import {
VirusTotalDataSource,
AlertsMalwareDetectionDataSource,
AlertsFIMDataSource,
AlertsTSCDataSource,
} from '../data-source';

const ALERTS_INDEX_PATTERN = 'wazuh-alerts-*';
Expand Down Expand Up @@ -339,7 +341,26 @@ export const ModulesDefaults = {
},
tsc: {
init: 'dashboard',
tabs: RegulatoryComplianceTabs(tscColumns),
tabs: [
{
id: 'dashboard',
name: 'Dashboard',
buttons: [ButtonModuleExploreAgent, ButtonModuleGenerateReport],
component: DashboardTSC,
},
{
id: 'inventory',
name: 'Controls',
buttons: [ButtonModuleExploreAgent],
component: props => (
<ComplianceTable {...props} DataSource={AlertsTSCDataSource} />
),
},
renderDiscoverTab({
tableColumns: tscColumns,
DataSource: AlertsTSCDataSource,
}),
],
availableFor: ['manager', 'agent'],
},
syscollector: {
Expand Down