Skip to content

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

improvement(kms): migrate export actions and rotation notice to v3 (#8434)

Andrew Huanga50b2e9a6456
diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekExportKeyModal.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekExportKeyModal.tsx
index 90dd5ac047..3371a97dc6 100644
--- a/frontend/src/pages/kms/OverviewPage/components/CmekExportKeyModal.tsx
+++ b/frontend/src/pages/kms/OverviewPage/components/CmekExportKeyModal.tsx
@@ -2,7 +2,8 @@ import { faCheck, faCopy, faDownload } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import FileSaver from "file-saver";
-import { IconButton, Modal, ModalContent, Spinner, Tooltip } from "@app/components/v2";
+import { Modal, ModalContent } from "@app/components/v2";
+import { IconButton, Spinner, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
import {
ProjectPermissionCmekActions,
ProjectPermissionSub,
@@ -74,7 +75,7 @@ const ExportKeyForm = ({ cmek }: FormProps) => {
if (isLoading) {
return (
<div className="flex items-center justify-center py-8">
- <Spinner size="lg" />
+ <Spinner size="lg" label="Loading key material" />
</div>
);
}
@@ -85,39 +86,45 @@ const ExportKeyForm = ({ cmek }: FormProps) => {
<>
<div className="mb-4 flex items-center justify-between">
<h2>{isAsymmetricKey ? "Private Key (Base64)" : "Key Material (Base64)"}</h2>
- <div className="flex">
- <Tooltip content={copyPrivateKeyText}>
- <IconButton
- ariaLabel="copy icon"
- colorSchema="secondary"
- className="group relative"
- onClick={() => {
- navigator.clipboard.writeText(privateKeyData?.privateKey ?? "");
- setCopyPrivateKeyText("Copied");
- }}
- >
- <FontAwesomeIcon icon={isCopyingPrivateKey ? faCheck : faCopy} />
- </IconButton>
+ <div className="flex gap-2">
+ <Tooltip hoverable selectable={false} delayDuration={50}>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label={isAsymmetricKey ? "Copy Private Key" : "Copy Key Material"}
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ navigator.clipboard.writeText(privateKeyData?.privateKey ?? "");
+ setCopyPrivateKeyText("Copied");
+ }}
+ >
+ <FontAwesomeIcon icon={isCopyingPrivateKey ? faCheck : faCopy} />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent sideOffset={5}>{copyPrivateKeyText}</TooltipContent>
</Tooltip>
- <Tooltip content="Download">
- <IconButton
- ariaLabel="download icon"
- colorSchema="secondary"
- className="group relative ml-2"
- onClick={() => {
- downloadTxtFile(
- `${cmek.name}_${isAsymmetricKey ? "private_key" : "key_material"}`,
- privateKeyData?.privateKey ?? ""
- );
- }}
- >
- <FontAwesomeIcon icon={faDownload} />
- </IconButton>
+ <Tooltip hoverable selectable={false} delayDuration={50}>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label={isAsymmetricKey ? "Download Private Key" : "Download Key Material"}
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ downloadTxtFile(
+ `${cmek.name}_${isAsymmetricKey ? "private_key" : "key_material"}`,
+ privateKeyData?.privateKey ?? ""
+ );
+ }}
+ >
+ <FontAwesomeIcon icon={faDownload} />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent sideOffset={5}>Download</TooltipContent>
</Tooltip>
</div>
</div>
- <div className="mb-8 flex items-center justify-between rounded-md bg-foreground-inverse/[0.07] p-2 text-base text-muted-cool">
- <p className="mr-4 break-all whitespace-pre-wrap">{privateKeyData?.privateKey}</p>
+ <div className="mb-8 rounded-md border border-border bg-container p-2 text-sm text-foreground">
+ <p className="font-mono break-all whitespace-pre-wrap">{privateKeyData?.privateKey}</p>
</div>
</>
)}
@@ -126,36 +133,42 @@ const ExportKeyForm = ({ cmek }: FormProps) => {
<>
<div className="mb-4 flex items-center justify-between">
<h2>Public Key (Base64)</h2>
- <div className="flex">
- <Tooltip content={copyPublicKeyText}>
- <IconButton
- ariaLabel="copy icon"
- colorSchema="secondary"
- className="group relative"
- onClick={() => {
- navigator.clipboard.writeText(publicKeyData?.publicKey ?? "");
- setCopyPublicKeyText("Copied");
- }}
- >
- <FontAwesomeIcon icon={isCopyingPublicKey ? faCheck : faCopy} />
- </IconButton>
+ <div className="flex gap-2">
+ <Tooltip hoverable selectable={false} delayDuration={50}>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Copy Public Key"
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ navigator.clipboard.writeText(publicKeyData?.publicKey ?? "");
+ setCopyPublicKeyText("Copied");
+ }}
+ >
+ <FontAwesomeIcon icon={isCopyingPublicKey ? faCheck : faCopy} />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent sideOffset={5}>{copyPublicKeyText}</TooltipContent>
</Tooltip>
- <Tooltip content="Download">
- <IconButton
- ariaLabel="download icon"
- colorSchema="secondary"
- className="group relative ml-2"
- onClick={() => {
- downloadTxtFile(`${cmek.name}_public_key`, publicKeyData?.publicKey ?? "");
- }}
- >
- <FontAwesomeIcon icon={faDownload} />
- </IconButton>
+ <Tooltip hoverable selectable={false} delayDuration={50}>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Download Public Key"
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ downloadTxtFile(`${cmek.name}_public_key`, publicKeyData?.publicKey ?? "");
+ }}
+ >
+ <FontAwesomeIcon icon={faDownload} />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent sideOffset={5}>Download</TooltipContent>
</Tooltip>
</div>
</div>
- <div className="mb-8 flex items-center justify-between rounded-md bg-foreground-inverse/[0.07] p-2 text-base text-muted-cool">
- <p className="mr-4 break-all whitespace-pre-wrap">{publicKeyData?.publicKey}</p>
+ <div className="mb-8 rounded-md border border-border bg-container p-2 text-sm text-foreground">
+ <p className="font-mono break-all whitespace-pre-wrap">{publicKeyData?.publicKey}</p>
</div>
</>
)}
diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx
index 82d4ce6d8e..2bb3b38af6 100644
--- a/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx
+++ b/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx
@@ -23,7 +23,6 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Spinner } from "@app/components/v2";
import {
Badge,
Button,
@@ -50,6 +49,7 @@ import {
Pagination,
SelectedActionBar,
Skeleton,
+ Spinner,
Table,
TableBody,
TableCell,
@@ -419,7 +419,7 @@ export const CmekTable = () => {
placeholder="Search keys by name or ID..."
/>
</InputGroup>
- {isFetching && <Spinner size="xs" />}
+ {isFetching && <Spinner size="xs" label="Loading keys" />}
</div>
{!isPending && keys.length === 0 ? (
diff --git a/frontend/src/pages/kms/OverviewPage/components/RotateCmekModal.tsx b/frontend/src/pages/kms/OverviewPage/components/RotateCmekModal.tsx
index 7b1f8f2925..5cc552371f 100644
--- a/frontend/src/pages/kms/OverviewPage/components/RotateCmekModal.tsx
+++ b/frontend/src/pages/kms/OverviewPage/components/RotateCmekModal.tsx
@@ -1,6 +1,8 @@
+import { TriangleAlertIcon } from "lucide-react";
+
import { createNotification } from "@app/components/notifications";
import { DeleteActionModal } from "@app/components/v2";
-import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
+import { Alert, AlertDescription } from "@app/components/v3";
import { TCmek, useRotateCmek } from "@app/hooks/api/cmeks";
type Props = {
@@ -40,14 +42,20 @@ export const RotateCmekModal = ({ isOpen, onOpenChange, cmek }: Props) => {
buttonText="Rotate"
onDeleteApproved={handleRotateCmek}
formContent={
- <NoticeBannerV2 title="Data encrypted outside Infisical may be affected" className="mb-4">
- <p className="text-sm text-label">
- Data encrypted through Infisical stays decryptable. However, any system that holds this
- key&apos;s material directly, such as a KMIP client or an exported copy of the key, will
- receive the new material and may be unable to decrypt data it encrypted with the
- previous version. Do not rotate a key that is in use over KMIP.
- </p>
- </NoticeBannerV2>
+ <Alert variant="warning" className="mb-4">
+ <TriangleAlertIcon />
+ <AlertDescription>
+ <p>
+ <strong>Data encrypted outside Infisical may be affected</strong>
+ </p>
+ <p>
+ Data encrypted through Infisical stays decryptable. However, any system that holds
+ this key&apos;s material directly, such as a KMIP client or an exported copy of the
+ key, will receive the new material and may be unable to decrypt data it encrypted with
+ the previous version. Do not rotate a key that is in use over KMIP.
+ </p>
+ </AlertDescription>
+ </Alert>
}
/>
);