Skip to content

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

Merge remote-tracking branch 'origin/main' into pki-revamp-v3

Carlos Monastyrski35b80d294beb
diff --cc frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
index 2deefb599c,5f99a1f90d..367dd7dc56
--- a/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
+++ b/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
@@@ -1,48 -1,20 +1,36 @@@
import { useTranslation } from "react-i18next";
- import {
- faBell,
- faBook,
- faCertificate,
- faCog,
- faFileLines,
- faHome,
- faMobile,
- faPlug,
- faPuzzlePiece,
- faSitemap,
- faStamp,
- faUsers
- } from "@fortawesome/free-solid-svg-icons";
+ import { faMobile } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
- import { Link, Outlet } from "@tanstack/react-router";
+ import { Link, Outlet, useLocation } from "@tanstack/react-router";
import { motion } from "framer-motion";
- import { Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
+ import { Tab, TabList, Tabs } from "@app/components/v2";
-import { useProject, useProjectPermission } from "@app/context";
+import { useProject, useProjectPermission, useSubscription } from "@app/context";
+import {
+ useListWorkspaceCertificateTemplates,
+ useListWorkspacePkiSubscribers
+} from "@app/hooks/api";
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const PkiManagerLayout = () => {
const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
+ const { subscription } = useSubscription();
const { t } = useTranslation();
+ const { data: subscribers = [] } = useListWorkspacePkiSubscribers(currentProject?.id || "");
+ const { data: templatesData } = useListWorkspaceCertificateTemplates({
+ projectId: currentProject?.id || ""
+ });
+ const templates = templatesData?.certificateTemplates || [];
+
+ const hasExistingSubscribers = subscribers.length > 0;
+ const hasExistingTemplates = templates.length > 0;
+ const showLegacySection =
+ subscription.pkiLegacyTemplates || hasExistingSubscribers || hasExistingTemplates;
+
+ const location = useLocation();
return (
<>
<div className="dark hidden h-full w-full flex-col overflow-x-hidden md:flex">
@@@ -53,238 -25,128 +41,146 @@@
animate={{ x: 0 }}
exit={{ x: -150 }}
transition={{ duration: 0.2 }}
- className="dark w-full border-r border-mineshaft-600 bg-linear-to-tr from-mineshaft-700 via-mineshaft-800 to-mineshaft-900 md:w-60"
+ className="px-4"
>
- <nav className="items-between flex h-full flex-col overflow-y-auto dark:scheme-dark">
- <div className="flex items-center gap-3 border-b border-mineshaft-600 px-4 py-3.5 text-lg text-white">
- <Lottie className="inline-block h-5 w-5 shrink-0" icon="note" />
- PKI Manager
- </div>
- <div className="flex-1">
- <Menu>
- <MenuGroup title="Resources">
- <Link
- to="/projects/cert-management/$projectId/policies"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faFileLines} />
- </div>
- Certificate Policies
- </div>
- </MenuItem>
- )}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/certificates"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faCertificate} />
- </div>
- Certificates
- </div>
- </MenuItem>
- )}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/certificate-authorities"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faStamp} />
- </div>
- Certificate Authorities
- </div>
- </MenuItem>
- )}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/alerting"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faBell} />
- </div>
- Alerting
- </div>
- </MenuItem>
- )}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/integrations"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faPuzzlePiece} />
- </div>
- Integrations
- </div>
- </MenuItem>
- )}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/app-connections"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faPlug} />
- </div>
- App Connections
- </div>
- </MenuItem>
- )}
- </Link>
- </MenuGroup>
+ <nav className="w-full">
+ <Tabs value="selected">
+ <TabList className="border-b-0">
+ <Link
- to="/projects/cert-management/$projectId/subscribers"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => <Tab value={isActive ? "selected" : ""}>Subscribers</Tab>}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/certificate-templates"
++ to="/projects/cert-management/$projectId/policies"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
- {({ isActive }) => (
- <Tab value={isActive ? "selected" : ""}>Certificate Templates</Tab>
- )}
++ {({ isActive }) => <Tab value={isActive ? "selected" : ""}>Policies</Tab>}
+ </Link>
+ <Link
+ to="/projects/cert-management/$projectId/certificates"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => (
+ <Tab
+ value={
+ isActive || location.pathname.match(/\/pki-collections\//)
+ ? "selected"
+ : ""
+ }
+ >
+ Certificates
+ </Tab>
+ )}
+ </Link>
+ <Link
+ to="/projects/cert-management/$projectId/certificate-authorities"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => (
+ <Tab value={isActive || location.pathname.match(/\/ca\//) ? "selected" : ""}>
+ Certificate Authorities
+ </Tab>
+ )}
+ </Link>
+ <Link
+ to="/projects/cert-management/$projectId/alerting"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => <Tab value={isActive ? "selected" : ""}>Alerting</Tab>}
+ </Link>
+ <Link
+ to="/projects/cert-management/$projectId/integrations"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => <Tab value={isActive ? "selected" : ""}>Integrations</Tab>}
+ </Link>
+ <Link
+ to="/projects/cert-management/$projectId/app-connections"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => (
+ <Tab value={isActive ? "selected" : ""}>App Connections</Tab>
+ )}
+ </Link>
+ {showLegacySection && (
- <MenuGroup title="Legacy">
++ <>
+ {(subscription.pkiLegacyTemplates || hasExistingSubscribers) && (
+ <Link
+ to="/projects/cert-management/$projectId/subscribers"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => (
- <MenuItem isSelected={isActive} variant="project">
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faSitemap} />
- </div>
- Subscribers
- </div>
- </MenuItem>
++ <Tab value={isActive ? "selected" : ""}>Subscribers (Legacy)</Tab>
+ )}
+ </Link>
+ )}
+ {(subscription.pkiLegacyTemplates || hasExistingTemplates) && (
+ <Link
+ to="/projects/cert-management/$projectId/certificate-templates"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => (
- <MenuItem isSelected={isActive} variant="project">
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faFileLines} />
- </div>
- Certificate Templates
- </div>
- </MenuItem>
++ <Tab value={isActive ? "selected" : ""}>Certificate Templates (Legacy)</Tab>
+ )}
+ </Link>
+ )}
- </MenuGroup>
++ </>
+ )}
- <MenuGroup title="Others">
- <Link
- to="/projects/cert-management/$projectId/access-management"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faUsers} />
- </div>
- Project Access
- </div>
- </MenuItem>
- )}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/audit-logs"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faBook} />
- </div>
- Audit Logs
- </div>
- </MenuItem>
- )}
- </Link>
- <Link
- to="/projects/cert-management/$projectId/settings"
- params={{
- projectId: currentProject.id
- }}
- >
- {({ isActive }) => (
- <MenuItem variant="project" isSelected={isActive}>
- <div className="mx-1 flex gap-2">
- <div className="w-6">
- <FontAwesomeIcon icon={faCog} />
- </div>
- Project Settings
- </div>
- </MenuItem>
- )}
- </Link>
- </MenuGroup>
- </Menu>
- </div>
- <div>
- <Menu>
- <Link to="/organization/projects">
- <MenuItem
- className="relative flex items-center gap-2 overflow-hidden text-sm text-mineshaft-400 hover:text-mineshaft-300"
- leftIcon={
- <div className="w-6">
- <FontAwesomeIcon className="mx-1 inline-block shrink-0" icon={faHome} />
- </div>
- }
- >
- Organization Home
- </MenuItem>
+ <Link
+ to="/projects/cert-management/$projectId/access-management"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => (
+ <Tab
+ value={
+ isActive ||
+ location.pathname.match(/\/groups\/|\/identities\/|\/members\/|\/roles\//)
+ ? "selected"
+ : ""
+ }
+ >
+ Access Control
+ </Tab>
+ )}
+ </Link>
+ <Link
+ to="/projects/cert-management/$projectId/audit-logs"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => <Tab value={isActive ? "selected" : ""}>Audit Logs</Tab>}
</Link>
- </Menu>
- </div>
+ <Link
+ to="/projects/cert-management/$projectId/settings"
+ params={{
+ projectId: currentProject.id
+ }}
+ >
+ {({ isActive }) => <Tab value={isActive ? "selected" : ""}>Settings</Tab>}
+ </Link>
+ </TabList>
+ </Tabs>
</nav>
</motion.div>
- <div className="flex-1 overflow-x-hidden overflow-y-auto bg-bunker-800 p-4 pt-8">
- {assumedPrivilegeDetails && <AssumePrivilegeModeBanner />}
- <Outlet />
- </div>
+ </div>
+ {assumedPrivilegeDetails && <AssumePrivilegeModeBanner />}
+ <div className="flex-1 overflow-x-hidden overflow-y-auto bg-bunker-800 px-12 pt-10 pb-4">
+ <Outlet />
</div>
</div>
<div className="z-200 flex h-screen w-screen flex-col items-center justify-center bg-bunker-800 md:hidden">
diff --cc frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
index ac5bcb7be8,70bac6ecf9..440ebb481b
--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
@@@ -112,31 -112,29 +113,31 @@@ export const PkiTemplateListPage = () =
description="Manage certificate template to request and issue dynamic certificates following a strict format."
/>
</div>
- <div className="container mx-auto mb-6 max-w-7xl rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="container mx-auto mb-6 max-w-8xl rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="mb-4 flex justify-between">
- <p className="text-xl font-medium text-mineshaft-100">Templates</p>
- <div className="flex w-full justify-end">
- <ProjectPermissionCan
- I={ProjectPermissionPkiTemplateActions.Create}
- a={ProjectPermissionSub.CertificateTemplates}
- >
- {(isAllowed) => (
- <Button
- colorSchema="primary"
- type="submit"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => handlePopUpOpen("certificateTemplate")}
- isDisabled={!isAllowed}
- className="ml-4"
- >
- Add Template
- </Button>
- )}
- </ProjectPermissionCan>
+ {subscription?.pkiLegacyTemplates && (
+ <div className="mb-4 flex justify-between">
+ <p className="text-xl font-medium text-mineshaft-100">Templates</p>
+ <div className="flex w-full justify-end">
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiTemplateActions.Create}
+ a={ProjectPermissionSub.CertificateTemplates}
+ >
+ {(isAllowed) => (
+ <Button
+ colorSchema="primary"
+ type="submit"
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ onClick={() => handlePopUpOpen("certificateTemplate")}
+ isDisabled={!isAllowed}
+ className="ml-4"
+ >
+ Add Template
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </div>
</div>
- </div>
+ )}
<TableContainer>
<Table>
<THead>
diff --cc frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx
index 44deedf7d3,0000000000..a00189108f
mode 100644,000000..100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx
@@@ -1,76 -1,0 +1,79 @@@
+import { useState } from "react";
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
+
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { ContentLoader, PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
++import { ProjectType } from "@app/hooks/api/projects/types";
+
+import { CertificateProfilesTab } from "./components/CertificateProfilesTab";
+import { CertificateTemplatesV2Tab } from "./components/CertificateTemplatesV2Tab";
+
+enum TabSections {
+ CertificateProfiles = "profiles",
+ CertificateTemplatesV2 = "templates-v2"
+}
+
+export const PoliciesPage = () => {
+ const { t } = useTranslation();
+ const { currentProject } = useProject();
+ const [activeTab, setActiveTab] = useState(TabSections.CertificateProfiles);
+
+ if (!currentProject) {
+ return <ContentLoader />;
+ }
+
+ return (
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Read}
+ a={ProjectPermissionSub.CertificateAuthorities}
+ >
+ {(isAllowed) => {
+ if (!isAllowed) {
+ return (
- <div className="container mx-auto flex h-full flex-col justify-center bg-bunker-800 text-white">
- <div className="mx-auto mb-6 w-full max-w-7xl text-center">
++ <div className="mx-auto flex h-full flex-col justify-center bg-bunker-800 text-white">
++ <div className="mx-auto mb-6 w-full max-w-8xl text-center">
+ <p>You don&apos;t have permission to access certificate policies.</p>
+ </div>
+ </div>
+ );
+ }
+
+ return (
- <div className="container mx-auto flex h-full flex-col justify-between bg-bunker-800 text-white">
++ <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">
+ <Helmet>
+ <title>{t("common.head-title", { title: "Certificate Policies" })}</title>
+ </Helmet>
- <div className="mx-auto mb-6 w-full max-w-7xl">
++ <div className="mx-auto mb-6 w-full max-w-8xl">
+ <PageHeader
- scope="project"
++ scope={ProjectType.CertificateManager}
+ title="Certificate Policies"
+ description="Manage certificate templates and profiles for unified certificate issuance"
+ />
+
- <Tabs value={activeTab} onValueChange={(value) => setActiveTab(value as TabSections)}>
- <TabList className="w-full">
- <div className="flex w-full border-b border-mineshaft-600">
- <Tab value={TabSections.CertificateProfiles}>Certificate Profiles</Tab>
- <Tab value={TabSections.CertificateTemplatesV2}>Certificate Templates</Tab>
- </div>
++ <Tabs orientation="vertical" value={activeTab} onValueChange={(value) => setActiveTab(value as TabSections)}>
++ <TabList>
++ <Tab variant="project" value={TabSections.CertificateProfiles}>
++ Certificate Profiles
++ </Tab>
++ <Tab variant="project" value={TabSections.CertificateTemplatesV2}>
++ Certificate Templates
++ </Tab>
+ </TabList>
+
+ <TabPanel value={TabSections.CertificateProfiles}>
+ <CertificateProfilesTab />
+ </TabPanel>
+
+ <TabPanel value={TabSections.CertificateTemplatesV2}>
+ <CertificateTemplatesV2Tab />
+ </TabPanel>
+ </Tabs>
+ </div>
+ </div>
+ );
+ }}
+ </ProjectPermissionCan>
+ );
+};