feat(integrations): external links and copies changed (#8574)

This commit is contained in:
Alejandro Bailo
2025-08-27 12:40:25 +02:00
committed by GitHub
parent 329ac113f2
commit 06c2608a05
5 changed files with 23 additions and 20 deletions

View File

@@ -265,6 +265,7 @@ export const S3IntegrationForm = ({
externalId={externalId}
templateLinks={templateLinks}
type="integrations"
integrationType="amazon_s3"
/>
);
}

View File

@@ -285,6 +285,7 @@ export const SecurityHubIntegrationForm = ({
"aws_security_hub",
)}
type="integrations"
integrationType="aws_security_hub"
/>
</>
)}
@@ -308,6 +309,7 @@ export const SecurityHubIntegrationForm = ({
externalId={externalId}
templateLinks={templateLinks}
type="integrations"
integrationType="aws_security_hub"
/>
);
}
@@ -379,7 +381,10 @@ export const SecurityHubIntegrationForm = ({
onValueChange={field.onChange}
size="sm"
>
<span className="text-sm">Use custom credentials</span>
<span className="text-sm">
Use custom credentials (By default, AWS account ones
will be used)
</span>
</Checkbox>
</FormControl>
)}

View File

@@ -3,6 +3,7 @@
import { IdIcon } from "@/components/icons";
import { CustomButton } from "@/components/ui/custom";
import { SnippetChip } from "@/components/ui/entities";
import { IntegrationType } from "@/types/integrations";
interface CredentialsRoleHelperProps {
externalId: string;
@@ -11,20 +12,22 @@ interface CredentialsRoleHelperProps {
cloudformationQuickLink: string;
terraform: string;
};
type?: "providers" | "integrations";
integrationType?: IntegrationType;
}
export const CredentialsRoleHelper = ({
externalId,
templateLinks,
type = "providers",
integrationType,
}: CredentialsRoleHelperProps) => {
const isAmazonS3 = integrationType === "amazon_s3";
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-4">
<p className="text-sm text-gray-600 dark:text-gray-400">
A <strong>read-only IAM role</strong> must be manually created
{type === "integrations" ? " or updated" : ""}.
{isAmazonS3 ? " or updated" : ""}
</p>
<CustomButton
@@ -46,9 +49,9 @@ export const CredentialsRoleHelper = ({
</div>
<p className="text-sm text-gray-600 dark:text-gray-400">
{type === "providers"
? "Use one of the following templates to create the IAM role"
: "Refer to the documentation"}
{isAmazonS3
? "Refer to the documentation"
: "Use one of the following templates to create the IAM role"}
</p>
<div className="flex w-fit flex-col gap-2">
@@ -59,7 +62,7 @@ export const CredentialsRoleHelper = ({
asLink={templateLinks.cloudformation}
target="_blank"
>
CloudFormation {type === "providers" ? "Template" : ""}
CloudFormation {integrationType ? "" : "Template"}
</CustomButton>
<CustomButton
ariaLabel="Terraform Code"
@@ -68,7 +71,7 @@ export const CredentialsRoleHelper = ({
asLink={templateLinks.terraform}
target="_blank"
>
Terraform {type === "providers" ? "Code" : ""}
Terraform {integrationType ? "" : "Code"}
</CustomButton>
</div>

View File

@@ -6,6 +6,7 @@ import { CredentialsRoleHelper } from "@/components/providers/workflow";
import { CustomInput } from "@/components/ui/custom";
import { ProviderCredentialFields } from "@/lib/provider-credentials/provider-credential-fields";
import { AWSCredentialsRole } from "@/types";
import { IntegrationType } from "@/types/integrations";
export const AWSRoleCredentialsForm = ({
control,
@@ -13,6 +14,7 @@ export const AWSRoleCredentialsForm = ({
externalId,
templateLinks,
type = "providers",
integrationType,
}: {
control: Control<AWSCredentialsRole>;
setValue: UseFormSetValue<AWSCredentialsRole>;
@@ -23,6 +25,7 @@ export const AWSRoleCredentialsForm = ({
terraform: string;
};
type?: "providers" | "integrations";
integrationType?: IntegrationType;
}) => {
const isCloudEnv = process.env.NEXT_PUBLIC_IS_CLOUD_ENV === "true";
const defaultCredentialsType = isCloudEnv
@@ -187,7 +190,7 @@ export const AWSRoleCredentialsForm = ({
<CredentialsRoleHelper
externalId={externalId}
templateLinks={templateLinks}
type={type}
integrationType={integrationType}
/>
<Divider />

View File

@@ -51,7 +51,7 @@ export const getAWSCredentialsTemplateLinks = (
} => {
let links = {};
if (integrationType === undefined) {
if (integrationType === undefined || integrationType === "aws_security_hub") {
links = {
cloudformation:
"https://github.com/prowler-cloud/prowler/blob/master/permissions/templates/cloudformation/prowler-scan-role.yml",
@@ -60,15 +60,6 @@ export const getAWSCredentialsTemplateLinks = (
};
}
if (integrationType === "aws_security_hub") {
links = {
cloudformation:
"https://docs.prowler.com/projects/prowler-open-source/en/latest/tutorials/prowler-app-s3-integration/",
terraform:
"https://docs.prowler.com/projects/prowler-open-source/en/latest/tutorials/prowler-app-s3-integration/#terraform",
};
}
if (integrationType === "amazon_s3") {
links = {
cloudformation: