Skip to content

Commit

Permalink
Changed inventory vulnerabilities references to links (#6960)
Browse files Browse the repository at this point in the history
* Added links to vulnerability reference

* Added Changelog

* Change render

* Add rel to EuiLink

* Bump Wazuh 4.9.2 rev 00 (#6971)

* Bump version to 4.9.2

* Fix changelog

* Add withespace to split

* Added to script multiples links

* Clean 4.9.2 branch

* Update changelog

---------

Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Co-authored-by: Antonio <34042064+Desvelao@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent 5f1b817 commit 1520c8e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Change the text of the query limit tooltip [#6981](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6981)
- Upgraded the `axios` dependency to `1.7.4` [#6919](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6919)
- Improved MITRE ATT&CK intelligence flyout details readability [#6954](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6954)
- Changed vulnerabilities.reference to links in Vulnerability Detection > Inventory columns [#6960](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6960)

## Wazuh v4.9.0 - OpenSearch Dashboards 2.13.0 - Revision 07

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { EuiText } from '@elastic/eui';
import { EuiText, EuiLink, EuiToolTip } from '@elastic/eui';
import { tDataGridRenderColumn } from '../data-grid';
import {
endpointSummary,
Expand Down Expand Up @@ -79,6 +79,36 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [
);
},
},
{
id: 'vulnerability.reference',
render: value => {
const links = (
<>
{/* We separated the reference value since it is a string separated by
commas, causing an issue when returning 2 links. */}
{value?.split(', ').map((link, index) => (
<span key={index}>
{!!index && ', '}
<EuiToolTip
position='top'
content='Navigate to the vulnerability reference'
>
<EuiLink
href={link}
target='_blank'
rel='noopener noreferrer'
external
>
{link}
</EuiLink>
</EuiToolTip>
</span>
))}
</>
);
return links;
},
},
{
id: 'rule.id',
render: value => (
Expand Down
10 changes: 9 additions & 1 deletion scripts/vulnerabilities-events-injector/dataInjectScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,22 @@ def generateRandomTags():
tags.append('tag{}'.format(random.randint(0, 99)))
return(tags)

#Sometimes vulnerability.reference contains 2 links; this function mocks it.
def generateRandomReference(vulnerability_id):
reference = 'https://mycve.test.org/cgi-bin/cvename.cgi?name={}'.format(vulnerability_id)
if random.choice([True, False]):
return '{0}, {0}'.format(reference)
else:
return reference

def generateRandomVulnerability():
vulnerability = {}
vulnerability['category'] = random.choice(['security','config','os','package','custom'])
vulnerability['classification'] = 'classification{}'.format(random.randint(0, 9999))
vulnerability['description'] = 'description{}'.format(random.randint(0, 9999))
vulnerability['enumeration'] = 'CVE'
vulnerability['id'] = 'CVE-{}'.format(random.randint(0, 9999))
vulnerability['reference'] = 'https://mycve.test.org/cgi-bin/cvename.cgi?name={}'.format(vulnerability['id'])
vulnerability['reference'] = generateRandomReference(vulnerability['id'])
vulnerability['report_id'] = 'report-{}'.format(random.randint(0, 9999))
vulnerability['scanner'] = {'vendor':'vendor-{}'.format(random.randint(0, 9))}
vulnerability['score'] = {'base':round(random.uniform(0, 10),1), 'environmental':round(random.uniform(0, 10),1), 'temporal':round(random.uniform(0, 10),1),'version':'{}'.format(round(random.uniform(0, 10),1))}
Expand Down

0 comments on commit 1520c8e

Please sign in to comment.