From 41e6eae6d3489311ba3d0a6e559b80ae44da715a Mon Sep 17 00:00:00 2001 From: bidaya0 Date: Fri, 31 Mar 2023 11:16:55 +0800 Subject: [PATCH] fix: dast vul relation bind --- dongtai_web/aggr_vul/app_vul_list.py | 5 +++-- dongtai_web/dast/page.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dongtai_web/aggr_vul/app_vul_list.py b/dongtai_web/aggr_vul/app_vul_list.py index 5ae525fe8..633b91983 100644 --- a/dongtai_web/aggr_vul/app_vul_list.py +++ b/dongtai_web/aggr_vul/app_vul_list.py @@ -174,8 +174,9 @@ def post(self, request): iastvul_id__in=vul_ids).values('iastvul_id').annotate( dastvul_count=Count('dastvul_id')) dast_vul_types = IastDastIntegrationRelation.objects.filter( - iastvul_id__in=vul_ids).values('dastvul__vul_type', - 'iastvul_id').distinct() + iastvul_id__in=vul_ids, + dastvul__vul_type__isnull=False, + ).values('dastvul__vul_type', 'iastvul_id').distinct() dast_vul_types_dict = defaultdict( list, { k: list(set(map(lambda x: x['dastvul__vul_type'], g))) diff --git a/dongtai_web/dast/page.py b/dongtai_web/dast/page.py index ad765fb2e..b6008b323 100644 --- a/dongtai_web/dast/page.py +++ b/dongtai_web/dast/page.py @@ -269,9 +269,11 @@ def get_relative_with_dast_vul(self, request): dt_mark__in=dt_marks).values('dastvul_id').all() q = q & Q(pk__in=dastvul_ids) & ~Q(pk__in=relatived_dastvul_ids) else: - dastvul_ids = IastDastIntegrationRelation.objects.filter( + dt_marks = IastvulDtMarkRelation.objects.filter( iastvul_id=ser.validated_data['pk']).values( - 'dastvul_id').all() + 'dt_mark').all() + dastvul_ids = DastvulDtMarkRelation.objects.filter( + dt_mark__in=dt_marks).values('dastvul_id').all() q = q & Q(pk__in=dastvul_ids) if ser.validated_data['vul_type']: q = q & Q(vul_type__in=ser.validated_data['vul_type'])