Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

add encrypt secrets toggle to chef sync

Dimitris Staratzis5f51501c878c
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ChefSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ChefSyncFields.tsx
index 3ab2a2f083..f2534ccb34 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ChefSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ChefSyncFields.tsx
@@ -5,9 +5,12 @@ import {
Combobox,
Field,
FieldContent,
+ FieldDescription,
FieldError,
FieldGroup,
- FieldLabel
+ FieldLabel,
+ Label,
+ Toggle
} from "@app/components/v3";
import {
useChefConnectionListDataBagItems,
@@ -118,6 +121,29 @@ export const ChefSyncFields = () => {
</Field>
)}
/>
+
+ <Controller
+ name="destinationConfig.shouldEncryptSecrets"
+ control={control}
+ render={({ field: { value, onChange } }) => (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <Label htmlFor="secret-sync-chef-encrypt-secrets">Encrypt Secrets</Label>
+ <FieldDescription>
+ Write the item as a Chef encrypted data bag item. Add your data bag secret to the
+ selected Chef connection first, and copy the same secret to every node that reads
+ the item.
+ </FieldDescription>
+ </FieldContent>
+ <Toggle
+ id="secret-sync-chef-encrypt-secrets"
+ variant="project"
+ checked={Boolean(value)}
+ onCheckedChange={onChange}
+ />
+ </Field>
+ )}
+ />
</FieldGroup>
);
};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/ChefSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/ChefSyncReviewFields.tsx
index ded569b506..d067904706 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/ChefSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/ChefSyncReviewFields.tsx
@@ -8,6 +8,7 @@ export const ChefSyncReviewFields = () => {
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Chef }>();
const dataBagName = watch("destinationConfig.dataBagName");
const dataBagItemName = watch("destinationConfig.dataBagItemName");
+ const shouldEncryptSecrets = watch("destinationConfig.shouldEncryptSecrets");
return (
<>
@@ -19,6 +20,10 @@ export const ChefSyncReviewFields = () => {
<DetailLabel>Data Bag Item</DetailLabel>
<DetailValue>{dataBagItemName}</DetailValue>
</Detail>
+ <Detail>
+ <DetailLabel>Encrypt Secrets</DetailLabel>
+ <DetailValue>{shouldEncryptSecrets ? "Yes" : "No"}</DetailValue>
+ </Detail>
</>
);
};
diff --git a/frontend/src/components/secret-syncs/forms/schemas/chef-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/chef-sync-destination-schema.ts
index c05708ca80..2afb5f69ab 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/chef-sync-destination-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/chef-sync-destination-schema.ts
@@ -8,7 +8,8 @@ export const ChefSyncDestinationSchema = BaseSecretSyncSchema().merge(
destination: z.literal(SecretSync.Chef),
destinationConfig: z.object({
dataBagName: z.string().trim().min(1, "Data Bag required"),
- dataBagItemName: z.string().trim().min(1, "Data Bag Item required")
+ dataBagItemName: z.string().trim().min(1, "Data Bag Item required"),
+ shouldEncryptSecrets: z.boolean().optional()
})
})
);
diff --git a/frontend/src/hooks/api/secretSyncs/types/chef-sync.ts b/frontend/src/hooks/api/secretSyncs/types/chef-sync.ts
index 6bd3d7ca2d..cd09638387 100644
--- a/frontend/src/hooks/api/secretSyncs/types/chef-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/chef-sync.ts
@@ -7,6 +7,7 @@ export type TChefSync = TRootSecretSync & {
destinationConfig: {
dataBagName: string;
dataBagItemName: string;
+ shouldEncryptSecrets?: boolean;
};
connection: {
app: AppConnection.Chef;
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/ChefSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/ChefSyncDestinationSection.tsx
index 69b8c8914a..270a9e59f4 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/ChefSyncDestinationSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/ChefSyncDestinationSection.tsx
@@ -18,6 +18,10 @@ export const ChefSyncDestinationSection = ({ secretSync }: Props) => {
<DetailLabel>Data Bag Item</DetailLabel>
<DetailValue>{destinationConfig.dataBagItemName}</DetailValue>
</Detail>
+ <Detail>
+ <DetailLabel>Encrypt Secrets</DetailLabel>
+ <DetailValue>{destinationConfig.shouldEncryptSecrets ? "Yes" : "No"}</DetailValue>
+ </Detail>
</>
);
};