Skip to content

Commit 0dfc724

Browse files
committed
fix(endpoint_manager): exclude certain endpoint statuses from existing findings
1 parent 65fb9df commit 0dfc724

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

dojo/importers/endpoint_manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22

33
from django.core.exceptions import MultipleObjectsReturned, ValidationError
4+
from django.db.models import Q
45
from django.urls import reverse
56
from django.utils import timezone
67

@@ -158,7 +159,9 @@ def update_endpoint_status(
158159
# New endpoints are already added in serializers.py / views.py (see comment "# for existing findings: make sure endpoints are present or created")
159160
# So we only need to mitigate endpoints that are no longer present
160161
# using `.all()` will mark as mitigated also `endpoint_status` with flags `false_positive`, `out_of_scope` and `risk_accepted`. This is a known issue. This is not a bug. This is a future.
161-
existing_finding_endpoint_status_list = existing_finding.status_finding.all()
162+
existing_finding_endpoint_status_list = existing_finding.status_finding.exclude(
163+
Q(false_positive=True) | Q(out_of_scope=True) | Q(risk_accepted=True),
164+
)
162165
new_finding_endpoints_list = new_finding.unsaved_endpoints
163166
if new_finding.is_mitigated:
164167
# New finding is mitigated, so mitigate all old endpoints

0 commit comments

Comments
 (0)