Skip to content

Commit 350d755

Browse files
committed
Similar Findings: Restrict to Product Scope
1 parent 8a47310 commit 350d755

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

dojo/finding/views.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ def get_similar_findings(self, request: HttpRequest, finding: Finding):
539539
finding_filter_class = SimilarFindingFilterWithoutObjectLookups if filter_string_matching else SimilarFindingFilter
540540
similar_findings_filter = finding_filter_class(
541541
request.GET,
542-
queryset=get_authorized_findings(Permissions.Finding_View),
542+
queryset=get_authorized_findings(Permissions.Finding_View)
543+
.filter(test__engagement__product=finding.test.engagement.product)
544+
.exclude(id=finding.id),
543545
user=request.user,
544546
finding=finding,
545547
)
@@ -3027,7 +3029,10 @@ def get_missing_mandatory_notetypes(finding):
30273029
def mark_finding_duplicate(request, original_id, duplicate_id):
30283030

30293031
original = get_object_or_404(Finding, id=original_id)
3030-
duplicate = get_object_or_404(Finding, id=duplicate_id)
3032+
duplicate = get_object_or_404(
3033+
Finding.objects.filter(test__engagement__product=original.test.engagement.product),
3034+
id=duplicate_id,
3035+
)
30313036

30323037
if original.test.engagement != duplicate.test.engagement:
30333038
if (original.test.engagement.deduplication_on_engagement
@@ -3112,7 +3117,10 @@ def reset_finding_duplicate_status(request, duplicate_id):
31123117

31133118
def set_finding_as_original_internal(user, finding_id, new_original_id):
31143119
finding = get_object_or_404(Finding, id=finding_id)
3115-
new_original = get_object_or_404(Finding, id=new_original_id)
3120+
new_original = get_object_or_404(
3121+
Finding.objects.filter(test__engagement__product=finding.test.engagement.product),
3122+
id=new_original_id,
3123+
)
31163124

31173125
if finding.test.engagement != new_original.test.engagement:
31183126
if (finding.test.engagement.deduplication_on_engagement

dojo/templates/dojo/finding_related_list.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<th>Status</th>
1313
<th>Test</th>
1414
<th>Engagement</th>
15-
<th>Product</th>
1615
<th>CWE</th>
1716
<th>Vulnerability Id</th>
1817
<th>EPSS Score</th>

dojo/templates/dojo/finding_related_row.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
</sup>
4141
{% endif %}
4242
</td>
43-
<td><a href="{% url 'view_product' similar_finding.test.engagement.product.id %}">{{ similar_finding.test.engagement.product.name }}</a>
4443
<td>
4544
{% if similar_finding.cwe > 0 %}
4645
<a target="_blank" href="{{ similar_finding.cwe|cwe_url }}">

dojo/templates/dojo/view_finding.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,7 @@ <h4 class="has-filters">Similar Findings ({{ similar_findings.paginator.count }}
728728
<i class="fa-solid fa-circle-question has-popover" data-trigger="hover"
729729
data-content="Opening this panel shows findings that are not exact duplicates,
730730
but have similar values for Vulnerability Id, CWE, file_path, line number, unique_id_from_tool.
731-
It has a filter panel where filtering can be made less or more strict, and across
732-
product boundaries. The resulting findings can be view, marked as duplicate or original.
731+
It has a filter panel where filtering can be made less or more strict. The resulting findings can be view, marked as duplicate or original.
733732
Clear filters will empty all filters. Restart will start over by matching against the fields
734733
mentioned above."
735734
data-placement="bottom" data-container="body">

0 commit comments

Comments
 (0)