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
Cert Manager export project improvements
Carlos Monastyrskib611a39825fd
diff --git a/frontend/src/components/projects/CertManagerNotConfiguredModal.tsx b/frontend/src/components/projects/CertManagerNotConfiguredModal.tsxindex 5396c401fc..727e47cb5c 100644--- a/frontend/src/components/projects/CertManagerNotConfiguredModal.tsx+++ b/frontend/src/components/projects/CertManagerNotConfiguredModal.tsx@@ -42,10 +42,10 @@ export const CertManagerNotConfiguredModal = ({ isOpen, onOpenChange }: Props) =<Dialog open={isOpen} onOpenChange={onOpenChange}><DialogContent className="max-w-lg"><DialogHeader className="gap-6">- <DialogTitle>Select an active Certificate Manager instance</DialogTitle>+ <DialogTitle>Select an active Certificate Manager project</DialogTitle><DialogDescription>Certificate Manager now supports one instance per organization. An organization admin- needs to select the active instance in the Product Settings before you can continue.+ needs to select the active project in the Product Settings before you can continue.</DialogDescription></DialogHeader><DialogFooter>diff --git a/frontend/src/components/projects/CertManagerSelectInstanceModal.tsx b/frontend/src/components/projects/CertManagerSelectInstanceModal.tsxindex 8c11b227a3..aade658e91 100644--- a/frontend/src/components/projects/CertManagerSelectInstanceModal.tsx+++ b/frontend/src/components/projects/CertManagerSelectInstanceModal.tsx@@ -1,7 +1,6 @@import { useEffect, useState } from "react";import {- Badge,Button,Dialog,DialogContent,@@ -43,7 +42,7 @@ export const CertManagerSelectInstanceModal = ({if (isOpen) setSelectedId(orgDefaultProjectId);}, [isOpen, orgDefaultProjectId]);- const handleContinue = () => {+ const handleOpenProject = () => {if (selectedId) onSelect(selectedId);};@@ -51,49 +50,49 @@ export const CertManagerSelectInstanceModal = ({<Dialog open={isOpen} onOpenChange={onOpenChange}><DialogContent className="max-w-lg"><DialogHeader className="gap-4">- <DialogTitle>Select a Certificate Manager instance</DialogTitle>+ <DialogTitle>Select a Certificate Manager project</DialogTitle><DialogDescription>- You have multiple instances from legacy projects. Select your{" "}- <span className="font-medium">organization default</span> for ongoing work. This is- where new CAs, profiles, and Applications live. Legacy projects are still accessible.{" "}+ Your organization has multiple Certificate Manager projects. Select one to continue.+ Once you've consolidated to a single project, this prompt won't appear again.{" "}<ahref="https://infisical.com/docs/documentation/platform/pki/migration"target="_blank"rel="noopener noreferrer"className="text-primary-500 hover:underline">- Deprecation guide+ View the migration guide.</a></DialogDescription></DialogHeader>- <Select value={selectedId ?? undefined} onValueChange={setSelectedId}>- <SelectTrigger className="w-full">- <SelectValue placeholder="Select a project" />- </SelectTrigger>- <SelectContent position="popper" className="max-h-72 w-(--radix-select-trigger-width)">- {instances.map((instance) => (- <SelectItem key={instance.id} value={instance.id}>- <div className="flex min-w-0 flex-1 items-center gap-2">- <span className="truncate font-medium">{instance.name}</span>- <span className="truncate font-mono text-xs text-accent">{instance.slug}</span>- {instance.id === orgDefaultProjectId && (- <Badge variant="org" className="shrink-0">- Organization default- </Badge>- )}- </div>- </SelectItem>- ))}- </SelectContent>- </Select>+ <div className="flex flex-col gap-1.5">+ <span className="text-sm font-medium text-foreground">Certificate Manager project</span>+ <Select value={selectedId ?? undefined} onValueChange={setSelectedId}>+ <SelectTrigger className="w-full">+ <SelectValue placeholder="Select a project" />+ </SelectTrigger>+ <SelectContent position="popper" className="max-h-72 w-(--radix-select-trigger-width)">+ {instances.map((instance) => (+ <SelectItem+ key={instance.id}+ value={instance.id}+ description={+ instance.id === orgDefaultProjectId ? "Organization default" : undefined+ }+ >+ {instance.slug}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div><DialogFooter><Button variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button>- <Button variant="project" isDisabled={!selectedId} onClick={handleContinue}>- Continue+ <Button variant="project" isDisabled={!selectedId} onClick={handleOpenProject}>+ Open</Button></DialogFooter></DialogContent>diff --git a/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsx b/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsxindex ce9822e0e0..015b9987de 100644--- a/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsx+++ b/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsx@@ -16,35 +16,44 @@ export const CertManagerInstanceBanner = () => {const activeProject = data.projects.find((p) => p.id === data.activeProjectId);const isViewingActive = activeProject?.id === projectId;- const message = isViewingActive- ? "This is your organization's active instance. Use this for all work going forward."- : `This project will be retired. Export your CAs, policies, and profiles to your active instance "${activeProject?.name ?? "not set"}", then update your clients and workflows to use it instead.`;-return (<div className="flex w-full items-start gap-x-2 border-b border-yellow/50 bg-yellow/30 px-4 py-2 text-sm text-yellow-200"><FontAwesomeIcon icon={faWarning} className="mt-0.5 shrink-0 text-base text-yellow" />- <p>- {message}{" "}- {isViewingActive ? (+ {isViewingActive ? (+ <p>+ This is your organization's active project. Use this for all work going forward.{" "}<Linkto="/organizations/$orgId/settings"params={{ orgId: currentOrg.id }}search={{ selectedTab: "product-settings" }}className="underline underline-offset-2 hover:text-yellow">- Manage instances+ Manage projects</Link>- ) : (- <a- href="https://infisical.com/docs/documentation/platform/pki/migration"- target="_blank"- rel="noopener noreferrer"- className="underline underline-offset-2 hover:text-yellow"- >- Deprecation guide- </a>- )}- </p>+ </p>+ ) : (+ <p>+ You're viewing a legacy Certificate Manager project.{" "}+ {activeProject ? (+ <Link+ to="/organizations/$orgId/projects/cert-manager/$projectId/overview"+ params={{ orgId: currentOrg.id, projectId: activeProject.id }}+ className="underline underline-offset-2 hover:text-yellow"+ >+ Switch to your active project →+ </Link>+ ) : (+ <a+ href="https://infisical.com/docs/documentation/platform/pki/migration"+ target="_blank"+ rel="noopener noreferrer"+ className="underline underline-offset-2 hover:text-yellow"+ >+ Migration guide+ </a>+ )}+ </p>+ )}</div>);};diff --git a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsxindex eccec12e14..7e0a38751e 100644--- a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx+++ b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx@@ -37,9 +37,11 @@ const PRODUCT_TYPES: ProjectType[] = [const TypeSelectInner = ({currentType,+ currentProjectName,showDivider}: {currentType: ProjectType;+ currentProjectName?: string;showDivider?: boolean;}) => {const [open, setOpen] = useState(false);@@ -96,6 +98,7 @@ const TypeSelectInner = ({};const typeTitle = getProjectTitle(currentType);+ const pillLabel = currentProjectName ?? typeTitle;return (<div@@ -118,7 +121,7 @@ const TypeSelectInner = ({className="group flex cursor-pointer items-center gap-x-2 overflow-hidden text-sm text-white"><Lottie className="h-[14px] w-[14px] shrink-0" icon={getProjectLottieIcon(currentType)} />- <span className="truncate">{typeTitle}</span>+ <span className="truncate">{pillLabel}</span></button><PopoverTrigger asChild><IconButton variant="ghost" size="xs" aria-label="switch-product-type">@@ -169,6 +172,7 @@ export const TypeSelect = () => {const params = useParams({ strict: false });const search = useSearch({ strict: false }) as { fromApplication?: string };const { data: projects = [] } = useGetUserProjects();+ const { data: certManagerInstance } = useCertManagerInstanceState();if (params.type && !params.projectId) {const resolvedType = urlSlugToProjectType(params.type);@@ -185,9 +189,17 @@ export const TypeSelect = () => {const hasApplicationSelect =project.type === ProjectType.CertificateManager && Boolean(applicationName);const hasSiblingProjectSelect = project.type !== ProjectType.CertificateManager;+ const isActiveCertManagerProject =+ project.type === ProjectType.CertificateManager &&+ certManagerInstance?.activeProjectId === project.id;return (<TypeSelectInnercurrentType={project.type}+ currentProjectName={+ project.type === ProjectType.CertificateManager && !isActiveCertManagerProject+ ? project.name+ : undefined+ }showDivider={hasSiblingProjectSelect || hasApplicationSelect}/>);diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/CertManagerExportProjectModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/CertManagerExportProjectModal.tsxindex 72131209b0..cd8df9c8f5 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/CertManagerExportProjectModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/CertManagerExportProjectModal.tsx@@ -1,5 +1,5 @@import { useEffect, useState } from "react";-import { CheckCircle2Icon, CircleHelpIcon, InfoIcon } from "lucide-react";+import { CheckCircle2Icon, InfoIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";import {@@ -11,12 +11,8 @@ import {DialogDescription,DialogFooter,DialogHeader,- DialogTitle,- Tooltip,- TooltipContent,- TooltipTrigger+ DialogTitle} from "@app/components/v3";-import { cn } from "@app/components/v3/utils";import {TCertManagerLegacyInstance,TExportCertManagerProjectResult,@@ -30,60 +26,8 @@ type Props = {activeInstance: TCertManagerLegacyInstance | null;};-const SummaryRow = ({ label, value, muted }: { label: string; value: number; muted?: boolean }) => (- <div- className={cn(- "flex items-center justify-between rounded-sm border border-border px-3 py-2",- muted && "opacity-70"- )}- >- <span className="text-foreground">{label}</span>- <span className="font-mono text-sm font-medium">{value}</span>- </div>-);--const RenameList = ({- title,- tooltip,- items-}: {- title: string;- tooltip: string;- items: { from: string; to: string }[];-}) => {- if (items.length === 0) return null;- return (- <div className="flex flex-col gap-1">- <div className="flex items-center gap-1.5 text-xs font-medium tracking-wide text-accent uppercase">- <span>{title}</span>- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- aria-label={`About ${title}`}- className="text-accent transition-colors hover:text-foreground"- >- <CircleHelpIcon className="h-3.5 w-3.5" />- </button>- </TooltipTrigger>- <TooltipContent className="max-w-xs text-xs normal-case">{tooltip}</TooltipContent>- </Tooltip>- </div>- <ul className="flex flex-col gap-1 text-sm">- {items.map((item) => (- <li- key={`${item.from}->${item.to}`}- className="flex items-center gap-2 rounded-sm border border-border bg-mineshaft-800/30 px-3 py-1.5 font-mono text-xs"- >- <span className="text-foreground">{item.from}</span>- <span className="text-accent">→</span>- <span className="text-foreground">{item.to}</span>- </li>- ))}- </ul>- </div>- );-};+const plural = (n: number, singular: string, pluralForm: string) =>+ `${n} ${n === 1 ? singular : pluralForm}`;export const CertManagerExportProjectModal = ({isOpen,@@ -119,6 +63,13 @@ export const CertManagerExportProjectModal = ({const canExport = Boolean(source && activeInstance && source.id !== activeInstance.id);+ const hasRenames =+ result &&+ result.renamedCertificateAuthorities.length ++ result.renamedCertificatePolicies.length ++ result.renamedCertificateProfiles.length >+ 0;+return (<Dialog open={isOpen} onOpenChange={onOpenChange}><DialogContent className="max-w-lg">@@ -130,63 +81,22 @@ export const CertManagerExportProjectModal = ({Export complete</DialogTitle><DialogDescription>- <span className="font-medium text-foreground">{source?.name}</span> was exported- into the active instance{" "}- <span className="font-medium text-foreground">{activeInstance?.name ?? ""}</span>.+ {plural(+ result.exportedCertificateAuthorities,+ "certificate authority",+ "certificate authorities"+ )}+ , {plural(result.exportedCertificatePolicies, "policy", "policies")}, and{" "}+ {plural(result.exportedCertificateProfiles, "profile", "profiles")} from{" "}+ {source?.name ?? ""} were exported to {activeInstance?.name ?? ""}.+ {hasRenames+ ? " Some resources had name conflicts and were renamed automatically."+ : ""}</DialogDescription></DialogHeader>- <div className="flex max-h-[60vh] flex-col gap-3 overflow-y-auto pr-1 text-sm">- <div className="flex flex-col gap-2">- <SummaryRow- label="Certificate authorities exported"- value={result.exportedCertificateAuthorities}- />- <SummaryRow- label="Certificate policies exported"- value={result.exportedCertificatePolicies}- />- <SummaryRow- label="Certificate profiles exported"- value={result.exportedCertificateProfiles}- />- {result.skippedCertificateProfiles > 0 && (- <SummaryRow- label="Certificate profiles skipped (external CA)"- value={result.skippedCertificateProfiles}- muted- />- )}- </div>-- <RenameList- title="Certificate authorities renamed (name conflicts)"- tooltip="A certificate authority with this name already exists in the active instance. Certificate authority names must be unique within a project, so the exported copy was assigned a new, unique name to avoid the collision."- items={result.renamedCertificateAuthorities.map((r) => ({- from: r.originalName,- to: r.newName- }))}- />- <RenameList- title="Policies renamed (name conflicts)"- tooltip="A certificate policy with this name already exists in the active instance. Certificate policy names must be unique within a project, so the exported copy was assigned a new, unique name to avoid the collision."- items={result.renamedCertificatePolicies.map((r) => ({- from: r.originalName,- to: r.newName- }))}- />- <RenameList- title="Profiles renamed (slug conflicts)"- tooltip="A certificate profile with this slug already exists in the active instance. Certificate profile slugs must be unique within a project, so the exported copy was assigned a new, unique slug to avoid the collision."- items={result.renamedCertificateProfiles.map((r) => ({- from: r.originalSlug,- to: r.newSlug- }))}- />- </div>-<DialogFooter>- <Button variant="project" onClick={() => onOpenChange(false)}>+ <Button variant="ghost" onClick={() => onOpenChange(false)}>Close</Button></DialogFooter>@@ -196,33 +106,17 @@ export const CertManagerExportProjectModal = ({<DialogHeader className="gap-4"><DialogTitle>Export Certificate Manager project</DialogTitle><DialogDescription>- {activeInstance ? (- <>- This will duplicate every internal certificate authority, certificate policy,- and certificate profile from{" "}- <span className="font-medium text-foreground">{source?.name}</span> into your- organization's active Certificate Manager instance,{" "}- <span className="font-medium text-foreground">{activeInstance.name}</span>.- Existing resources in{" "}- <span className="font-medium text-foreground">{source?.name}</span> are not- removed by this export, but as it is scheduled for retirement, all subsequent- work should be performed in the active instance.- </>- ) : (- <>- No active Certificate Manager instance is configured for this organization. An- organization administrator must designate an active instance before any export- can be performed.- </>- )}+ {activeInstance+ ? `All certificate authorities, policies, and profiles from ${source?.name ?? ""} will be copied into ${activeInstance.name}.`+ : "No active Certificate Manager project is configured for this organization. An organization administrator must designate an active project before any export can be performed."}</DialogDescription></DialogHeader><Alert variant="info"><InfoIcon /><AlertDescription>- External certificate authorities are not included in this export. Any profile bound- to one is skipped.+ External certificate authorities and related profiles are not included in this+ export and will be skipped.</AlertDescription></Alert>@@ -236,7 +130,7 @@ export const CertManagerExportProjectModal = ({isDisabled={!canExport}onClick={handleExport}>- Export+ Export to active project</Button></DialogFooter></>diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsxindex f1001fc589..831f8198db 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx@@ -14,7 +14,6 @@ import { DeleteActionModal } from "@app/components/v2";import {Alert,AlertDescription,- AlertTitle,Badge,Button,Dialog,@@ -106,11 +105,11 @@ export const OrgCertManagerTab = () => {await setActive.mutateAsync(pendingActive.id);createNotification({type: "success",- text: `${pendingActive.name} is now the active Certificate Manager instance for the organization.`+ text: `${pendingActive.name} is now the active Certificate Manager project for the organization.`});setPendingActive(null);} catch (err) {- const detail = err instanceof Error ? err.message : "Failed to switch active instance.";+ const detail = err instanceof Error ? err.message : "Failed to switch active project.";createNotification({ type: "error", text: detail });}};@@ -139,20 +138,20 @@ export const OrgCertManagerTab = () => {{isMultiInstance && (<Alert variant="warning" className="mb-4"><TriangleAlertIcon />- <AlertTitle>- Action required: Certificate Manager now supports one project per organization- </AlertTitle><AlertDescription>- Select the project you want to keep as your active instance. All members and- integrations will resolve to it going forward.{" "}- <a- href="https://infisical.com/docs/documentation/platform/pki/migration"- target="_blank"- rel="noopener noreferrer"- className="underline hover:text-mineshaft-200"- >- Deprecation guide- </a>+ <p>+ Your organization has multiple Certificate Manager projects. Going forward, only one+ project per organization is supported. Select your active project and remove the+ others once migrated.{" "}+ <a+ href="https://infisical.com/docs/documentation/platform/pki/migration"+ target="_blank"+ rel="noopener noreferrer"+ className="underline hover:text-mineshaft-200"+ >+ Learn more →+ </a>+ </p></AlertDescription></Alert>)}@@ -188,7 +187,7 @@ export const OrgCertManagerTab = () => {<DropdownMenuContent className="min-w-56" align="end" sideOffset={2}><DropdownMenuItem onClick={() => setPendingExport(instance)}><UploadIcon />- Export to active instance+ Export to active project</DropdownMenuItem><DropdownMenuItem onClick={() => setPendingActive(instance)}><StarIcon />@@ -227,7 +226,7 @@ export const OrgCertManagerTab = () => {<p><span className="font-semibold">{pendingActive?.name ?? ""}</span> will become thedefault for your organization. All members and integrations will resolve to this- instance going forward.+ project going forward.</p></AlertDescription></Alert>