Skip to content

Commit be00200

Browse files
add more logging is_older, dedupe_eng_mismatch
1 parent 934cdba commit be00200

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

dojo/finding/deduplication.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,11 @@ def set_duplicate_reopen(new_finding, existing_finding):
130130

131131
def is_deduplication_on_engagement_mismatch(new_finding, to_duplicate_finding):
132132
if new_finding.test.engagement != to_duplicate_finding.test.engagement:
133-
return (
134-
new_finding.test.engagement.deduplication_on_engagement
133+
deduplication_mismatch = new_finding.test.engagement.deduplication_on_engagement \
135134
or to_duplicate_finding.test.engagement.deduplication_on_engagement
136-
)
135+
if deduplication_mismatch:
136+
deduplicationLogger.debug(f"deduplication_mismatch: {deduplication_mismatch} for new_finding {new_finding.id} and to_duplicate_finding {to_duplicate_finding.id} with test.engagement {new_finding.test.engagement.id} and {to_duplicate_finding.test.engagement.id}")
137+
return deduplication_mismatch
137138
return False
138139

139140

@@ -170,6 +171,8 @@ def are_endpoints_duplicates(new_finding, to_duplicate_finding):
170171
for l2 in list2:
171172
if are_urls_equal(l1, l2, fields):
172173
return True
174+
175+
deduplicationLogger.debug(f"endpoints are not duplicates: {new_finding.id} and {to_duplicate_finding.id}")
173176
return False
174177

175178

@@ -311,7 +314,10 @@ def find_candidates_for_deduplication_legacy(test, findings):
311314

312315
def _is_candidate_older(new_finding, candidate):
313316
# Ensure the newer finding is marked as duplicate of the older finding
314-
return candidate.id < new_finding.id
317+
is_older = candidate.id < new_finding.id
318+
if not is_older:
319+
deduplicationLogger.debug(f"candidate is newer than new finding: {new_finding.id} and candidate {candidate.id}")
320+
return is_older
315321

316322

317323
def match_hash_candidate(new_finding, candidates_by_hash):

0 commit comments

Comments
 (0)