Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
better settings
Matheus Nogueira050f478851fb
diff --git a/backend/src/ee/routes/v1/honey-token-router.ts b/backend/src/ee/routes/v1/honey-token-router.tsindex 9bd531a57a..968b03e01e 100644--- a/backend/src/ee/routes/v1/honey-token-router.ts+++ b/backend/src/ee/routes/v1/honey-token-router.ts@@ -346,6 +346,33 @@ export const registerHoneyTokenRouter = async (server: FastifyZodProvider) => {}});+ server.route({+ url: "/configs/:type/test-connection",+ method: "POST",+ config: {+ rateLimit: writeLimit+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ schema: {+ params: z.object({+ type: z.nativeEnum(HoneyTokenType)+ }),+ response: {+ 200: z.object({+ isConnected: z.boolean(),+ status: z.string().nullable(),+ stackName: z.string()+ })+ }+ },+ handler: async (req) => {+ return server.services.honeyToken.testConnection({+ orgPermission: req.permission,+ type: req.params.type+ });+ }+ });+server.route({url: "/configs/:type",method: "GET",diff --git a/backend/src/ee/services/honey-token/honey-token-config-service.ts b/backend/src/ee/services/honey-token/honey-token-config-service.tsindex 2f2a6ee261..847ebdf82a 100644--- a/backend/src/ee/services/honey-token/honey-token-config-service.ts+++ b/backend/src/ee/services/honey-token/honey-token-config-service.ts@@ -146,19 +146,6 @@ export const honeyTokenConfigServiceFactory = ({const validatedConfig = AwsHoneyTokenConfigSchema.parse(config);- const stackDeployment = await verifyStackDeployment({- connectionId,- stackName: validatedConfig.stackName- });-- if (!stackDeployment.deployed) {- throw new BadRequestError({- message: stackDeployment.status- ? `CloudFormation stack "${validatedConfig.stackName}" is not ready (status: ${stackDeployment.status}). Wait for it to complete or fix the issue before saving.`- : `CloudFormation stack "${validatedConfig.stackName}" was not found. Deploy the stack before saving.`- });- }-const { encryptor } = await kmsService.createCipherPairWithDataKey({type: KmsDataKey.Organization,orgId: orgPermission.orgId@@ -188,6 +175,49 @@ export const honeyTokenConfigServiceFactory = ({});};+ const testConnection = async ({ orgPermission, type }: { orgPermission: OrgServiceActor; type: HoneyTokenType }) => {+ const { permission } = await permissionService.getOrgPermission({+ scope: OrganizationActionScope.Any,+ actor: orgPermission.type,+ actorId: orgPermission.id,+ orgId: orgPermission.orgId,+ actorAuthMethod: orgPermission.authMethod,+ actorOrgId: orgPermission.orgId+ });++ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.Settings);++ const config = await honeyTokenConfigDAL.findOne({+ orgId: orgPermission.orgId,+ type+ });++ if (!config?.encryptedConfig || !config.connectionId) {+ throw new BadRequestError({+ message: "Honey token configuration not found. Save the configuration first."+ });+ }++ const { decryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.Organization,+ orgId: orgPermission.orgId+ });++ const decrypted = decryptor({ cipherTextBlob: config.encryptedConfig });+ const storedConfig = AwsHoneyTokenConfigSchema.parse(JSON.parse(decrypted.toString()) as unknown);++ const stackDeployment = await verifyStackDeployment({+ connectionId: config.connectionId,+ stackName: storedConfig.stackName+ });++ return {+ isConnected: stackDeployment.deployed,+ status: stackDeployment.status,+ stackName: storedConfig.stackName+ };+ };+const getConfig = async ({ orgPermission, type }: { orgPermission: OrgServiceActor; type: HoneyTokenType }) => {const { permission } = await permissionService.getOrgPermission({scope: OrganizationActionScope.Any,@@ -403,6 +433,7 @@ export const honeyTokenConfigServiceFactory = ({return {upsertConfig,+ testConnection,getConfig,handleTrigger};diff --git a/frontend/src/hooks/api/honeyToken/index.ts b/frontend/src/hooks/api/honeyToken/index.tsindex 7a7d58eceb..6413dad4d4 100644--- a/frontend/src/hooks/api/honeyToken/index.ts+++ b/frontend/src/hooks/api/honeyToken/index.ts@@ -1,4 +1,4 @@-export { useUpsertHoneyTokenConfig } from "./mutations";+export { useTestHoneyTokenConnection, useUpsertHoneyTokenConfig } from "./mutations";export { useGetHoneyTokenConfig } from "./queries";export type { THoneyTokenConfig, TUpsertHoneyTokenConfigDTO } from "./types";export { HoneyTokenType } from "./types";diff --git a/frontend/src/hooks/api/honeyToken/mutations.ts b/frontend/src/hooks/api/honeyToken/mutations.tsindex 865aa48a48..9e08c035c7 100644--- a/frontend/src/hooks/api/honeyToken/mutations.ts+++ b/frontend/src/hooks/api/honeyToken/mutations.ts@@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";import { apiRequest } from "@app/config/request";import { honeyTokenKeys } from "./queries";-import { TUpsertHoneyTokenConfigDTO } from "./types";+import { HoneyTokenType, TUpsertHoneyTokenConfigDTO } from "./types";export const useUpsertHoneyTokenConfig = () => {const queryClient = useQueryClient();@@ -18,3 +18,16 @@ export const useUpsertHoneyTokenConfig = () => {}});};++export const useTestHoneyTokenConnection = () => {+ return useMutation({+ mutationFn: async (type: HoneyTokenType) => {+ const { data } = await apiRequest.post<{+ isConnected: boolean;+ status: string | null;+ stackName: string;+ }>(`/api/v1/honey-tokens/configs/${type}/test-connection`);+ return data;+ }+ });+};diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsxnew file mode 100644index 0000000000..065ff62f77--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx@@ -0,0 +1,304 @@+import { useEffect, useMemo } from "react";+import { Controller, useForm } from "react-hook-form";+import { faCheck, faCopy, faEye, faEyeSlash, faTerminal } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";++import { createNotification } from "@app/components/notifications";+import { OrgPermissionCan } from "@app/components/permissions";+import {+ Accordion,+ AccordionContent,+ AccordionItem,+ AccordionTrigger,+ Button,+ Dialog,+ DialogContent,+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ FilterableSelect,+ IconButton,+ Input+} from "@app/components/v3";+import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";+import { useTimedReset, useToggle } from "@app/hooks";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { useListAppConnections } from "@app/hooks/api/appConnections/queries";+import {+ HoneyTokenType,+ useGetHoneyTokenConfig,+ useUpsertHoneyTokenConfig+} from "@app/hooks/api/honeyToken";++const CF_TEMPLATE_URL =+ "https://infisical-static-assets.s3.us-east-1.amazonaws.com/honey-tokens/honey-tokens-v1.yaml";++const DEFAULT_STACK_NAME = "infisical-honey-tokens";++const schema = z.object({+ connectionId: z.string().min(1, "AWS Connection is required"),+ webhookSigningKey: z.string().min(1, "Webhook Signing Key is required"),+ stackName: z.string().trim().min(1, "Stack name is required").max(128)+});++type FormData = z.infer<typeof schema>;++type Props = {+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+};++export const HoneyTokenModal = ({ isOpen, onOpenChange }: Props) => {+ const { currentOrg } = useOrganization();+ const [isTokenVisible, setIsTokenVisible] = useToggle(false);+ const [, isTokenCopied, setTokenCopied] = useTimedReset({ initialState: false });+ const [, isCommandCopied, setCommandCopied] = useTimedReset({ initialState: false });++ const { data: appConnections = [], isPending: isLoadingConnections } = useListAppConnections();+ const { data: existingConfig } = useGetHoneyTokenConfig(HoneyTokenType.AWS, {+ retry: false+ });+ const { mutateAsync: upsertConfig, isPending: isSaving } = useUpsertHoneyTokenConfig();++ const isConfigured = Boolean(existingConfig?.id);++ const awsConnections = useMemo(+ () => appConnections.filter((conn) => conn.app === AppConnection.AWS),+ [appConnections]+ );++ const webhookUrl = useMemo(() => {+ const { protocol, host } = window.location;+ return `${protocol}//${host}/api/v1/honey-tokens/${currentOrg?.id}/trigger`;+ }, [currentOrg?.id]);++ const { control, handleSubmit, watch, reset } = useForm<FormData>({+ resolver: zodResolver(schema),+ defaultValues: {+ connectionId: "",+ webhookSigningKey: "",+ stackName: DEFAULT_STACK_NAME+ }+ });++ useEffect(() => {+ if (!existingConfig?.decryptedConfig) return;++ reset({+ connectionId: existingConfig.connectionId ?? "",+ webhookSigningKey: existingConfig.decryptedConfig.webhookSigningKey,+ stackName: existingConfig.decryptedConfig.stackName ?? DEFAULT_STACK_NAME+ });+ }, [existingConfig, reset]);++ const webhookSigningKey = watch("webhookSigningKey");+ const stackName = watch("stackName");++ const cfCommand = useMemo(+ () =>+ [+ "aws cloudformation create-stack \\",+ " --region us-east-1 \\",+ ` --stack-name ${stackName || DEFAULT_STACK_NAME} \\`,+ ` --template-url ${CF_TEMPLATE_URL} \\`,+ " --capabilities CAPABILITY_NAMED_IAM \\",+ " --parameters \\",+ ` ParameterKey=WebhookUrl,ParameterValue=${webhookUrl} \\`,+ ` ParameterKey=WebhookSigningKey,ParameterValue=${webhookSigningKey}`+ ].join("\n"),+ [stackName, webhookSigningKey, webhookUrl]+ );++ const onSubmit = async (data: FormData) => {+ try {+ await upsertConfig({+ type: HoneyTokenType.AWS,+ connectionId: data.connectionId,+ config: {+ webhookSigningKey: data.webhookSigningKey,+ stackName: data.stackName+ }+ });+ createNotification({+ text: "Honey token settings saved successfully",+ type: "success"+ });+ } catch {+ createNotification({+ text: "Failed to save honey token settings",+ type: "error"+ });+ }+ };++ return (+ <Dialog open={isOpen} onOpenChange={onOpenChange}>+ <DialogContent className="max-w-2xl">+ <div className="mb-4">+ <h2 className="text-lg font-medium text-mineshaft-100">Configure AWS Honey Tokens</h2>+ <p className="mt-1 text-sm text-mineshaft-400">+ Plant a decoy IAM credential in your AWS account. Infisical alerts on every access+ attempt.+ </p>+ </div>++ <form onSubmit={handleSubmit(onSubmit)}>+ <div className="mb-4 space-y-4">+ <Controller+ control={control}+ name="connectionId"+ render={({ field, fieldState: { error } }) => {+ const selectedConnection = awsConnections.find((conn) => conn.id === field.value);++ return (+ <Field>+ <FieldLabel>App Connection</FieldLabel>+ <FieldContent>+ <FilterableSelect+ value={selectedConnection || null}+ onChange={(newValue) => {+ const singleValue = Array.isArray(newValue) ? newValue[0] : newValue;+ if (singleValue && "id" in singleValue) {+ field.onChange(singleValue.id);+ } else {+ field.onChange("");+ }+ }}+ isError={Boolean(error)}+ isLoading={isLoadingConnections}+ options={awsConnections}+ placeholder="Select an AWS App Connection..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ );+ }}+ />++ <Field>+ <FieldLabel>Webhook Signing Key</FieldLabel>+ <FieldContent>+ <div className="flex items-center gap-2">+ <Controller+ control={control}+ name="webhookSigningKey"+ render={({ field, fieldState: { error } }) => (+ <Input+ {...field}+ type={isTokenVisible ? "text" : "password"}+ placeholder="Enter webhook signing key..."+ isError={Boolean(error)}+ className="flex-1 font-mono"+ />+ )}+ />+ <IconButton+ aria-label="toggle signing key visibility"+ variant="outline"+ size="md"+ onClick={() => setIsTokenVisible.toggle()}+ >+ <FontAwesomeIcon icon={isTokenVisible ? faEyeSlash : faEye} />+ </IconButton>+ <IconButton+ aria-label="copy signing key"+ variant="outline"+ size="md"+ onClick={() => {+ navigator.clipboard.writeText(webhookSigningKey);+ setTokenCopied(true);+ }}+ >+ <FontAwesomeIcon icon={isTokenCopied ? faCheck : faCopy} />+ </IconButton>+ </div>+ </FieldContent>+ </Field>++ <Accordion type="single" collapsible variant="ghost">+ <AccordionItem value="advanced">+ <AccordionTrigger>Advanced Options</AccordionTrigger>+ <AccordionContent>+ <Controller+ control={control}+ name="stackName"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>CloudFormation Stack Name</FieldLabel>+ <FieldContent>+ <Input+ {...field}+ placeholder={DEFAULT_STACK_NAME}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ </div>++ {isConfigured && (+ <div className="mb-4 rounded-md border border-mineshaft-600 bg-bunker-800 p-4">+ <div className="mb-3 flex items-center gap-2 text-sm text-mineshaft-300">+ <FontAwesomeIcon icon={faTerminal} className="text-mineshaft-400" />+ <span className="font-medium tracking-wide uppercase">+ Deploy CloudFormation Stack+ </span>+ </div>+ <p className="mb-3 text-sm text-mineshaft-400">+ Run this command to create the CloudFormation stack that provisions the decoy IAM+ user and wires CloudTrail alerts back to Infisical.+ </p>+ <div className="relative">+ <pre className="rounded-md bg-black/40 p-4 pr-12 font-mono text-xs leading-relaxed break-all whitespace-pre-wrap text-mineshaft-200">+ <span className="text-mineshaft-500 select-none">$ </span>+ {cfCommand}+ </pre>+ <IconButton+ aria-label="copy CloudFormation command"+ variant="outline"+ size="xs"+ className="absolute top-2 right-2"+ onClick={() => {+ navigator.clipboard.writeText(cfCommand);+ setCommandCopied(true);+ }}+ >+ <FontAwesomeIcon icon={isCommandCopied ? faCheck : faCopy} />+ </IconButton>+ </div>+ </div>+ )}++ <div className="flex justify-end gap-2">+ <Button variant="outline" onClick={() => onOpenChange(false)} type="button">+ Cancel+ </Button>+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Settings}>+ {(isAllowed) => (+ <Button+ type="submit"+ variant="org"+ isPending={isSaving}+ isDisabled={!isAllowed || isSaving}+ >+ Save+ </Button>+ )}+ </OrgPermissionCan>+ </div>+ </form>+ </DialogContent>+ </Dialog>+ );+};diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenSection.tsxindex 291c33cb21..e2722c6d1f 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenSection.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenSection.tsx@@ -1,125 +1,45 @@-import { useEffect, useMemo } from "react";-import { Controller, useForm } from "react-hook-form";-import { faCheck, faCopy, faEye, faEyeSlash, faTerminal } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { zodResolver } from "@hookform/resolvers/zod";-import { z } from "zod";-import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";-import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,- Button,- Field,- FieldContent,- FieldError,- FieldLabel,- FilterableSelect,- IconButton,- Input-} from "@app/components/v3";-import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";-import { useTimedReset, useToggle } from "@app/hooks";-import { AppConnection } from "@app/hooks/api/appConnections/enums";-import { useListAppConnections } from "@app/hooks/api/appConnections/queries";+import { Button } from "@app/components/v3";+import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";+import { usePopUp } from "@app/hooks";import {HoneyTokenType,useGetHoneyTokenConfig,- useUpsertHoneyTokenConfig+ useTestHoneyTokenConnection} from "@app/hooks/api/honeyToken";-const CF_TEMPLATE_URL =- "https://infisical-static-assets.s3.us-east-1.amazonaws.com/honey-tokens/honey-tokens-v1.yaml";--const DEFAULT_STACK_NAME = "infisical-honey-tokens";--const schema = z.object({- connectionId: z.string().min(1, "AWS Connection is required"),- webhookSigningKey: z.string().min(1, "Webhook Signing Key is required"),- stackName: z.string().trim().min(1, "Stack name is required").max(128)-});--type FormData = z.infer<typeof schema>;+import { HoneyTokenModal } from "./HoneyTokenModal";export const HoneyTokenSection = () => {- const { currentOrg } = useOrganization();- const [isTokenVisible, setIsTokenVisible] = useToggle(false);- const [, isTokenCopied, setTokenCopied] = useTimedReset({ initialState: false });- const [, isCommandCopied, setCommandCopied] = useTimedReset({ initialState: false });+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["honeyTokenModal"] as const);- const { data: appConnections = [], isPending: isLoadingConnections } = useListAppConnections();const { data: existingConfig } = useGetHoneyTokenConfig(HoneyTokenType.AWS, {retry: false});- const { mutateAsync: upsertConfig, isPending: isSaving } = useUpsertHoneyTokenConfig();-- const awsConnections = useMemo(- () => appConnections.filter((conn) => conn.app === AppConnection.AWS),- [appConnections]- );-- const webhookUrl = useMemo(() => {- const { protocol, host } = window.location;- return `${protocol}//${host}/api/v1/honey-tokens/${currentOrg?.id}/trigger`;- }, [currentOrg?.id]);-- const { control, handleSubmit, watch, reset } = useForm<FormData>({- resolver: zodResolver(schema),- defaultValues: {- connectionId: "",- webhookSigningKey: "",- stackName: DEFAULT_STACK_NAME- }- });-- useEffect(() => {- if (!existingConfig?.decryptedConfig) return;-- reset({- connectionId: existingConfig.connectionId ?? "",- webhookSigningKey: existingConfig.decryptedConfig.webhookSigningKey,- stackName: existingConfig.decryptedConfig.stackName ?? DEFAULT_STACK_NAME- });- }, [existingConfig, reset]);+ const { mutateAsync: testConnection, isPending: isTesting } = useTestHoneyTokenConnection();- const webhookSigningKey = watch("webhookSigningKey");- const stackName = watch("stackName");+ const isConfigured = Boolean(existingConfig?.id);- const cfCommand = useMemo(- () =>- [- "aws cloudformation create-stack \\",- " --region us-east-1 \\",- ` --stack-name ${stackName || DEFAULT_STACK_NAME} \\`,- ` --template-url ${CF_TEMPLATE_URL} \\`,- " --capabilities CAPABILITY_NAMED_IAM \\",- " --parameters \\",- ` ParameterKey=WebhookUrl,ParameterValue=${webhookUrl} \\`,- ` ParameterKey=WebhookSigningKey,ParameterValue=${webhookSigningKey}`- ].join("\n"),- [stackName, webhookSigningKey, webhookUrl]- );-- const onSubmit = async (data: FormData) => {+ const handleTestConnection = async () => {try {- await upsertConfig({- type: HoneyTokenType.AWS,- connectionId: data.connectionId,- config: {- webhookSigningKey: data.webhookSigningKey,- stackName: data.stackName- }- });- createNotification({- text: "Honey token settings saved successfully",- type: "success"- });+ const result = await testConnection(HoneyTokenType.AWS);+ if (result.isConnected) {+ createNotification({+ text: `CloudFormation stack "${result.stackName}" is deployed and healthy.`,+ type: "success"+ });+ } else {+ createNotification({+ text: result.status+ ? `Stack "${result.stackName}" is not ready (status: ${result.status}).`+ : `Stack "${result.stackName}" was not found. Deploy the stack first.`,+ type: "error"+ });+ }} catch {createNotification({- text: "Failed to save honey token settings",+ text: "Failed to test connection. Check your AWS App Connection permissions.",type: "error"});}@@ -127,157 +47,42 @@ export const HoneyTokenSection = () => {return (<div className="mt-6 border-t border-mineshaft-600 pt-6">- <div className="mb-4">- <h3 className="text-lg font-medium text-mineshaft-100">Honey Tokens</h3>- <p className="mt-1 text-sm text-mineshaft-400">- Plant a decoy IAM credential in your AWS account. Infisical alerts on every access- attempt.- </p>- </div>- <form onSubmit={handleSubmit(onSubmit)}>- <div className="mb-4 flex gap-4">- <div className="flex-1">- <Controller- control={control}- name="connectionId"- render={({ field, fieldState: { error } }) => {- const selectedConnection = awsConnections.find((conn) => conn.id === field.value);-- return (- <Field>- <FieldLabel>App Connection</FieldLabel>- <FieldContent>- <FilterableSelect- value={selectedConnection || null}- onChange={(newValue) => {- const singleValue = Array.isArray(newValue) ? newValue[0] : newValue;- if (singleValue && "id" in singleValue) {- field.onChange(singleValue.id);- } else {- field.onChange("");- }- }}- isError={Boolean(error)}- isLoading={isLoadingConnections}- options={awsConnections}- placeholder="Select an AWS App Connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- />- <FieldError errors={[error]} />- </FieldContent>- </Field>- );- }}- />- </div>- <div className="flex-1">- <Field>- <FieldLabel>Webhook Signing Key</FieldLabel>- <FieldContent>- <div className="flex items-center gap-2">- <div className="flex h-9 flex-1 items-center overflow-hidden rounded-md border border-mineshaft-500 bg-mineshaft-900 px-3 font-mono text-sm text-bunker-200">- {isTokenVisible ? webhookSigningKey : "•".repeat(30)}- </div>- <IconButton- aria-label="toggle signing key visibility"- variant="outline"- size="md"- onClick={() => setIsTokenVisible.toggle()}- >- <FontAwesomeIcon icon={isTokenVisible ? faEyeSlash : faEye} />- </IconButton>- <IconButton- aria-label="copy signing key"- variant="outline"- size="md"- onClick={() => {- navigator.clipboard.writeText(webhookSigningKey);- setTokenCopied(true);- }}- >- <FontAwesomeIcon icon={isTokenCopied ? faCheck : faCopy} />- </IconButton>- </div>- </FieldContent>- </Field>- </div>- </div>-- <Accordion type="single" collapsible variant="ghost" className="mb-4">- <AccordionItem value="advanced">- <AccordionTrigger>Advanced Options</AccordionTrigger>- <AccordionContent>- <div className="flex gap-4">- <div className="flex-1">- <Controller- control={control}- name="stackName"- render={({ field, fieldState: { error } }) => (- <Field>- <FieldLabel>CloudFormation Stack Name</FieldLabel>- <FieldContent>- <Input- {...field}- placeholder={DEFAULT_STACK_NAME}- isError={Boolean(error)}- />- <FieldError errors={[error]} />- </FieldContent>- </Field>- )}- />- </div>- <div className="flex-1" />- </div>- </AccordionContent>- </AccordionItem>- </Accordion>-- <div className="mb-4 rounded-md border border-mineshaft-600 bg-bunker-800 p-4">- <div className="mb-3 flex items-center gap-2 text-sm text-mineshaft-300">- <FontAwesomeIcon icon={faTerminal} className="text-mineshaft-400" />- <span className="font-medium tracking-wide uppercase">Deploy CloudFormation Stack</span>- </div>- <p className="mb-3 text-sm text-mineshaft-400">- Run this command to create the CloudFormation stack that provisions the decoy IAM user- and wires CloudTrail alerts back to Infisical.+ <div className="flex items-center justify-between">+ <div>+ <h3 className="text-lg font-medium text-mineshaft-100">AWS Honey Tokens</h3>+ <p className="mt-1 text-sm text-mineshaft-400">+ Plant decoy IAM credentials in your AWS account. Infisical alerts on every access+ attempt.</p>- <div className="relative">- <pre className="overflow-x-auto rounded-md bg-black/40 p-4 pr-12 font-mono text-xs leading-relaxed text-mineshaft-200">- <span className="text-mineshaft-500 select-none">$ </span>- {cfCommand}- </pre>- <IconButton- aria-label="copy CloudFormation command"- variant="outline"- size="xs"- className="absolute top-2 right-2"- onClick={() => {- navigator.clipboard.writeText(cfCommand);- setCommandCopied(true);- }}- >- <FontAwesomeIcon icon={isCommandCopied ? faCheck : faCopy} />- </IconButton>- </div></div>-- <div className="flex justify-end">- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Settings}>- {(isAllowed) => (+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Settings}>+ {(isAllowed) => (+ <div className="flex gap-2">+ {isConfigured && (+ <Button+ variant="outline"+ isDisabled={!isAllowed || isTesting}+ isPending={isTesting}+ onClick={handleTestConnection}+ >+ Test Connection+ </Button>+ )}<Button- type="submit"- variant="outline"- isPending={isSaving}- isDisabled={!isAllowed || isSaving}+ colorSchema={isConfigured ? "secondary" : "primary"}+ isDisabled={!isAllowed}+ onClick={() => handlePopUpOpen("honeyTokenModal")}>- Save+ {isConfigured ? "Manage" : "Connect"}</Button>- )}- </OrgPermissionCan>- </div>- </form>+ </div>+ )}+ </OrgPermissionCan>+ </div>+ <HoneyTokenModal+ isOpen={popUp.honeyTokenModal.isOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("honeyTokenModal", isOpen)}+ /></div>);};