From 95314dfc2bc0f60dbec4efd48598612a7f0c564d Mon Sep 17 00:00:00 2001 From: Prowler Bot Date: Mon, 16 Jun 2025 15:14:53 +0200 Subject: [PATCH] fix(findings): exclude blank resource types from metadata endpoints (#8030) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Víctor Fernández Poyatos --- api/CHANGELOG.md | 1 + api/src/backend/api/v1/views.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/api/CHANGELOG.md b/api/CHANGELOG.md index 6ca3c69223..056295994d 100644 --- a/api/CHANGELOG.md +++ b/api/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to the **Prowler API** are documented in this file. ### Fixed - Normalize provider UID to ensure safe and unique export directory paths [(#8007)](https://github.com/prowler-cloud/prowler/pull/8007). +- Blank resource types in `/metadata` endpoints [(#8027)](https://github.com/prowler-cloud/prowler/pull/8027) --- diff --git a/api/src/backend/api/v1/views.py b/api/src/backend/api/v1/views.py index d4d70c6477..ca54e2deed 100644 --- a/api/src/backend/api/v1/views.py +++ b/api/src/backend/api/v1/views.py @@ -1909,6 +1909,8 @@ class FindingViewSet(PaginateByPkMixin, BaseRLSViewSet): ) resource_types = list( queryset.values_list("resource_type", flat=True) + .exclude(resource_type__isnull=True) + .exclude(resource_type__exact="") .distinct() .order_by("resource_type") ) @@ -2010,6 +2012,8 @@ class FindingViewSet(PaginateByPkMixin, BaseRLSViewSet): ) resource_types = list( queryset.values_list("resource_type", flat=True) + .exclude(resource_type__isnull=True) + .exclude(resource_type__exact="") .distinct() .order_by("resource_type") )