File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2121,6 +2121,11 @@ def get_missing_mandatory_notetypes(finding):
2121
2121
def mark_finding_duplicate (request , original_id , duplicate_id ):
2122
2122
original = get_object_or_404 (Finding , id = original_id )
2123
2123
duplicate = get_object_or_404 (Finding , id = duplicate_id )
2124
+
2125
+ if original .test .engagement != duplicate .test .engagement :
2126
+ if original .test .engagement .deduplication_on_engagement or duplicate .test .engagement .deduplication_on_engagement :
2127
+ raise ValueError ('Marking finding {} as duplicate of {} failed as they are not in the same engagement and deduplication_on_engagement is enabled for at least one of them' )
2128
+
2124
2129
duplicate .duplicate = True
2125
2130
duplicate .active = False
2126
2131
duplicate .verified = False
Original file line number Diff line number Diff line change @@ -1326,7 +1326,13 @@ class Meta:
1326
1326
1327
1327
@property
1328
1328
def similar_findings (self ):
1329
- filtered = Finding .objects .filter (test__engagement__product = self .test .engagement .product )
1329
+ filtered = Finding .objects .all ()
1330
+
1331
+ if self .test .engagement .deduplication_on_engagement :
1332
+ filtered = filtered .filter (test__engagement = self .test .engagement )
1333
+ else :
1334
+ filtered = filtered .filter (test__engagement__product = self .test .engagement .product )
1335
+
1330
1336
if self .cve :
1331
1337
filtered = filtered .filter (cve = self .cve )
1332
1338
if self .cwe :
@@ -1335,6 +1341,7 @@ def similar_findings(self):
1335
1341
filtered = filtered .filter (file_path = self .file_path )
1336
1342
if self .line :
1337
1343
filtered = filtered .filter (line = self .line )
1344
+
1338
1345
return filtered .exclude (pk = self .pk )[:10 ]
1339
1346
1340
1347
def compute_hash_code (self ):
You can’t perform that action at this time.
0 commit comments