From b4d8d64f0e2802184a69b75761ca8fe2d2ffa7e2 Mon Sep 17 00:00:00 2001 From: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com> Date: Thu, 7 Aug 2025 09:54:48 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20update=20AWS=20role=20credentials=20for?= =?UTF-8?q?m=20to=20set=20default=20credentials=20typ=E2=80=A6=20(#8459)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aws-role-credentials-form.tsx | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx b/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx index e540476efa..b47c627ec7 100644 --- a/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx +++ b/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx @@ -1,4 +1,4 @@ -import { Divider, Select, SelectItem, Switch } from "@nextui-org/react"; +import { Chip, Divider, Select, SelectItem, Switch } from "@nextui-org/react"; import { useState } from "react"; import { Control, UseFormSetValue, useWatch } from "react-hook-form"; @@ -24,13 +24,18 @@ export const AWSRoleCredentialsForm = ({ }; type?: "providers" | "s3-integration"; }) => { - const [showRoleSection, setShowRoleSection] = useState(type === "providers"); - + const isCloudEnv = process.env.NEXT_PUBLIC_IS_CLOUD_ENV === "true"; + const defaultCredentialsType = isCloudEnv + ? "aws-sdk-default" + : "access-secret-key"; const credentialsType = useWatch({ control, name: ProviderCredentialFields.CREDENTIALS_TYPE, - defaultValue: "access-secret-key", + defaultValue: defaultCredentialsType, }); + const [showOptionalRole, setShowOptionalRole] = useState(false); + const showRoleSection = + (isCloudEnv && credentialsType === "aws-sdk-default") || showOptionalRole; return ( <> @@ -50,7 +55,7 @@ export const AWSRoleCredentialsForm = ({ name={ProviderCredentialFields.CREDENTIALS_TYPE} label="Authentication Method" placeholder="Select credentials type" - defaultSelectedKeys={["access-secret-key"]} + defaultSelectedKeys={[defaultCredentialsType]} className="mb-4" variant="bordered" onSelectionChange={(keys) => @@ -60,8 +65,32 @@ export const AWSRoleCredentialsForm = ({ ) } > - AWS SDK default - Access & Secret Key + +
+ + {isCloudEnv + ? "Prowler Cloud will assume your IAM role" + : "AWS SDK Default"} + + {isCloudEnv && ( + + Recommended + + )} +
+
+ +
+ Access & Secret Key +
+
{credentialsType === "access-secret-key" && ( @@ -120,12 +149,15 @@ export const AWSRoleCredentialsForm = ({ ) : (
- Optionally add a role + {isCloudEnv && credentialsType === "aws-sdk-default" + ? "Adding a role is required" + : "Optionally add a role"}
)}