From f5c2b991d339837f30a95e94eddf16b040900036 Mon Sep 17 00:00:00 2001 From: "Hugo P.Brito" Date: Wed, 1 Jul 2026 12:37:26 +0100 Subject: [PATCH] fix(ui): show kubeconfig exec auth warning --- .../via-credentials/k8s-credentials-form.tsx | 20 +++++++++++++++++++ ui/types/formSchemas.ts | 6 ++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ui/components/providers/workflow/forms/via-credentials/k8s-credentials-form.tsx b/ui/components/providers/workflow/forms/via-credentials/k8s-credentials-form.tsx index 701bffcba5..37d0f9e47a 100644 --- a/ui/components/providers/workflow/forms/via-credentials/k8s-credentials-form.tsx +++ b/ui/components/providers/workflow/forms/via-credentials/k8s-credentials-form.tsx @@ -1,13 +1,28 @@ +"use client"; + import { Control } from "react-hook-form"; +import { useWatch } from "react-hook-form"; import { WizardTextareaField } from "@/components/providers/workflow/forms/fields"; import { KubernetesCredentials } from "@/types"; +import { + KUBECONFIG_EXEC_AUTHENTICATION_ERROR, + kubeconfigContainsExecAuthentication, +} from "@/types/formSchemas"; export const KubernetesCredentialsForm = ({ control, }: { control: Control; }) => { + const kubeconfigContent = useWatch({ + control, + name: "kubeconfig_content", + }); + const hasExecAuthentication = kubeconfigContainsExecAuthentication( + kubeconfigContent ?? "", + ); + return ( <>
@@ -28,6 +43,11 @@ export const KubernetesCredentialsForm = ({ minRows={10} isRequired /> + {hasExecAuthentication && ( +

+ {KUBECONFIG_EXEC_AUTHENTICATION_ERROR} +

+ )} ); }; diff --git a/ui/types/formSchemas.ts b/ui/types/formSchemas.ts index 11f3c10faf..bef2cc0862 100644 --- a/ui/types/formSchemas.ts +++ b/ui/types/formSchemas.ts @@ -6,14 +6,16 @@ import { validateMutelistYaml, validateYaml } from "@/lib/yaml"; import { PROVIDER_TYPES, ProviderType } from "./providers"; -const KUBECONFIG_EXEC_AUTHENTICATION_ERROR = +export const KUBECONFIG_EXEC_AUTHENTICATION_ERROR = "Kubernetes kubeconfig exec authentication is not supported in Prowler Cloud for security reasons."; const isRecord = (value: unknown): value is Record => { return typeof value === "object" && value !== null && !Array.isArray(value); }; -const kubeconfigContainsExecAuthentication = (value: string): boolean => { +export const kubeconfigContainsExecAuthentication = ( + value: string, +): boolean => { try { const parsed = yaml.load(value);