Skip to content

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

Address PR comments

Carlos Monastyrski97a01bdcb40a
diff --git a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
index d10d27803a..ebad86cbd9 100644
--- a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
+++ b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
@@ -256,11 +256,7 @@ export const CreateSecretSyncForm = ({
</FormProvider>
<div className="flex w-full flex-row-reverse justify-between gap-4 pt-4">
- <Button
- onClick={handleNext}
- colorSchema="secondary"
- isDisabled={isCreateButtonDisabled || (isFinalStep && hasDuplicate)}
- >
+ <Button onClick={handleNext} colorSchema="secondary" isDisabled={isCreateButtonDisabled}>
{isFinalStep ? "Create Sync" : "Next"}
</Button>
{selectedTabIndex > 0 && (
diff --git a/frontend/src/components/secret-syncs/forms/DuplicateDestinationConfirmationModal.tsx b/frontend/src/components/secret-syncs/forms/DuplicateDestinationConfirmationModal.tsx
index d80dbc6407..59871e8802 100644
--- a/frontend/src/components/secret-syncs/forms/DuplicateDestinationConfirmationModal.tsx
+++ b/frontend/src/components/secret-syncs/forms/DuplicateDestinationConfirmationModal.tsx
@@ -6,6 +6,7 @@ type Props = {
onConfirm: () => void;
isLoading?: boolean;
duplicateProjectId?: string;
+ isDisabled?: boolean;
};
export const DuplicateDestinationConfirmationModal = ({
@@ -13,7 +14,8 @@ export const DuplicateDestinationConfirmationModal = ({
onOpenChange,
onConfirm,
isLoading,
- duplicateProjectId
+ duplicateProjectId,
+ isDisabled
}: Props) => {
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
@@ -21,7 +23,12 @@ export const DuplicateDestinationConfirmationModal = ({
<div className="mb-4 text-sm">
<p>
Another secret sync in your organization is already configured with the same
- destination. Proceeding may cause conflicts or overwrite existing data.
+ destination.{" "}
+ <span className={isDisabled ? "text-red-400" : ""}>
+ {isDisabled
+ ? "Your organization does not allow duplicate destination configurations."
+ : "Proceeding may cause conflicts or overwrite existing data."}
+ </span>
</p>
{duplicateProjectId && (
<p className="mt-2 text-xs text-mineshaft-400">
@@ -31,26 +38,28 @@ export const DuplicateDestinationConfirmationModal = ({
</code>
</p>
)}
- <p className="mt-2">Are you sure you want to continue?</p>
+ {!isDisabled && <p className="mt-2">Are you sure you want to continue?</p>}
</div>
- <div className="flex items-center gap-4 pt-4">
- <ModalClose asChild>
- <Button
- onClick={onConfirm}
- colorSchema="danger"
- isLoading={isLoading}
- isDisabled={isLoading}
- >
- Continue
- </Button>
- </ModalClose>
- <ModalClose asChild>
- <Button colorSchema="secondary" variant="plain" isDisabled={isLoading}>
- Cancel
- </Button>
- </ModalClose>
- </div>
+ {!isDisabled && (
+ <div className="flex items-center gap-4 pt-4">
+ <ModalClose asChild>
+ <Button
+ onClick={onConfirm}
+ colorSchema="danger"
+ isLoading={isLoading}
+ isDisabled={isLoading}
+ >
+ Continue
+ </Button>
+ </ModalClose>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain" isDisabled={isLoading}>
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ )}
</ModalContent>
</Modal>
);
diff --git a/frontend/src/components/secret-syncs/forms/EditSecretSyncForm.tsx b/frontend/src/components/secret-syncs/forms/EditSecretSyncForm.tsx
index 3c0e4ea17f..2085afe9c2 100644
--- a/frontend/src/components/secret-syncs/forms/EditSecretSyncForm.tsx
+++ b/frontend/src/components/secret-syncs/forms/EditSecretSyncForm.tsx
@@ -5,6 +5,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { createNotification } from "@app/components/notifications";
import { SecretSyncEditFields } from "@app/components/secret-syncs/types";
import { Button, ModalClose } from "@app/components/v2";
+import { useOrganization } from "@app/context";
import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import {
TSecretSync,
@@ -30,6 +31,7 @@ export const EditSecretSyncForm = ({ secretSync, fields, onComplete }: Props) =>
const { name: destinationName } = SECRET_SYNC_MAP[secretSync.destination];
const [showDuplicateConfirmation, setShowDuplicateConfirmation] = useState(false);
const [pendingFormData, setPendingFormData] = useState<TSecretSyncForm | null>(null);
+ const { currentOrg } = useOrganization();
const formMethods = useForm<TSecretSyncForm>({
resolver: zodResolver(UpdateSecretSyncFormSchema),
@@ -209,6 +211,7 @@ export const EditSecretSyncForm = ({ secretSync, fields, onComplete }: Props) =>
onConfirm={handleConfirmDuplicate}
isLoading={updateSecretSync.isPending}
duplicateProjectId={storedDuplicateProjectId}
+ isDisabled={currentOrg?.blockDuplicateSecretSyncDestinations}
/>
</>
);
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
index 4a796933dd..5c04fb308e 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
@@ -219,7 +219,7 @@ export const SecretSyncReviewFields = () => {
<div>
<p>
{currentOrg?.blockDuplicateSecretSyncDestinations
- ? "Another secret sync in your organization is already configured with the same destination. This organization has blocking duplicate destinations enabled."
+ ? "Another secret sync in your organization is already configured with the same destination. Your organization does not allow duplicate destination configurations."
: "Another secret sync in your organization is already configured with the same destination. This may lead to conflicts or unexpected behavior."}
</p>
{duplicateProjectId && (
diff --git a/frontend/src/pages/organization/SettingsPage/components/BlockDuplicateSecretSyncDestinationsSection/BlockDuplicateSecretSyncDestinationsSection.tsx b/frontend/src/pages/organization/SettingsPage/components/BlockDuplicateSecretSyncDestinationsSection/BlockDuplicateSecretSyncDestinationsSection.tsx
deleted file mode 100644
index a2346bd918..0000000000
--- a/frontend/src/pages/organization/SettingsPage/components/BlockDuplicateSecretSyncDestinationsSection/BlockDuplicateSecretSyncDestinationsSection.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { useState } from "react";
-
-import { createNotification } from "@app/components/notifications";
-import { OrgPermissionCan } from "@app/components/permissions";
-import { Checkbox } from "@app/components/v2";
-import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";
-import { useUpdateOrg } from "@app/hooks/api/organization/queries";
-
-export const BlockDuplicateSecretSyncDestinationsSection = () => {
- const { currentOrg } = useOrganization();
- const { mutateAsync: updateOrg } = useUpdateOrg();
-
- const [isLoading, setIsLoading] = useState(false);
-
- const handleToggle = async (state: boolean) => {
- setIsLoading(true);
-
- try {
- if (!currentOrg?.id) {
- setIsLoading(false);
- return;
- }
-
- await updateOrg({
- orgId: currentOrg.id,
- blockDuplicateSecretSyncDestinations: state
- });
-
- createNotification({
- text: `Successfully ${state ? "enabled" : "disabled"} blocking duplicate secret sync destinations for this organization`,
- type: "success"
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to update blocking duplicate secret sync destinations setting for this organization",
- type: "error"
- });
- } finally {
- setIsLoading(false);
- }
- };
-
- return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-3 text-xl font-medium">Block Duplicate Secret Sync Destinations</p>
- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Settings}>
- {(isAllowed) => (
- <div className="w-max">
- <Checkbox
- id="blockDuplicateSecretSyncDestinations"
- isDisabled={!isAllowed || isLoading}
- isChecked={currentOrg?.blockDuplicateSecretSyncDestinations ?? false}
- onCheckedChange={(state) => handleToggle(state as boolean)}
- >
- This feature prevents creating secret syncs with destinations that are already in use
- by other syncs in your organization.
- </Checkbox>
- </div>
- )}
- </OrgPermissionCan>
- </div>
- );
-};
diff --git a/frontend/src/pages/organization/SettingsPage/components/BlockDuplicateSecretSyncDestinationsSection/index.ts b/frontend/src/pages/organization/SettingsPage/components/BlockDuplicateSecretSyncDestinationsSection/index.ts
deleted file mode 100644
index 0426a61782..0000000000
--- a/frontend/src/pages/organization/SettingsPage/components/BlockDuplicateSecretSyncDestinationsSection/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { BlockDuplicateSecretSyncDestinationsSection } from "./BlockDuplicateSecretSyncDestinationsSection";
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx
index 5e23a4f97d..e4d9359968 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/OrgProductSettingsTab.tsx
@@ -49,11 +49,11 @@ export const OrgProductSettingsTab = () => {
<div className="flex items-center justify-between">
<div>
<h3 className="mb-2 text-lg font-medium text-mineshaft-100">
- Block Duplicate Secret Sync Destinations
+ Unique Secret Sync Destination Policy
</h3>
<p className="text-sm text-mineshaft-400">
- When enabled, this setting prevents the creation of multiple sync configurations
- pointing to the same destination.
+ When enabled, ensures each destination can only be used by one secret sync
+ configuration, preventing potential conflicts or overwrites.
</p>
</div>
<OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Settings}>
diff --git a/frontend/src/pages/organization/SettingsPage/components/index.tsx b/frontend/src/pages/organization/SettingsPage/components/index.tsx
index 3387ed32b6..82909f799d 100644
--- a/frontend/src/pages/organization/SettingsPage/components/index.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/index.tsx
@@ -1,3 +1,2 @@
-export { BlockDuplicateSecretSyncDestinationsSection } from "./BlockDuplicateSecretSyncDestinationsSection";
export { OrgProductSettingsTab } from "./OrgProductSettingsTab";
export { OrgTabGroup } from "./OrgTabGroup";