fix(ui): show kubeconfig exec auth warning

This commit is contained in:
Hugo P.Brito
2026-07-01 12:37:26 +01:00
parent d38b6e41c6
commit f5c2b991d3
2 changed files with 24 additions and 2 deletions
@@ -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<KubernetesCredentials>;
}) => {
const kubeconfigContent = useWatch({
control,
name: "kubeconfig_content",
});
const hasExecAuthentication = kubeconfigContainsExecAuthentication(
kubeconfigContent ?? "",
);
return (
<>
<div className="flex flex-col">
@@ -28,6 +43,11 @@ export const KubernetesCredentialsForm = ({
minRows={10}
isRequired
/>
{hasExecAuthentication && (
<p className="text-text-error-primary text-xs">
{KUBECONFIG_EXEC_AUTHENTICATION_ERROR}
</p>
)}
</>
);
};
+4 -2
View File
@@ -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<string, unknown> => {
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);