fix(ui): guard against unknown provider types in ProviderTypeSelector (#9991)

This commit is contained in:
Alejandro Bailo
2026-02-09 15:18:50 +01:00
committed by GitHub
parent 507d163a50
commit afe2e0a09e
3 changed files with 21 additions and 10 deletions
+4
View File
@@ -8,6 +8,10 @@ All notable changes to the **Prowler UI** are documented in this file.
- Attack Paths: Query list now shows their name and short description, when one is selected it also shows a longer description and an attribution if it has it [(#9983)](https://github.com/prowler-cloud/prowler/pull/9983)
### 🐞 Fixed
- ProviderTypeSelector crash when an unknown provider type is not present in PROVIDER_DATA [(#9991)](https://github.com/prowler-cloud/prowler/pull/9991)
---
## [1.18.1] (Prowler v5.18.1)
@@ -153,7 +153,7 @@ export const ProviderTypeSelector = ({
// .filter((p) => p.attributes.connection?.connected)
.map((p) => p.attributes.provider),
),
) as ProviderType[];
).filter((type): type is ProviderType => type in PROVIDER_DATA);
const renderIcon = (providerType: ProviderType) => {
const IconComponent = PROVIDER_DATA[providerType].icon;
+16 -9
View File
@@ -13,7 +13,7 @@ import {
} from "@/components/providers/table";
import { ContentLayout } from "@/components/ui";
import { DataTable } from "@/components/ui/table";
import { ProviderProps, SearchParamsProps } from "@/types";
import { PROVIDER_TYPES, ProviderProps, SearchParamsProps } from "@/types";
export default async function Providers({
searchParams,
@@ -89,15 +89,22 @@ const ProvidersTable = async ({
return acc;
}, {}) || {};
// Exclude provider types not yet supported in the UI
const enrichedProviders =
providersData?.data?.map((provider: ProviderProps) => {
const groupNames =
provider.relationships?.provider_groups?.data?.map(
(group: { id: string }) =>
providerGroupDict[group.id] || "Unknown Group",
) || [];
return { ...provider, groupNames };
}) || [];
providersData?.data
?.filter((provider: ProviderProps) =>
(PROVIDER_TYPES as readonly string[]).includes(
provider.attributes.provider,
),
)
.map((provider: ProviderProps) => {
const groupNames =
provider.relationships?.provider_groups?.data?.map(
(group: { id: string }) =>
providerGroupDict[group.id] || "Unknown Group",
) || [];
return { ...provider, groupNames };
}) || [];
return (
<>