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
Allow applications on active project
Carlos Monastyrski9a176b1d8890
diff --git a/backend/src/server/routes/v1/index.ts b/backend/src/server/routes/v1/index.tsindex ebf5638979..c1dba6c231 100644--- a/backend/src/server/routes/v1/index.ts+++ b/backend/src/server/routes/v1/index.ts@@ -1,3 +1,4 @@+import { BadRequestError } from "@app/lib/errors";import { injectCertManagerProjectId } from "@app/server/plugins/inject-cert-manager-project-id";import {APP_CONNECTION_REGISTER_ROUTER_MAP,@@ -203,7 +204,28 @@ export const registerV1Routes = async (server: FastifyZodProvider) => {{ prefix: "/certificate-profiles" });await pkiRouter.register(registerPkiAlertRouter, { prefix: "/alerts" });- await pkiRouter.register(registerPkiApplicationRouter, { prefix: "/applications" });+ await pkiRouter.register(+ async (applicationsRouter) => {+ applicationsRouter.addHook("preHandler", async (req) => {+ if (!req.permission?.orgId) return;+ const activeProjectId = await applicationsRouter.services.certManagerProjectResolver.getActiveProjectId(+ req.permission.orgId+ );+ if (!activeProjectId) {+ throw new BadRequestError({+ message: "Set an organization default Certificate Manager project before using Applications."+ });+ }+ if (req.internalCertManagerProjectId !== activeProjectId) {+ throw new BadRequestError({+ message: "Applications are only available on this organization's active Certificate Manager project."+ });+ }+ });+ await applicationsRouter.register(registerPkiApplicationRouter);+ },+ { prefix: "/applications" }+ );await pkiRouter.register(registerCertManagerInstanceRouter);await pkiRouter.register(registerCertManagerExportRouter);await pkiRouter.register(registerSignerRouter, { prefix: "/signers" });diff --git a/backend/src/services/cert-manager-instance/cert-manager-project-resolver.ts b/backend/src/services/cert-manager-instance/cert-manager-project-resolver.tsindex e9841b3c3d..603415c7b5 100644--- a/backend/src/services/cert-manager-instance/cert-manager-project-resolver.ts+++ b/backend/src/services/cert-manager-instance/cert-manager-project-resolver.ts@@ -33,6 +33,17 @@ const resolveCertManagerProjectId = async (export type TCertManagerProjectResolverFactory = ReturnType<typeof certManagerProjectResolverFactory>;+const getActiveCertManagerProjectId = async (+ { orgDAL, projectDAL }: TResolverDeps,+ actorOrgId: string+): Promise<string | null> => {+ const projects = await projectDAL.find({ orgId: actorOrgId, type: ProjectType.CertificateManager });+ if (projects.length === 1) return projects[0].id;+ if (projects.length === 0) return null;+ const org = await orgDAL.findById(actorOrgId);+ return org?.defaultCertManagerProjectId ?? null;+};+export const certManagerProjectResolverFactory = (deps: TResolverDeps) => ({resolve: (actorOrgId: string) => resolveCertManagerProjectId(deps, actorOrgId),isCertManagerProject: async (projectId: string, expectedOrgId: string): Promise<boolean> => {@@ -40,5 +51,6 @@ export const certManagerProjectResolverFactory = (deps: TResolverDeps) => ({if (!project) return false;if (project.orgId !== expectedOrgId) return false;return project.type === ProjectType.CertificateManager;- }+ },+ getActiveProjectId: (actorOrgId: string) => getActiveCertManagerProjectId(deps, actorOrgId)});diff --git a/docs/documentation/platform/pki/migration.mdx b/docs/documentation/platform/pki/migration.mdxindex 2cff5bba2f..70a06135ba 100644--- a/docs/documentation/platform/pki/migration.mdx+++ b/docs/documentation/platform/pki/migration.mdx@@ -53,6 +53,10 @@ Your existing setup keeps working. Certificates will keep renewing, alerts willIf your organization has multiple Certificate Manager projects, all of them remain accessible. The designated active project loads by default, and legacy projects can be opened directly to be wound down on your own timeline.+<Note>+ **Applications are scoped to the active project.** Within an organization that contains multiple Certificate Manager projects, the Applications experience is available exclusively on the project designated as active under **Organization Settings → Products → Certificate Manager**. Applications are not supported in legacy projects.+</Note>+**Plan your migration before starting:**1. **Inventory your current setup** — Document your CAs, profiles, alerts, syncs, and approval policies across all projects@@ -71,7 +75,7 @@ If you have CAs, policies, or profiles spread across multiple existing projects,<Steps><Step title="Designate the active project">- Navigate to **Organization Settings → Products → Certificate Manager**. In the projects table, mark the project you intend to consolidate into as **Active**. All members and integrations across the organization will subsequently resolve to this project.+ Navigate to **Organization Settings → Products → Certificate Manager**. In the projects table, mark the project you intend to consolidate into as **Active**. All members and integrations across the organization will subsequently resolve to this project. Designating an active project also unlocks Applications, until one is selected (in organizations with multiple Certificate Manager projects), Applications cannot be created or administered.</Step><Step title="Export entities from legacy projects">@@ -188,6 +192,9 @@ Once you've consolidated your projects (or if you only have one), go to your **a<Accordion title="Why are profiles separate from Applications?">A profile defines what a certificate looks like: one CA, one policy, one set of constraints. A service often needs multiple certificate types. Keeping profiles at the product level lets admins define them once and let multiple Applications consume them, each with their own enrollment methods and access control.</Accordion>+ <Accordion title="Why don't I see Applications in my legacy project?">+ Applications live on your organization's active Certificate Manager project. Designate one under **Organization Settings → Products → Certificate Manager** and Applications will appear there. Legacy projects remain fully accessible for everything else.+ </Accordion></AccordionGroup>## Need Help?diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsxindex 28af2e4b1e..03bbd0a1c4 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx@@ -23,6 +23,7 @@ import {} from "@app/hooks/api/approvalPolicies";import { approvalRequestQuery } from "@app/hooks/api/approvalRequests";import { ApprovalRequestStatus } from "@app/hooks/api/approvalRequests/types";+import { useCertManagerInstanceState } from "@app/hooks/api/certManagerInstance";import { useGetPkiAlertsV2 } from "@app/hooks/api/pkiAlertsV2";import { useListPkiSyncs } from "@app/hooks/api/pkiSyncs";@@ -38,6 +39,10 @@ export const CertManagerNav = ({const { currentProject } = useProject();const isCertManagerAdmin = hasProjectRole("admin");const projectId = currentProject?.id ?? "";+ const { data: certManagerInstance } = useCertManagerInstanceState();+ const isActiveCertManagerProject =+ Boolean(certManagerInstance?.activeProjectId) &&+ certManagerInstance?.activeProjectId === projectId;const { data: v2AlertsData } = useGetPkiAlertsV2({},@@ -156,9 +161,11 @@ export const CertManagerNav = ({<SidebarCollapsibleGroup label="General"><ProjectNavList items={generalItemsForRole} onSubmenuOpen={onSubmenuOpen} /></SidebarCollapsibleGroup>- <SidebarCollapsibleGroup label="Applications">- <ProjectNavList items={applicationItems} onSubmenuOpen={onSubmenuOpen} />- </SidebarCollapsibleGroup>+ {isActiveCertManagerProject ? (+ <SidebarCollapsibleGroup label="Applications">+ <ProjectNavList items={applicationItems} onSubmenuOpen={onSubmenuOpen} />+ </SidebarCollapsibleGroup>+ ) : null}<SidebarCollapsibleGroup label="Code Signing"><ProjectNavList items={codeSigningItems} onSubmenuOpen={onSubmenuOpen} /></SidebarCollapsibleGroup>