Skip to content

Commit fc8dd0c

Browse files
committed
Fix #1176 : deduplication: remove date from the comparison as GUI imported scans have a different date than scan imported by APIv1
1 parent c333428 commit fc8dd0c

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

dojo/utils.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,33 +90,39 @@ def sync_dedupe(new_finding, *args, **kwargs):
9090
test__engagement=new_finding.test.engagement,
9191
cwe=new_finding.cwe,
9292
static_finding=new_finding.static_finding,
93-
dynamic_finding=new_finding.dynamic_finding,
94-
date__lte=new_finding.date).exclude(id=new_finding.id).exclude(
95-
cwe=0).exclude(duplicate=True)
93+
dynamic_finding=new_finding.dynamic_finding
94+
).exclude(id=new_finding.id
95+
).exclude(cwe=0
96+
).exclude(duplicate=True)
9697
eng_findings_title = Finding.objects.filter(
9798
test__engagement=new_finding.test.engagement,
9899
title=new_finding.title,
99100
static_finding=new_finding.static_finding,
100-
dynamic_finding=new_finding.dynamic_finding,
101-
date__lte=new_finding.date).exclude(id=new_finding.id).exclude(
102-
duplicate=True)
101+
dynamic_finding=new_finding.dynamic_finding
102+
).exclude(id=new_finding.id
103+
).exclude(duplicate=True)
103104
else:
104105
eng_findings_cwe = Finding.objects.filter(
105106
test__engagement__product=new_finding.test.engagement.product,
106107
cwe=new_finding.cwe,
107108
static_finding=new_finding.static_finding,
108-
dynamic_finding=new_finding.dynamic_finding,
109-
date__lte=new_finding.date).exclude(id=new_finding.id).exclude(
110-
cwe=0).exclude(duplicate=True)
109+
dynamic_finding=new_finding.dynamic_finding
110+
).exclude(id=new_finding.id
111+
).exclude(cwe=0
112+
).exclude(duplicate=True)
111113
eng_findings_title = Finding.objects.filter(
112114
test__engagement__product=new_finding.test.engagement.product,
113115
title=new_finding.title,
114116
static_finding=new_finding.static_finding,
115-
dynamic_finding=new_finding.dynamic_finding,
116-
date__lte=new_finding.date).exclude(id=new_finding.id).exclude(
117-
duplicate=True)
117+
dynamic_finding=new_finding.dynamic_finding
118+
).exclude(id=new_finding.id
119+
).exclude(duplicate=True)
118120

119121
total_findings = eng_findings_cwe | eng_findings_title
122+
deduplicationLogger.debug("Found " +
123+
str(len(eng_findings_cwe)) + " findings with same cwe, " +
124+
str(len(eng_findings_title)) + " findings with same title: " +
125+
str(len(total_findings)) + " findings with either same title or same cwe")
120126
# total_findings = total_findings.order_by('date')
121127

122128
for find in total_findings:

0 commit comments

Comments
 (0)