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
Add modal to select default PKI project on multi-project orgs
Carlos Monastyrski3efb188370e9
diff --git a/backend/src/db/migrations/20260504432352_cert-manager-applications.ts b/backend/src/db/migrations/20260504432352_cert-manager-applications.tsindex 15d9a701d7..048685dba6 100644--- a/backend/src/db/migrations/20260504432352_cert-manager-applications.ts+++ b/backend/src/db/migrations/20260504432352_cert-manager-applications.ts@@ -34,20 +34,19 @@ const backfillOrgCertManagerProject = async (knex: Knex, orgId: string) => {const backfillDefaultCertManagerProjectIdForExistingOrgs = async (knex: Knex) => {await knex.raw(`- WITH oldest AS (- SELECT "orgId", MIN("createdAt") AS oldest_at- FROM ?? WHERE type = ? GROUP BY "orgId"- ), pick AS (- SELECT p.id AS project_id, p."orgId"- FROM ?? p- JOIN oldest o ON p."orgId" = o."orgId" AND p."createdAt" = o.oldest_at AND p.type = ?+ WITH pick AS (+ SELECT "orgId", MIN(id) AS project_id+ FROM ??+ WHERE type = ?+ GROUP BY "orgId"+ HAVING COUNT(*) = 1)UPDATE ?? AS oSET "defaultCertManagerProjectId" = pick.project_idFROM pickWHERE o.id = pick."orgId" AND o."defaultCertManagerProjectId" IS NULL;`,- [TableName.Project, PROJECT_TYPE_CERT_MANAGER, TableName.Project, PROJECT_TYPE_CERT_MANAGER, TableName.Organization]+ [TableName.Project, PROJECT_TYPE_CERT_MANAGER, TableName.Organization]);};diff --git a/frontend/src/components/projects/CertManagerNotConfiguredModal.tsx b/frontend/src/components/projects/CertManagerNotConfiguredModal.tsxnew file mode 100644index 0000000000..5396c401fc--- /dev/null+++ b/frontend/src/components/projects/CertManagerNotConfiguredModal.tsx@@ -0,0 +1,64 @@+import { useNavigate } from "@tanstack/react-router";++import {+ Button,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle+} from "@app/components/v3";+import { useOrganization, useOrgPermission } from "@app/context";+import {+ OrgPermissionCertManagerActions,+ OrgPermissionSubjects+} from "@app/context/OrgPermissionContext/types";++type Props = {+ isOpen: boolean;+ onOpenChange: (open: boolean) => void;+};++export const CertManagerNotConfiguredModal = ({ isOpen, onOpenChange }: Props) => {+ const navigate = useNavigate();+ const { currentOrg } = useOrganization();+ const { permission } = useOrgPermission();+ const canManageInstance = permission.can(+ OrgPermissionCertManagerActions.ManageInstance,+ OrgPermissionSubjects.CertManager+ );++ const handleGoToSettings = () => {+ navigate({+ to: "/organizations/$orgId/settings",+ params: { orgId: currentOrg.id },+ search: { selectedTab: "product-settings" }+ });+ onOpenChange(false);+ };++ return (+ <Dialog open={isOpen} onOpenChange={onOpenChange}>+ <DialogContent className="max-w-lg">+ <DialogHeader className="gap-6">+ <DialogTitle>Select an active Certificate Manager instance</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.+ </DialogDescription>+ </DialogHeader>+ <DialogFooter>+ <Button variant="outline" onClick={() => onOpenChange(false)}>+ Close+ </Button>+ {canManageInstance && (+ <Button variant="project" onClick={handleGoToSettings}>+ Go to Settings+ </Button>+ )}+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+};diff --git a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsxindex 5dee996f08..fd7105067a 100644--- a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx+++ b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx@@ -2,6 +2,7 @@ import { useMemo, useState } from "react";import { useNavigate, useParams, useSearch } from "@tanstack/react-router";import { Check, ChevronsUpDown } from "lucide-react";+import { CertManagerNotConfiguredModal } from "@app/components/projects/CertManagerNotConfiguredModal";import { Lottie } from "@app/components/v2";import {Command,@@ -41,6 +42,7 @@ const TypeSelectInner = ({showDivider?: boolean;}) => {const [open, setOpen] = useState(false);+ const [isCertManagerSetupOpen, setIsCertManagerSetupOpen] = useState(false);const navigate = useNavigate();const { currentOrg } = useOrganization();const { data: projects = [] } = useGetUserProjects();@@ -66,6 +68,8 @@ const TypeSelectInner = ({to: "/organizations/$orgId/projects/cert-manager/$projectId/overview",params: { orgId, projectId: certManagerInstance.activeProjectId }});+ } else {+ setIsCertManagerSetupOpen(true);}return;}@@ -96,6 +100,8 @@ const TypeSelectInner = ({projectId: certManagerInstance.activeProjectId}});+ } else {+ setIsCertManagerSetupOpen(true);}} else {navigate({@@ -121,15 +127,13 @@ const TypeSelectInner = ({{PRODUCT_TYPES.map((type) => {const isCertManager = type === ProjectType.CertificateManager;const count = projectCountsByType[type] || 0;- const isCmDisabled = isCertManager && !certManagerInstance?.activeProjectId;return (<CommandItemkey={type}value={getProjectTitle(type)}- disabled={isCmDisabled}- onSelect={() => !isCmDisabled && handleSelectType(type)}- className={`gap-2 ${isCmDisabled ? "cursor-not-allowed opacity-40" : ""}`}+ onSelect={() => handleSelectType(type)}+ className="gap-2"><Check className={currentType === type ? "opacity-100" : "opacity-0"} /><Lottie className="h-4 w-4 shrink-0" icon={getProjectLottieIcon(type)} />@@ -147,6 +151,11 @@ const TypeSelectInner = ({</Command></PopoverContent></Popover>++ <CertManagerNotConfiguredModal+ isOpen={isCertManagerSetupOpen}+ onOpenChange={setIsCertManagerSetupOpen}+ /></div>);};diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsxindex 260ceae02f..9d09362884 100644--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx@@ -54,7 +54,9 @@ export const ApplicationDetailsByIDPage = () => {const { data: application, isPending } = useGetPkiApplicationByName(applicationName ?? "");const { data: profiles = [] } = useListPkiApplicationProfiles(application?.id ?? "");const { data: members = [] } = useListPkiApplicationMembers(application?.id ?? "");- const { data: permissionData } = useGetPkiApplicationPermissions(application?.id ?? "");+ const { data: permissionData, isPending: isPermissionsPending } = useGetPkiApplicationPermissions(+ application?.id ?? ""+ );const deleteApp = useDeletePkiApplication();const [isDeleteOpen, setIsDeleteOpen] = useState(false);const [isIdCopied, setIsIdCopied] = useToggle(false);@@ -116,7 +118,7 @@ export const ApplicationDetailsByIDPage = () => {}};- if (isPending) {+ if (isPending || isPermissionsPending) {return <PageLoader />;}diff --git a/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsx b/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsxindex d61d25d518..9c6cd5054d 100644--- a/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsx+++ b/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsx@@ -20,6 +20,7 @@ import { twMerge } from "tailwind-merge";import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";import { OrgPermissionCan } from "@app/components/permissions";import { NewProjectModal } from "@app/components/projects";+import { CertManagerNotConfiguredModal } from "@app/components/projects/CertManagerNotConfiguredModal";import { RequestProjectAccessModal } from "@app/components/projects/RequestProjectAccessModal";import {Button,@@ -75,6 +76,7 @@ export const ProjectTypePage = () => {const projectType = urlSlugToProjectType(typeSlug) ?? (typeSlug as ProjectType);const { data: certManagerInstance } = useCertManagerInstanceState();+ const [isCertManagerSetupOpen, setIsCertManagerSetupOpen] = useState(false);useEffect(() => {if (projectType === ProjectType.CertificateManager) {@@ -84,16 +86,26 @@ export const ProjectTypePage = () => {params: { orgId, projectId: certManagerInstance.activeProjectId }});} else if (certManagerInstance && !certManagerInstance.activeProjectId) {- navigate({- to: "/organizations/$orgId/projects",- params: { orgId }- });+ setIsCertManagerSetupOpen(true);}}}, [projectType, certManagerInstance, orgId, navigate]);if (projectType === ProjectType.CertificateManager) {- return null;+ return (+ <CertManagerNotConfiguredModal+ isOpen={isCertManagerSetupOpen}+ onOpenChange={(open) => {+ setIsCertManagerSetupOpen(open);+ if (!open) {+ navigate({+ to: "/organizations/$orgId/projects",+ params: { orgId }+ });+ }+ }}+ />+ );}return <ProjectTypeContent projectType={projectType} orgId={orgId} />;diff --git a/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsx b/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsxindex f4b48a8a5f..925ffe0fe3 100644--- a/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsx+++ b/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsx@@ -2,6 +2,7 @@ import { useMemo, useState } from "react";import { useNavigate } from "@tanstack/react-router";import { createNotification } from "@app/components/notifications";+import { CertManagerNotConfiguredModal } from "@app/components/projects/CertManagerNotConfiguredModal";import { RequestProjectAccessModal } from "@app/components/projects/RequestProjectAccessModal";import { Lottie } from "@app/components/v2";import {@@ -45,6 +46,7 @@ export const ProjectCategoryOverview = () => {const orgAdminAccessProject = useOrgAdminAccessProject();const [isRequestAccessOpen, setIsRequestAccessOpen] = useState(false);+ const [isCertManagerSetupOpen, setIsCertManagerSetupOpen] = useState(false);const projectCountsByType = useMemo(() =>@@ -81,7 +83,10 @@ export const ProjectCategoryOverview = () => {const orgId = currentOrg?.id || "";if (type === ProjectType.CertificateManager) {- if (!certManagerActiveProjectId) return;+ if (!certManagerActiveProjectId) {+ setIsCertManagerSetupOpen(true);+ return;+ }if (isMemberOfCertManagerProject) {navigateToCertManager(certManagerActiveProjectId);return;@@ -186,6 +191,11 @@ export const ProjectCategoryOverview = () => {project={requestAccessProject}subTitle="Requesting access to Certificate Manager. You may include an optional note for admins to review your request."/>++ <CertManagerNotConfiguredModal+ isOpen={isCertManagerSetupOpen}+ onOpenChange={setIsCertManagerSetupOpen}+ /></>);};