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

Add vulnerability detection card in agent overview #7085

Merged
merged 26 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
75834f8
Add top packages component
Machi3mfl Oct 8, 2024
d349655
Add vuls severity stat component
Machi3mfl Oct 8, 2024
34dd61a
Create vuls panel
Machi3mfl Oct 8, 2024
58d531c
Add vuls panel in agent overview
Machi3mfl Oct 8, 2024
646c8db
Update CHANGELOG
Machi3mfl Oct 8, 2024
6a6875b
Apply prettier
Machi3mfl Oct 8, 2024
5a19ea0
Fix responsive behavior
Machi3mfl Oct 9, 2024
15990ce
Apply prettier
Machi3mfl Oct 9, 2024
5a4b673
Merge branch '4.10.0' into enhancement/7058-vuls-card-agent-overview
chantal-kelm Oct 14, 2024
5c0bc48
Change vuls panel style
Machi3mfl Oct 18, 2024
0d30f2b
Use vuls data source in agent overview panel
Machi3mfl Oct 18, 2024
15d49c2
Move vuls panel
Machi3mfl Oct 18, 2024
f71c071
Change redirect in hoc
Machi3mfl Oct 18, 2024
c918521
Remove unnecessary redirect
Machi3mfl Oct 18, 2024
59fa115
Add HOC to create pattern if not exist
Machi3mfl Oct 18, 2024
31a6d4e
Apply prettier
Machi3mfl Oct 18, 2024
0d08058
Merge branch '4.10.0' into enhancement/7058-vuls-card-agent-overview
Machi3mfl Oct 18, 2024
6849e0b
Merge branch '4.10.0' into enhancement/7058-vuls-card-agent-overview
Machi3mfl Oct 28, 2024
f9c69ac
Remove unused imports
Machi3mfl Oct 28, 2024
0842888
Remove unused imports
Machi3mfl Oct 28, 2024
fc6f177
Remove unused code
Machi3mfl Oct 28, 2024
d3e789e
Apply prettier
Machi3mfl Oct 28, 2024
fab2744
Merge branch '4.10.0' into enhancement/7058-vuls-card-agent-overview
Machi3mfl Oct 29, 2024
703bc92
Resolve conflicts in agents-welcome
Machi3mfl Oct 29, 2024
dc7745e
Change agents management menu icon
Machi3mfl Oct 29, 2024
f3aec81
Merge branch '4.10.0' into enhancement/7058-vuls-card-agent-overview
asteriscos Oct 29, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Support for Wazuh 4.10.0
- Added sample data for YARA [#6964](https://github.com/wazuh/wazuh-dashboard-plugins/issues/6964)
- Added a custom filter and visualization for vulnerability.under_evaluation field [#6968](https://github.com/wazuh/wazuh-dashboard-plugins/issues/6968) [#7044](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7044) [#7046](https://github.com/wazuh/wazuh-dashboard-plugins/issues/7046)
- Add vulnerabilities card to agent details page [#7058](https://github.com/wazuh/wazuh-dashboard-plugins/issues/7058)
- Added an "Agents management" menu and moved the sections: "Endpoint Groups" and "Endpoint Summary" which changed its name to "Summary".[#7112](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7112)
- Added ability to filter from File Integrity Monitoring registry inventory [#7119](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7119)
- Added new field columns and ability to select the visible fields in the File Integrity Monitoring Files and Registry tables [#7119](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7119)
Expand Down
134 changes: 56 additions & 78 deletions plugins/main/public/components/common/welcome/agents-welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { EventsCount } from './dashboard/events-count';
import { IntlProvider } from 'react-intl';
import { ButtonExploreAgent } from '../../wz-agent-selector/button-explore-agent';
import NavigationService from '../../../react-services/navigation-service';
import VulsPanel from './components/vuls_panel/vuls_welcome_panel';
import { AgentTabs } from '../../endpoints-summary/agent/agent-tabs';

export const AgentsWelcome = compose(
Expand Down Expand Up @@ -391,8 +392,8 @@ export const AgentsWelcome = compose(
renderMitrePanel() {
return (
<Fragment>
<EuiPanel paddingSize='m' height={{ height: 300 }}>
<EuiFlexGroup gutterSize='s'>
<EuiPanel paddingSize='m'>
<EuiFlexGroup gutterSize='s' responsive={false}>
<EuiFlexItem>
<h2 className='embPanel__title wz-headline-title'>
<EuiText size='xs'>
Expand Down Expand Up @@ -452,96 +453,73 @@ export const AgentsWelcome = compose(

render() {
const title = this.renderTitle();
const responsiveGroupDirection =
this.state.widthWindow < 1150 ? 'column' : 'row';

return (
<IntlProvider locale='en'>
<div className='wz-module wz-module-welcome'>
<div className='wz-module-header-agent-wrapper'>
<div className='wz-module-header-agent-main'>{title}</div>
</div>
<EuiPage>
<EuiPageBody component='div'>
<div className='wz-module-header-nav'>
<div className='wz-module-agents-padding-responsive'>
<EuiPage>
<EuiPageBody component='div'>
<AgentInfo
agent={this.props.agent}
isCondensed={false}
hideActions={true}
{...this.props}
></AgentInfo>
</div>
<EuiFlexGroup>
<EuiFlexItem />
<EuiFlexItem
style={{
alignItems: 'flex-end',
marginTop: 10,
marginBottom: 10,
}}
>
{' '}
{/* TODO: Replace with SearchBar and replace implementation to get the time range in AgentView component*/}
<WzDatePicker condensed={true} onTimeChange={() => {}} />
</EuiFlexItem>
</EuiFlexGroup>
{(this.state.widthWindow < 1150 && (
<Fragment>
<EuiFlexGroup wrap>
<EuiFlexItem
key={'Wazuh-App-Agents-Welcome-MITRE-Top-Tactics'}
>
{this.renderMitrePanel()}
</EuiFlexItem>
{this.renderCompliancePanel()}
</EuiFlexGroup>
<EuiSpacer size='m' />
<EuiFlexGroup>
<FimEventsTable agent={this.props.agent} />
</EuiFlexGroup>
<EuiSpacer size='m' />
<EuiFlexGroup>
<EuiFlexItem
key={'Wazuh-App-Agents-Welcome-Events-Evolution'}
>
{' '}
{/* Events count evolution */}
{this.renderEventCountVisualization()}
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size='m' />
<EuiFlexGroup>
<EuiFlexItem>{this.renderSCALastScan()}</EuiFlexItem>
</EuiFlexGroup>
</Fragment>
)) || (
<Fragment>
<EuiFlexGroup>
<EuiFlexItem>
<EuiFlexGroup>
<EuiFlexItem
key={'Wazuh-App-Agents-Welcome-MITRE-Top-Tactics'}
>
{this.renderMitrePanel()}
</EuiFlexItem>
<EuiFlexGroup>
<EuiFlexItem />
<EuiFlexItem
style={{
alignItems: 'flex-end',
marginTop: 10,
marginBottom: 10,
}}
>
{' '}
{/* TODO: Replace with SearchBar and replace implementation to get the time range in AgentView component*/}
<WzDatePicker condensed={true} onTimeChange={() => {}} />
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup direction={responsiveGroupDirection}>
<EuiFlexItem
key={'Wazuh-App-Agents-Welcome-Events-Evolution'}
grow={3}
>
{this.renderEventCountVisualization()}
</EuiFlexItem>
<EuiFlexItem grow={3}>
<EuiFlexGroup>
<EuiFlexItem
key={'Wazuh-App-Agents-Welcome-MITRE-Top-Tactics'}
grow={3}
>
{this.renderMitrePanel()}
</EuiFlexItem>
<EuiFlexItem grow={3}>
{this.renderCompliancePanel()}
</EuiFlexGroup>
</EuiFlexItem>
<FimEventsTable agent={this.props.agent} />
</EuiFlexGroup>
<EuiSpacer size='l' />
<EuiFlexGroup>
<EuiFlexItem
key={'Wazuh-App-Agents-Welcome-Events-Evolution'}
>
{' '}
{/* Events count evolution */}
{this.renderEventCountVisualization()}
</EuiFlexItem>
<EuiFlexItem>{this.renderSCALastScan()}</EuiFlexItem>
</EuiFlexGroup>
</Fragment>
)}
</EuiPageBody>
</EuiPage>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size='l' />
<EuiFlexGroup direction={responsiveGroupDirection}>
<EuiFlexItem>
<VulsPanel agent={this.props.agent} />
</EuiFlexItem>
<EuiFlexItem>{this.renderSCALastScan()}</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size='l' />
<EuiFlexGroup>
<FimEventsTable agent={this.props.agent} />
</EuiFlexGroup>
</EuiPageBody>
</EuiPage>
</div>
</div>
</IntlProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function FimEventsTable({ agent }) {
<EuiFlexItem>
<EuiPanel paddingSize='m'>
<EuiFlexItem>
<EuiFlexGroup>
<EuiFlexGroup responsive={false}>
<EuiFlexItem>
<EuiText size='xs'>
<h2>FIM: Recent events</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export { FimEventsTable, useTimeFilter } from './fim_events_table';
export { ScaScan } from './sca_scan';
export { MitreTopTactics } from './mitre_top';
export { RequirementVis } from './requirement_vis';
export { VulsTopPackageTable } from './top_packages_table';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Wazuh app - React component building the welcome screen of an agent.
* version, OS, registration date, last keep alive.
*
* Copyright (C) 2015-2022 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/

export { VulsTopPackageTable, useTimeFilter } from './top_packages_table';
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Wazuh app - React component building the welcome screen of an agent.
* version, OS, registration date, last keep alive.
*
* Copyright (C) 2015-2022 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/

import React, { useState, useEffect } from 'react';
import {
EuiBasicTable,
EuiFlexItem,
EuiPanel,
EuiSpacer,
EuiText,
EuiFlexGroup,
} from '@elastic/eui';
// @ts-ignore
import { getDataPlugin } from '../../../../../kibana-services';
import { vulnerabilityDetection } from '../../../../../utils/applications';
import {
PatternDataSourceFilterManager,
FILTER_OPERATOR,
} from '../../../data-source';
import { WzLink } from '../../../../../components/wz-link/wz-link';

export function VulsTopPackageTable({ agentId, items, indexPatternId }) {
const [sort, setSort] = useState({
field: 'doc_count',
direction: 'desc',
});

const columns = [
{
field: 'key',
name: 'Package',
sortable: true,
render: field => (
<WzLink
appId={vulnerabilityDetection.id}
path={`/overview?tab=vuls&tabView=dashboard&agentId=${agentId}&_g=${PatternDataSourceFilterManager.filtersToURLFormat(
[
PatternDataSourceFilterManager.createFilter(
FILTER_OPERATOR.IS,
`package.name`,
field,
indexPatternId,
),
],
)}`}
>
{field}
</WzLink>
),
},
{
field: 'doc_count',
name: 'Count',
sortable: true,
truncateText: true,
width: '100px',
},
];

return (
<EuiPanel paddingSize='s'>
<EuiFlexGroup>
<EuiFlexItem>
<EuiText size='xs'>
<h2>Top 5 Packages</h2>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size='s' />
<EuiBasicTable
items={items}
columns={columns}
loading={false}
sorting={{ sort }}
onChange={e => setSort(e.sort)}
itemId='top-packages-table'
noItemsMessage='No recent events'
/>
</EuiPanel>
);
}
Loading
Loading