Skip to content

Commit cb01b7d

Browse files
💄 Update Wazuh v4.8 (#13184)
* 💄 Update Wazuh v4.8 * ruff * update * update * Update dojo/tools/wazuh/v4_8.py Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> --------- Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
1 parent c45aa56 commit cb01b7d

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

dojo/tools/wazuh/v4_8.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import hashlib
2-
31
from dojo.models import Finding
42

53

@@ -11,29 +9,26 @@ def parse_findings(self, test, data):
119
item = item_source.get("_source")
1210
vuln = item.get("vulnerability")
1311
cve = vuln.get("id")
12+
13+
# Construct a unique key for deduplication
14+
dupe_key = f"{cve}-{item.get('agent', {}).get('id')}"
15+
16+
if dupe_key in dupes:
17+
continue # Skip if this finding has already been processed
18+
1419
description = vuln.get("description")
1520
description += "\nAgent id:" + item.get("agent").get("id")
1621
description += "\nAgent name:" + item.get("agent").get("name")
1722
severity = vuln.get("severity")
1823
cvssv3_score = vuln.get("score").get("base")
1924
publish_date = vuln.get("published_at").split("T")[0]
20-
agent_id = item.get("agent").get("id")
2125
detection_time = vuln.get("detected_at").split("T")[0]
22-
2326
references = vuln.get("reference")
2427

2528
title = (
2629
cve + " affects (version: " + item.get("package").get("version") + ")"
2730
)
2831

29-
dupe_key = title + agent_id + description
30-
dupe_key = hashlib.sha256(dupe_key.encode("utf-8")).hexdigest()
31-
32-
if dupe_key in dupes:
33-
find = dupes[dupe_key]
34-
else:
35-
dupes[dupe_key] = True
36-
3732
find = Finding(
3833
title=title,
3934
test=test,
@@ -48,6 +43,7 @@ def parse_findings(self, test, data):
4843
unique_id_from_tool=dupe_key,
4944
date=detection_time,
5045
)
51-
find.unsaved_vulnerability_ids = cve
46+
find.unsaved_vulnerability_ids = [cve]
5247
dupes[dupe_key] = find
48+
5349
return list(dupes.values())

0 commit comments

Comments
 (0)