Skip to content

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

fix: address KMS settings review feedback

Andrew Huang4db8449e7c2e
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/AddExternalKmsForm.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/AddExternalKmsForm.tsx
index 186b16583a..3dc56f2793 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/AddExternalKmsForm.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/AddExternalKmsForm.tsx
@@ -1,9 +1,12 @@
import { useState } from "react";
-import { faAws, faGoogle } from "@fortawesome/free-brands-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
Button,
+ Item,
+ ItemContent,
+ ItemDescription,
+ ItemMedia,
+ ItemTitle,
Sheet,
SheetContent,
SheetDescription,
@@ -24,13 +27,13 @@ type Props = {
const EXTERNAL_KMS_LIST = [
{
- icon: faAws,
+ icon: "/images/integrations/Amazon Web Services.png",
provider: ExternalKmsProvider.Aws,
title: "AWS KMS",
description: "Use an AWS KMS key to encrypt organization data."
},
{
- icon: faGoogle,
+ icon: "/images/integrations/Google Cloud Platform.png",
provider: ExternalKmsProvider.Gcp,
title: "GCP KMS",
description: "Use a Google Cloud KMS key to encrypt organization data."
@@ -70,30 +73,26 @@ export const AddExternalKmsForm = ({ isOpen, onToggle }: Props) => {
<>
<div className="grid gap-3 px-4">
{EXTERNAL_KMS_LIST.map(({ icon, provider, title, description }) => (
- <button
- type="button"
+ <Item
+ asChild
+ variant="outline"
key={provider}
- onClick={() => setSelectedProvider(provider)}
- className={`flex items-center gap-4 rounded-md border border-border bg-container p-4 text-left transition-colors outline-none hover:bg-container-hover focus-visible:ring-[3px] focus-visible:ring-ring/50 ${
+ className={`cursor-pointer hover:bg-container-hover ${
isSubOrganization
? "hover:border-sub-org/70 focus-visible:border-sub-org"
: "hover:border-org/70 focus-visible:border-org"
}`}
>
- <span
- className={`flex size-10 shrink-0 items-center justify-center rounded-md border ${
- isSubOrganization
- ? "border-sub-org/20 bg-sub-org/10 text-sub-org"
- : "border-org/20 bg-org/10 text-org"
- }`}
- >
- <FontAwesomeIcon icon={icon} className="size-4" />
- </span>
- <span className="flex flex-col gap-1">
- <span className="text-sm font-medium text-foreground">{title}</span>
- <span className="text-xs text-accent">{description}</span>
- </span>
- </button>
+ <button type="button" onClick={() => setSelectedProvider(provider)}>
+ <ItemMedia variant="image">
+ <img src={icon} alt="" />
+ </ItemMedia>
+ <ItemContent>
+ <ItemTitle>{title}</ItemTitle>
+ <ItemDescription>{description}</ItemDescription>
+ </ItemContent>
+ </button>
+ </Item>
))}
</div>
<SheetFooter className="justify-end border-t">
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/ExternalKmsItem.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/ExternalKmsItem.tsx
index 5557ce248b..81ced109de 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/ExternalKmsItem.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/ExternalKmsItem.tsx
@@ -1,5 +1,3 @@
-import { faAws, faGoogle } from "@fortawesome/free-brands-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { KeyRound, MoreHorizontal, Pencil, Trash2 } from "lucide-react";
import { OrgPermissionCan } from "@app/components/permissions/OrgPermissionCan";
@@ -35,6 +33,11 @@ type Props = {
};
export const ExternalKmsItem = ({ kms, handlePopUpOpen, subscription }: Props) => {
+ const providerIcon =
+ kms.externalKms.provider === ExternalKmsProvider.Aws
+ ? "/images/integrations/Amazon Web Services.png"
+ : "/images/integrations/Google Cloud Platform.png";
+
const handleEdit = (popUpName: "editExternalKmsDetails" | "editExternalKmsCredentials") => {
if (subscription && !subscription.externalKms) {
handlePopUpOpen("upgradePlan", {
@@ -54,12 +57,7 @@ export const ExternalKmsItem = ({ kms, handlePopUpOpen, subscription }: Props) =
<TableRow key={kms.id}>
<TableCell>
<div className="flex items-center gap-2">
- {kms.externalKms.provider === ExternalKmsProvider.Aws && (
- <FontAwesomeIcon icon={faAws} className="size-4 text-accent" />
- )}
- {kms.externalKms.provider === ExternalKmsProvider.Gcp && (
- <FontAwesomeIcon icon={faGoogle} className="size-4 text-accent" />
- )}
+ <img src={providerIcon} alt="" className="size-5 object-contain" />
<span className="font-medium text-foreground">
{kms.externalKms.provider.toUpperCase()}
</span>
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/GcpKmsForm.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/GcpKmsForm.tsx
index e14e15ca96..00d8710064 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/GcpKmsForm.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/GcpKmsForm.tsx
@@ -433,6 +433,7 @@ export const GcpKmsForm = ({
isError={Boolean(error)}
onChange={(option) => {
const region = option as SelectOption | null;
+ resetField("keyObject");
field.onChange(region);
fetchGCPKeys({ gcpRegion: region?.value });
}}
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
index 510201b90f..ef558b5fc9 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { KeyRound, Plus, Trash2 } from "lucide-react";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
@@ -23,6 +24,8 @@ import {
EmptyDescription,
EmptyHeader,
EmptyTitle,
+ Input,
+ Label,
Skeleton,
Table,
TableBody,
@@ -55,6 +58,7 @@ type RemoveExternalKmsData = {
export const OrgEncryptionTab = withPermission(
() => {
+ const [deleteConfirmation, setDeleteConfirmation] = useState("");
const { currentOrg, isSubOrganization } = useOrganization();
const { subscription } = useSubscription();
const orgId = currentOrg?.id || "";
@@ -71,9 +75,10 @@ export const OrgEncryptionTab = withPermission(
const { mutateAsync: removeExternalKms, isPending: isRemovingExternalKms } =
useRemoveExternalKms(currentOrg.id);
const removeExternalKmsData = popUp.removeExternalKms.data as RemoveExternalKmsData | undefined;
+ const isDeleteConfirmed = deleteConfirmation === removeExternalKmsData?.name;
const handleRemoveExternalKms = async () => {
- if (!removeExternalKmsData) return;
+ if (!removeExternalKmsData || !isDeleteConfirmed) return;
try {
await removeExternalKms({
@@ -201,7 +206,10 @@ export const OrgEncryptionTab = withPermission(
/>
<AlertDialog
open={popUp.removeExternalKms.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("removeExternalKms", isOpen)}
+ onOpenChange={(isOpen) => {
+ if (!isOpen) setDeleteConfirmation("");
+ handlePopUpToggle("removeExternalKms", isOpen);
+ }}
>
<AlertDialogContent>
<AlertDialogHeader>
@@ -216,6 +224,17 @@ export const OrgEncryptionTab = withPermission(
undone.
</AlertDialogDescription>
</AlertDialogHeader>
+ <div className="flex flex-col gap-2">
+ <Label htmlFor="delete-external-kms-confirmation">
+ Type &quot;{removeExternalKmsData?.name}&quot; to confirm
+ </Label>
+ <Input
+ id="delete-external-kms-confirmation"
+ value={deleteConfirmation}
+ onChange={(event) => setDeleteConfirmation(event.target.value)}
+ autoComplete="off"
+ />
+ </div>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<Button
@@ -223,7 +242,7 @@ export const OrgEncryptionTab = withPermission(
size="sm"
onClick={handleRemoveExternalKms}
isPending={isRemovingExternalKms}
- isDisabled={isRemovingExternalKms}
+ isDisabled={isRemovingExternalKms || !isDeleteConfirmed}
>
Delete
</Button>