Skip to content

Commit df163f1

Browse files
Similar Findings: Restrict to Product Scope (#13271)
* Similar Findings: Restrict to Product Scope * fix data tables oops * Update dojo/templates/dojo/view_finding.html Co-authored-by: valentijnscholten <valentijnscholten@gmail.com> * Update dojo/templates/dojo/view_finding.html --------- Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
1 parent a434946 commit df163f1

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

dojo/finding/views.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,9 @@ def get_similar_findings(self, request: HttpRequest, finding: Finding):
538538
finding_filter_class = SimilarFindingFilterWithoutObjectLookups if filter_string_matching else SimilarFindingFilter
539539
similar_findings_filter = finding_filter_class(
540540
request.GET,
541-
queryset=get_authorized_findings(Permissions.Finding_View),
541+
queryset=get_authorized_findings(Permissions.Finding_View)
542+
.filter(test__engagement__product=finding.test.engagement.product)
543+
.exclude(id=finding.id),
542544
user=request.user,
543545
finding=finding,
544546
)
@@ -2970,7 +2972,10 @@ def get_missing_mandatory_notetypes(finding):
29702972
def mark_finding_duplicate(request, original_id, duplicate_id):
29712973

29722974
original = get_object_or_404(Finding, id=original_id)
2973-
duplicate = get_object_or_404(Finding, id=duplicate_id)
2975+
duplicate = get_object_or_404(
2976+
Finding.objects.filter(test__engagement__product=original.test.engagement.product),
2977+
id=duplicate_id,
2978+
)
29742979

29752980
if original.test.engagement != duplicate.test.engagement:
29762981
if (original.test.engagement.deduplication_on_engagement
@@ -3055,7 +3060,10 @@ def reset_finding_duplicate_status(request, duplicate_id):
30553060

30563061
def set_finding_as_original_internal(user, finding_id, new_original_id):
30573062
finding = get_object_or_404(Finding, id=finding_id)
3058-
new_original = get_object_or_404(Finding, id=new_original_id)
3063+
new_original = get_object_or_404(
3064+
Finding.objects.filter(test__engagement__product=finding.test.engagement.product),
3065+
id=new_original_id,
3066+
)
30593067

30603068
if finding.test.engagement != new_original.test.engagement:
30613069
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: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,9 @@ <h4>Duplicate Cluster ({{ finding|finding_duplicate_cluster_size }})<span class=
726726
<div class="panel-heading">
727727
<h4 class="has-filters">Similar Findings ({{ similar_findings.paginator.count }})
728728
<i class="fa-solid fa-circle-question has-popover" data-trigger="hover"
729-
data-content="Opening this panel shows findings that are not exact duplicates,
729+
data-content="Opening this panel shows findings in this Asset 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">
@@ -1518,7 +1517,6 @@ <h4>Credential
15181517
{ "data": "status" },
15191518
{ "data": "test" },
15201519
{ "data": "engagement" },
1521-
{ "data": "product" },
15221520
{ "data": "cwe" },
15231521
{ "data": "cve" },
15241522
{ "data": "epss_score", "type": "num", "render": percentSort },

0 commit comments

Comments
 (0)