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
chore: deprecation notice for subscribers and templates
Sheen Capadngan0b8442809a84
diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex 5b295b7bfe..c539de949b 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -215,7 +215,10 @@ export const KeyStorePrefixes = {// period is a YYYY-MM stamp so the monthly notice can only go out once per org per monthNativeIntegrationDeprecationNotice: (orgId: string, period: string) =>- `native-integration-deprecation-notice:${orgId}:${period}` as const+ `native-integration-deprecation-notice:${orgId}:${period}` as const,++ LegacyPkiDeprecationNotice: (orgId: string, period: string) =>+ `legacy-pki-deprecation-notice:${orgId}:${period}` as const};export const KeyStoreTtls = {@@ -284,6 +287,7 @@ export const KeyStoreTtls = {PkiAcmeNonceInSeconds: 300, // 5 minutesSecretReplicationSuccessInSeconds: 10,NativeIntegrationDeprecationNoticeInSeconds: 3888000, // 45 days - outlives one monthly cycle+ LegacyPkiDeprecationNoticeInSeconds: 3888000, // 45 days - outlives one monthly cycleWorkerHeartbeatInSeconds: 300 // 5 minutes - tolerates several missed 60s beats};diff --git a/backend/src/lib/cron/cron-job.ts b/backend/src/lib/cron/cron-job.tsindex 2f7096946d..ebee74f1d9 100644--- a/backend/src/lib/cron/cron-job.ts+++ b/backend/src/lib/cron/cron-job.ts@@ -46,6 +46,7 @@ export const CronJobName = {PamCredentialRotationQueueRotations: "pam-credential-rotation-queue-rotations",PamHeartbeatQueueChecks: "pam-heartbeat-queue-checks",MonthlyNativeIntegrationDeprecationNotice: "monthly-native-integration-deprecation-notice",+ MonthlyLegacyPkiDeprecationNotice: "monthly-legacy-pki-deprecation-notice",DailyAlertProcessing: "daily-alert-processing",EventOutboxStaleClaimSweeper: "event-outbox-stale-claim-sweeper",EventOutboxCleanup: "event-outbox-cleanup",diff --git a/backend/src/queue/queue-service.ts b/backend/src/queue/queue-service.tsindex 43ce40ab86..3354ab8dd7 100644--- a/backend/src/queue/queue-service.ts+++ b/backend/src/queue/queue-service.ts@@ -130,7 +130,8 @@ export enum QueueName {SignerAutoRenewal = "signer-auto-renewal",SecretBlindIndexMigration = "secret-blind-index-migration",UsageEvent = "usage-event",- IntegrationDeprecationNotice = "integration-deprecation-notice"+ IntegrationDeprecationNotice = "integration-deprecation-notice",+ LegacyPkiDeprecationNotice = "legacy-pki-deprecation-notice"}export enum QueueJobs {@@ -220,7 +221,8 @@ export enum QueueJobs {SignerDailyAutoRenewal = "signer-daily-auto-renewal",SecretBlindIndexMigration = "secret-blind-index-migration",UsageEvent = "usage-event-job",- SendIntegrationDeprecationNotice = "send-integration-deprecation-notice"+ SendIntegrationDeprecationNotice = "send-integration-deprecation-notice",+ SendLegacyPkiDeprecationNotice = "send-legacy-pki-deprecation-notice"}export enum JobState {@@ -633,6 +635,11 @@ export type TQueueJobTypes = {// period is a YYYY-MM stamp computed once by the cron tick so every retry of the same fire is deduped alikepayload: { orgId: string; period: string };};+ [QueueName.LegacyPkiDeprecationNotice]: {+ name: QueueJobs.SendLegacyPkiDeprecationNotice;+ // period is a YYYY-MM stamp computed once by the cron tick so every retry of the same fire is deduped alike+ payload: { orgId: string; period: string };+ };};const SECRET_SCANNING_QUEUES = [diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 6ca7dae75b..3d742588d6 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -401,6 +401,8 @@ import { kmsLegacyEncryptionKeyDALFactory } from "@app/services/kms/kms-legacy-eimport { TKmsRootConfigDALFactory } from "@app/services/kms/kms-root-config-dal";import { kmsServiceFactory } from "@app/services/kms/kms-service";import { RootKeyEncryptionStrategy } from "@app/services/kms/kms-types";+import { legacyPkiDeprecationDALFactory } from "@app/services/legacy-pki-deprecation/legacy-pki-deprecation-dal";+import { legacyPkiDeprecationQueueFactory } from "@app/services/legacy-pki-deprecation/legacy-pki-deprecation-queue";import { licenseClientFactory } from "@app/services/license-client";import {buildMeteredFeatures,@@ -1733,6 +1735,7 @@ export const registerRoutes = async (const pkiCollectionDAL = pkiCollectionDALFactory(db);const pkiCollectionItemDAL = pkiCollectionItemDALFactory(db);const pkiSubscriberDAL = pkiSubscriberDALFactory(db);+ const legacyPkiDeprecationDAL = legacyPkiDeprecationDALFactory(db);const pkiSyncDAL = pkiSyncDALFactory(db);const pkiTemplatesDAL = pkiTemplatesDALFactory(db);const pkiDiscoveryConfigDAL = pkiDiscoveryConfigDALFactory(db);@@ -3051,6 +3054,17 @@ export const registerRoutes = async (cronJob});+ const legacyPkiDeprecationQueue = legacyPkiDeprecationQueueFactory({+ legacyPkiDeprecationDAL,+ orgDAL,+ projectMembershipDAL,+ smtpService,+ notificationService,+ keyStore,+ queueService,+ cronJob+ });+const dailyExpiringPkiItemAlert = dailyExpiringPkiItemAlertQueueServiceFactory({cronJob,pkiAlertService@@ -4183,6 +4197,7 @@ export const registerRoutes = async (pkiSubscriberQueue.startDailyAutoRenewalJob();pkiAlertV2Queue.init();integrationDeprecationQueue.init();+ legacyPkiDeprecationQueue.init();certificateCleanupQueue.init();certificateV3Queue.init();digicertCaQueue.init();diff --git a/backend/src/server/routes/v1/deprecated-certificate-template-router.ts b/backend/src/server/routes/v1/deprecated-certificate-template-router.tsindex 1cdd445429..9b0358f141 100644--- a/backend/src/server/routes/v1/deprecated-certificate-template-router.ts+++ b/backend/src/server/routes/v1/deprecated-certificate-template-router.ts@@ -58,7 +58,10 @@ export const registerDeprecatedCertificateTemplateRouter = async (server: Fastif},schema: {hide: false,+ deprecated: true,tags: [ApiDocsTags.PkiCertificateTemplates],+ description:+ "Deprecated. Use certificate applications instead: https://infisical.com/docs/documentation/platform/pki/applications/overview",body: z.object({caId: z.string().describe(CERTIFICATE_TEMPLATES.CREATE.caId),pkiCollectionId: z.string().optional().describe(CERTIFICATE_TEMPLATES.CREATE.pkiCollectionId),diff --git a/backend/src/server/routes/v1/pki-subscriber-router.ts b/backend/src/server/routes/v1/pki-subscriber-router.tsindex 887844ea04..3cd728fbd7 100644--- a/backend/src/server/routes/v1/pki-subscriber-router.ts+++ b/backend/src/server/routes/v1/pki-subscriber-router.ts@@ -74,9 +74,11 @@ export const registerPkiSubscriberRouter = async (server: FastifyZodProvider) =>},schema: {hide: false,+ deprecated: true,operationId: "createPkiSubscriber",tags: [ApiDocsTags.PkiSubscribers],- description: "Create PKI Subscriber",+ description:+ "Create PKI Subscriber. Deprecated, use certificate applications instead: https://infisical.com/docs/documentation/platform/pki/applications/overview",body: z.object({projectId: z.string().trim().describe(PKI_SUBSCRIBERS.CREATE.projectId),caId: zdiff --git a/backend/src/server/routes/v2/pki-templates-router.ts b/backend/src/server/routes/v2/pki-templates-router.tsindex 900d767644..38822e61c8 100644--- a/backend/src/server/routes/v2/pki-templates-router.ts+++ b/backend/src/server/routes/v2/pki-templates-router.ts@@ -23,8 +23,11 @@ export const registerPkiTemplatesRouter = async (server: FastifyZodProvider) =>},schema: {hide: false,+ deprecated: true,operationId: "createPkiTemplate",tags: [ApiDocsTags.PkiCertificateTemplates],+ description:+ "Deprecated. Use certificate applications instead: https://infisical.com/docs/documentation/platform/pki/applications/overview",body: z.object({name: slugSchema(),caName: slugSchema({ field: "caName" }),diff --git a/backend/src/services/legacy-pki-deprecation/legacy-pki-deprecation-dal.ts b/backend/src/services/legacy-pki-deprecation/legacy-pki-deprecation-dal.tsnew file mode 100644index 0000000000..8ec0314f16--- /dev/null+++ b/backend/src/services/legacy-pki-deprecation/legacy-pki-deprecation-dal.ts@@ -0,0 +1,73 @@+import { Knex } from "knex";++import { TDbClient } from "@app/db";+import { TableName } from "@app/db/schemas";+import { DatabaseError } from "@app/lib/errors";++export type TLegacyPkiDeprecationDALFactory = ReturnType<typeof legacyPkiDeprecationDALFactory>;++/**+ * Backs the monthly deprecation notice. Queries the resource tables, never the unindexed FK columns on+ * certificates. Templates have no projectId, so they are scoped through their issuing CA.+ */+export const legacyPkiDeprecationDALFactory = (db: TDbClient) => {+ const subscriberProjectQuery = (conn: Knex) =>+ conn(TableName.PkiSubscriber)+ .join(TableName.Project, `${TableName.PkiSubscriber}.projectId`, `${TableName.Project}.id`)+ .whereNull(`${TableName.Project}.deleteAfter`);++ const templateProjectQuery = (conn: Knex) =>+ conn(TableName.CertificateTemplate)+ .join(+ TableName.CertificateAuthority,+ `${TableName.CertificateTemplate}.caId`,+ `${TableName.CertificateAuthority}.id`+ )+ .join(TableName.Project, `${TableName.CertificateAuthority}.projectId`, `${TableName.Project}.id`)+ .whereNull(`${TableName.Project}.deleteAfter`);++ const findOrgIdsWithLegacyPkiResources = async (tx?: Knex) => {+ try {+ const conn = tx || db.replicaNode();+ const [subscriberOrgIds, templateOrgIds] = await Promise.all([+ subscriberProjectQuery(conn)+ .distinct(db.ref("orgId").withSchema(TableName.Project))+ .pluck<string[]>(`${TableName.Project}.orgId`),+ templateProjectQuery(conn)+ .distinct(db.ref("orgId").withSchema(TableName.Project))+ .pluck<string[]>(`${TableName.Project}.orgId`)+ ]);++ return [...new Set([...subscriberOrgIds, ...templateOrgIds])];+ } catch (error) {+ throw new DatabaseError({ error, name: "FindOrgIdsWithLegacyPkiResources" });+ }+ };++ /** Both empty means the org cleaned up after the notice was enqueued. Split by resource so the+ * notice can link at the page that actually holds something. */+ const findLegacyPkiProjectIdsByOrgId = async (orgId: string, tx?: Knex) => {+ try {+ const conn = tx || db.replicaNode();+ const [subscriberProjectIds, templateProjectIds] = await Promise.all([+ subscriberProjectQuery(conn)+ .where(`${TableName.Project}.orgId`, orgId)+ .distinct(db.ref("id").withSchema(TableName.Project))+ .pluck<string[]>(`${TableName.Project}.id`),+ templateProjectQuery(conn)+ .where(`${TableName.Project}.orgId`, orgId)+ .distinct(db.ref("id").withSchema(TableName.Project))+ .pluck<string[]>(`${TableName.Project}.id`)+ ]);++ return { subscriberProjectIds, templateProjectIds };+ } catch (error) {+ throw new DatabaseError({ error, name: "FindLegacyPkiProjectIdsByOrgId" });+ }+ };++ return {+ findOrgIdsWithLegacyPkiResources,+ findLegacyPkiProjectIdsByOrgId+ };+};diff --git a/backend/src/services/legacy-pki-deprecation/legacy-pki-deprecation-queue.ts b/backend/src/services/legacy-pki-deprecation/legacy-pki-deprecation-queue.tsnew file mode 100644index 0000000000..f952d06f1f--- /dev/null+++ b/backend/src/services/legacy-pki-deprecation/legacy-pki-deprecation-queue.ts@@ -0,0 +1,198 @@+import { OrgMembershipRole, OrgMembershipStatus, ProjectMembershipRole } from "@app/db/schemas";+import { KeyStorePrefixes, KeyStoreTtls, TKeyStoreFactory } from "@app/keystore/keystore";+import { getConfig } from "@app/lib/config/env";+import { CronJobName, TCronJobFactory } from "@app/lib/cron/cron-job";+import { logger } from "@app/lib/logger";+import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";+import { toRecipients } from "@app/services/integration/integration-deprecation-fns";+import { TNotificationServiceFactory } from "@app/services/notification/notification-service";+import { NotificationType } from "@app/services/notification/notification-types";+import { TOrgDALFactory } from "@app/services/org/org-dal";+import { TProjectMembershipDALFactory } from "@app/services/project-membership/project-membership-dal";+import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";++import { TLegacyPkiDeprecationDALFactory } from "./legacy-pki-deprecation-dal";++type TLegacyPkiDeprecationQueueFactoryDep = {+ legacyPkiDeprecationDAL: TLegacyPkiDeprecationDALFactory;+ orgDAL: Pick<TOrgDALFactory, "findOrgMembersByRole">;+ projectMembershipDAL: Pick<TProjectMembershipDALFactory, "findProjectMembersByProjectIds">;+ smtpService: Pick<TSmtpService, "sendMail">;+ notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;+ keyStore: Pick<TKeyStoreFactory, "setItemWithExpiryNX">;+ queueService: TQueueServiceFactory;+ cronJob: TCronJobFactory;+};++export type TLegacyPkiDeprecationQueueFactory = ReturnType<typeof legacyPkiDeprecationQueueFactory>;++// keep in sync with frontend/src/const/legacyPkiDeprecation.ts+const LEGACY_PKI_DEPRECATION_DATE = "December 15, 2026";+const LEGACY_PKI_DEPRECATION_DATE_UTC = new Date("2026-12-15T00:00:00Z");++const EMAIL_SUBJECT = `Certificate templates and subscribers are being removed on ${LEGACY_PKI_DEPRECATION_DATE}`;+// shorter than the subject: the notification dropdown ellipsises it on one line+const NOTIFICATION_TITLE = `Certificate templates and subscribers are being removed ${LEGACY_PKI_DEPRECATION_DATE}`;+const NOTIFICATION_BODY = "Move to certificate applications before then. Existing certificates stay valid.";++/**+ * Monthly nudge toward certificate applications for every org still holding a certificate template or a PKI+ * subscriber. The cron tick enumerates orgs and fans out one job each; an org drops out once it has none left.+ */+export const legacyPkiDeprecationQueueFactory = ({+ legacyPkiDeprecationDAL,+ orgDAL,+ projectMembershipDAL,+ smtpService,+ notificationService,+ keyStore,+ queueService,+ cronJob+}: TLegacyPkiDeprecationQueueFactoryDep) => {+ const sendOrgNotice = async ({ orgId, period }: { orgId: string; period: string }) => {+ const appCfg = getConfig();+ if (!appCfg.SITE_URL) return;++ const claimed = await keyStore.setItemWithExpiryNX(+ KeyStorePrefixes.LegacyPkiDeprecationNotice(orgId, period),+ KeyStoreTtls.LegacyPkiDeprecationNoticeInSeconds,+ "1"+ );+ if (!claimed) {+ logger.info(`legacyPkiDeprecationNotice: already notified [orgId=${orgId}] [period=${period}]`);+ return;+ }++ const [{ subscriberProjectIds, templateProjectIds }, orgAdmins] = await Promise.all([+ legacyPkiDeprecationDAL.findLegacyPkiProjectIdsByOrgId(orgId),+ orgDAL.findOrgMembersByRole(orgId, OrgMembershipRole.Admin)+ ]);++ const projectIds = [...new Set([...subscriberProjectIds, ...templateProjectIds])];++ if (!projectIds.length) {+ logger.info(`legacyPkiDeprecationNotice: org no longer has legacy PKI resources, skipping [orgId=${orgId}]`);+ return;+ }++ const projectAdmins = await projectMembershipDAL.findProjectMembersByProjectIds(projectIds, {+ roles: [ProjectMembershipRole.Admin],+ orgId+ });++ const orgAdminRecipients = toRecipients(+ orgAdmins+ .filter((admin) => admin.status !== OrgMembershipStatus.Invited && admin.user.isActive)+ .map((admin) => ({ userId: admin.user.id, email: admin.user.email }))+ );+ const recipients = [+ ...orgAdminRecipients,+ ...toRecipients(projectAdmins, new Set(orgAdminRecipients.map((recipient) => recipient.userId)))+ ];++ if (!recipients.length) {+ logger.info(`legacyPkiDeprecationNotice: no admins to notify [orgId=${orgId}]`);+ return;+ }++ // relative, since the router resolves notification links against the current location. Only one+ // project to point at, and only at a page that holds something.+ const projectPath = `/organizations/${orgId}/projects/cert-manager/${projectIds[0]}`;+ let link: string | undefined;+ if (projectIds.length === 1) {+ link = subscriberProjectIds.includes(projectIds[0])+ ? `${projectPath}/subscribers`+ : `${projectPath}/certificate-templates`;+ }++ const sendEmail = async () => {+ try {+ await smtpService.sendMail({+ template: SmtpTemplates.LegacyPkiDeprecation,+ subjectLine: EMAIL_SUBJECT,+ recipients: recipients.map((recipient) => recipient.email),+ substitutions: { deprecationDate: LEGACY_PKI_DEPRECATION_DATE }+ });+ } catch (error) {+ logger.error(error, `legacyPkiDeprecationNotice: failed to send email [orgId=${orgId}]`);+ }+ };++ const createNotifications = async () => {+ try {+ await notificationService.createUserNotifications(+ recipients.map((recipient) => ({+ userId: recipient.userId,+ orgId,+ type: NotificationType.LEGACY_PKI_DEPRECATED,+ title: NOTIFICATION_TITLE,+ body: NOTIFICATION_BODY,+ link+ }))+ );+ } catch (error) {+ logger.error(error, `legacyPkiDeprecationNotice: failed to create notifications [orgId=${orgId}]`);+ }+ };++ await Promise.all([sendEmail(), createNotifications()]);++ logger.info(`legacyPkiDeprecationNotice: notice sent [orgId=${orgId}] [period=${period}]`);+ };++ const init = () => {+ const appCfg = getConfig();++ cronJob.register({+ name: CronJobName.MonthlyLegacyPkiDeprecationNotice,+ pattern: "0 0 15 * *",+ // must outlive the longest gap between two fires, or a restarted pod re-enqueues the previous one+ runHashTtlS: 40 * 24 * 60 * 60,+ enabled: !appCfg.isSecondaryInstance,+ handler: async () => {+ if (!appCfg.SITE_URL) {+ logger.info("cron[monthly-legacy-pki-deprecation-notice]: skipped, SITE_URL is not configured");+ return;+ }++ if (new Date() >= LEGACY_PKI_DEPRECATION_DATE_UTC) {+ logger.info("cron[monthly-legacy-pki-deprecation-notice]: skipped, removal date has passed");+ return;+ }++ // YYYY-MM, so retries of this fire dedupe against each other+ const period = new Date().toISOString().slice(0, 7);+ const orgIds = await legacyPkiDeprecationDAL.findOrgIdsWithLegacyPkiResources();++ logger.info(+ `cron[monthly-legacy-pki-deprecation-notice]: enqueuing [orgCount=${orgIds.length}] [period=${period}]`+ );++ await Promise.all(+ orgIds.map((orgId) =>+ queueService.queue(+ QueueName.LegacyPkiDeprecationNotice,+ QueueJobs.SendLegacyPkiDeprecationNotice,+ { orgId, period },+ {+ jobId: `legacy-pki-deprecation-notice-${orgId}-${period}`,+ removeOnComplete: true,+ removeOnFail: true+ }+ )+ )+ );+ }+ });++ queueService.start(+ QueueName.LegacyPkiDeprecationNotice,+ async (job) => {+ await sendOrgNotice(job.data);+ },+ { concurrency: 5, limiter: { max: 20, duration: 1000 } }+ );+ };++ return { init };+};diff --git a/backend/src/services/notification/notification-types.ts b/backend/src/services/notification/notification-types.tsindex f6f012962a..f2b0232f48 100644--- a/backend/src/services/notification/notification-types.ts+++ b/backend/src/services/notification/notification-types.ts@@ -24,7 +24,8 @@ export enum NotificationType {PKI_ALERT_CHANNEL_FAILED = "pki-alert-channel-failed",CREDENTIAL_ROTATION_FAILED = "credential-rotation-failed",AUDIT_LOG_MIGRATION_RECOMMENDED = "audit-log-migration-recommended",- NATIVE_INTEGRATION_DEPRECATED = "native-integration-deprecated"+ NATIVE_INTEGRATION_DEPRECATED = "native-integration-deprecated",+ LEGACY_PKI_DEPRECATED = "legacy-pki-deprecated"}export interface TCreateUserNotificationDTO {diff --git a/backend/src/services/smtp/emails/LegacyPkiDeprecationTemplate.tsx b/backend/src/services/smtp/emails/LegacyPkiDeprecationTemplate.tsxnew file mode 100644index 0000000000..696cdc83a4--- /dev/null+++ b/backend/src/services/smtp/emails/LegacyPkiDeprecationTemplate.tsx@@ -0,0 +1,52 @@+import { Heading, Section, Text } from "@react-email/components";+import React from "react";++import { BaseEmailWrapper, BaseEmailWrapperProps } from "./BaseEmailWrapper";+import { BaseLink } from "./BaseLink";++const PKI_APPLICATIONS_DOCS_URL = "https://infisical.com/docs/documentation/platform/pki/applications/overview";++interface LegacyPkiDeprecationTemplateProps extends Omit<BaseEmailWrapperProps, "title" | "preview" | "children"> {+ deprecationDate: string;+}++export const LegacyPkiDeprecationTemplate = ({ siteUrl, deprecationDate }: LegacyPkiDeprecationTemplateProps) => (+ <BaseEmailWrapper+ title="Certificate templates and subscribers are being removed"+ preview="Move to certificate applications before they are removed"+ siteUrl={siteUrl}+ >+ <Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">+ <strong>Certificate templates and subscribers are being removed</strong>+ </Heading>+ <Section className="px-[24px] mb-[28px] mt-[36px] pt-[12px] pb-[8px] border border-solid border-gray-200 rounded-md bg-gray-50">+ <Text className="text-black text-[14px] leading-[24px]">Hello,</Text>+ <Text className="text-black text-[14px] leading-[24px]">+ Your organization still has certificate templates or subscribers in Infisical Certificate Manager. Both are+ being removed on <strong>{deprecationDate}</strong>. After that date, certificates can no longer be issued+ through them, and any client enrolled against them will stop receiving certificates. Certificates you have+ already issued stay valid.+ </Text>+ <Text className="text-black text-[14px] leading-[24px]">+ Certificate applications replace them.{" "}+ <BaseLink href={PKI_APPLICATIONS_DOCS_URL}>Read about certificate applications</BaseLink>.+ </Text>+ <Text className="text-black text-[14px] leading-[24px]">+ If you have questions or want us to walk through the change with you, reach out to us at{" "}+ <BaseLink href="mailto:[email protected]">[email protected]</BaseLink>.+ </Text>+ <Text className="text-black text-[14px] leading-[24px]">+ Thanks,+ <br />+ The Infisical Team+ </Text>+ </Section>+ </BaseEmailWrapper>+);++export default LegacyPkiDeprecationTemplate;++LegacyPkiDeprecationTemplate.PreviewProps = {+ siteUrl: "https://infisical.com",+ deprecationDate: "December 15, 2026"+} as LegacyPkiDeprecationTemplateProps;diff --git a/backend/src/services/smtp/emails/index.ts b/backend/src/services/smtp/emails/index.tsindex cf807162b3..fa26b422ff 100644--- a/backend/src/services/smtp/emails/index.ts+++ b/backend/src/services/smtp/emails/index.ts@@ -17,6 +17,7 @@ export * from "./ExternalImportSucceededTemplate";export * from "./HealthAlertTemplate";export * from "./HoneyTokenTriggeredTemplate";export * from "./IntegrationSyncFailedTemplate";+export * from "./LegacyPkiDeprecationTemplate";export * from "./MfaRecoveryCodeUsedTemplate";export * from "./NativeIntegrationDeprecationOrgAdminTemplate";export * from "./NativeIntegrationDeprecationProjectAdminTemplate";diff --git a/backend/src/services/smtp/smtp-service.ts b/backend/src/services/smtp/smtp-service.tsindex a879ced3de..303af6e051 100644--- a/backend/src/services/smtp/smtp-service.ts+++ b/backend/src/services/smtp/smtp-service.ts@@ -27,6 +27,7 @@ import {HealthAlertTemplate,HoneyTokenTriggeredTemplate,IntegrationSyncFailedTemplate,+ LegacyPkiDeprecationTemplate,MfaRecoveryCodeUsedTemplate,NativeIntegrationDeprecationOrgAdminTemplate,NativeIntegrationDeprecationProjectAdminTemplate,@@ -95,6 +96,7 @@ export enum SmtpTemplates {SecretApprovalRequestNeedsReview = "secretApprovalRequestNeedsReview",// HistoricalSecretList = "historicalSecretLeakIncident", not used anymore?NewDeviceJoin = "newDevice",+ LegacyPkiDeprecation = "legacyPkiDeprecation",NativeIntegrationDeprecationOrgAdmin = "nativeIntegrationDeprecationOrgAdmin",NativeIntegrationDeprecationProjectAdmin = "nativeIntegrationDeprecationProjectAdmin",OrgInvite = "organizationInvitation",@@ -146,6 +148,7 @@ const EmailTemplateMap: Record<SmtpTemplates, React.FC<any>> = {[SmtpTemplates.SubOrgInvite]: SubOrganizationInvitationTemplate,[SmtpTemplates.OrgAssignment]: OrganizationAssignmentTemplate,[SmtpTemplates.NewDeviceJoin]: NewDeviceLoginTemplate,+ [SmtpTemplates.LegacyPkiDeprecation]: LegacyPkiDeprecationTemplate,[SmtpTemplates.NativeIntegrationDeprecationOrgAdmin]: NativeIntegrationDeprecationOrgAdminTemplate,[SmtpTemplates.NativeIntegrationDeprecationProjectAdmin]: NativeIntegrationDeprecationProjectAdminTemplate,[SmtpTemplates.SignupEmailVerification]: SignupEmailVerificationTemplate,diff --git a/frontend/src/const/legacyPkiDeprecation.ts b/frontend/src/const/legacyPkiDeprecation.tsnew file mode 100644index 0000000000..9baf4c4975--- /dev/null+++ b/frontend/src/const/legacyPkiDeprecation.ts@@ -0,0 +1,7 @@+// keep in sync with backend/src/services/legacy-pki-deprecation/legacy-pki-deprecation-queue.ts+export const LEGACY_PKI_DEPRECATION_DATE = "December 15, 2026";++export enum LegacyPkiResource {+ CertificateTemplate = "certificate_template",+ PkiSubscriber = "pki_subscriber"+}diff --git a/frontend/src/hooks/api/certificateTemplates/mutations.tsx b/frontend/src/hooks/api/certificateTemplates/mutations.tsxindex ed2fc0de01..5993c23b7d 100644--- a/frontend/src/hooks/api/certificateTemplates/mutations.tsx+++ b/frontend/src/hooks/api/certificateTemplates/mutations.tsx@@ -120,7 +120,8 @@ export const useDeleteCertTemplateV2 = () => {return useMutation<TCertificateTemplate, object, TDeleteCertificateTemplateV2DTO>({mutationFn: async (dto) => {const { data } = await apiRequest.delete<{ certificateTemplate: TCertificateTemplate }>(- `/api/v2/pki/certificate-templates/${dto.templateName}`+ `/api/v2/pki/certificate-templates/${dto.templateName}`,+ { data: { projectId: dto.projectId } });return data.certificateTemplate;},diff --git a/frontend/src/hooks/api/certificateTemplates/queries.tsx b/frontend/src/hooks/api/certificateTemplates/queries.tsxindex 329137ab5b..3cb90e524c 100644--- a/frontend/src/hooks/api/certificateTemplates/queries.tsx+++ b/frontend/src/hooks/api/certificateTemplates/queries.tsx@@ -11,7 +11,8 @@ import {export const certTemplateKeys = {getCertTemplateById: (id: string) => [{ id }, "cert-template"],- listTemplates: (el: { limit?: number; offset?: number } = {}) => ["list-template", el] as const,+ listTemplates: (el: { projectId?: string; limit?: number; offset?: number } = {}) =>+ ["list-template", el] as const,getEstConfig: (id: string) => [{ id }, "cert-template-est-config"]};@@ -30,18 +31,20 @@ export const useGetCertTemplate = (id: string) => {};// TODO: DEPRECATE-export const useListCertificateTemplates = ({- limit = 100,- offset = 0-}: TListCertificateTemplatesDTO = {}) => {+export const useListCertificateTemplates = (+ { projectId, limit = 100, offset = 0 }: TListCertificateTemplatesDTO,+ { enabled = true }: { enabled?: boolean } = {}+) => {return useQuery({- queryKey: certTemplateKeys.listTemplates({ limit, offset }),+ enabled: enabled && Boolean(projectId),+ queryKey: certTemplateKeys.listTemplates({ projectId, limit, offset }),queryFn: async () => {const { data } = await apiRequest.get<{certificateTemplates: TCertificateTemplateV2[];totalCount?: number;}>("/api/v2/pki/certificate-templates", {params: {+ projectId,limit,offset}diff --git a/frontend/src/hooks/api/certificateTemplates/types.ts b/frontend/src/hooks/api/certificateTemplates/types.tsindex b5a8cb67de..3726d102d7 100644--- a/frontend/src/hooks/api/certificateTemplates/types.ts+++ b/frontend/src/hooks/api/certificateTemplates/types.ts@@ -87,6 +87,7 @@ export type TUpdateCertificateTemplateV2DTO = {export type TDeleteCertificateTemplateV2DTO = {templateName: string;+ projectId: string;};export type TCreateEstConfigDTO = {@@ -114,6 +115,7 @@ export type TEstConfig = {};export type TListCertificateTemplatesDTO = {+ projectId: string;limit?: number;offset?: number;};diff --git a/frontend/src/hooks/api/pkiSubscriber/mutations.tsx b/frontend/src/hooks/api/pkiSubscriber/mutations.tsxindex efb083f6bd..33db5c4d45 100644--- a/frontend/src/hooks/api/pkiSubscriber/mutations.tsx+++ b/frontend/src/hooks/api/pkiSubscriber/mutations.tsx@@ -26,7 +26,8 @@ export const useCreatePkiSubscriber = () => {});queryClient.invalidateQueries({queryKey: pkiSubscriberKeys.getPkiSubscriber({- subscriberName: name+ subscriberName: name,+ projectId})});}@@ -49,7 +50,8 @@ export const useUpdatePkiSubscriber = () => {});queryClient.invalidateQueries({queryKey: pkiSubscriberKeys.getPkiSubscriber({- subscriberName: name+ subscriberName: name,+ projectId})});}@@ -59,9 +61,10 @@ export const useUpdatePkiSubscriber = () => {export const useDeletePkiSubscriber = () => {const queryClient = useQueryClient();return useMutation<TPkiSubscriber, object, TDeletePkiSubscriberDTO>({- mutationFn: async ({ subscriberName }) => {+ mutationFn: async ({ subscriberName, projectId }) => {const { data: subscriber } = await apiRequest.delete(- `/api/v1/pki/subscribers/${subscriberName}`+ `/api/v1/pki/subscribers/${subscriberName}`,+ { data: { projectId } });return subscriber;},@@ -71,7 +74,8 @@ export const useDeletePkiSubscriber = () => {});queryClient.invalidateQueries({queryKey: pkiSubscriberKeys.getPkiSubscriber({- subscriberName: name+ subscriberName: name,+ projectId})});}@@ -88,11 +92,9 @@ export const useIssuePkiSubscriberCert = () => {);return data;},- onSuccess: (_, { subscriberName }) => {+ onSuccess: () => {queryClient.invalidateQueries({- queryKey: pkiSubscriberKeys.forPkiSubscriberCertificates({- subscriberName- })+ queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates()});}});diff --git a/frontend/src/hooks/api/pkiSubscriber/queries.tsx b/frontend/src/hooks/api/pkiSubscriber/queries.tsxindex f60c734a36..8e4b309589 100644--- a/frontend/src/hooks/api/pkiSubscriber/queries.tsx+++ b/frontend/src/hooks/api/pkiSubscriber/queries.tsx@@ -7,43 +7,58 @@ import { TCertificate } from "../certificates/types";import { TPkiSubscriber } from "./types";export const pkiSubscriberKeys = {- getPkiSubscriber: ({ subscriberName }: { subscriberName: string }) =>- [{ subscriberName }, "pki-subscriber"] as const,+ getPkiSubscriber: ({+ subscriberName,+ projectId+ }: {+ subscriberName: string;+ projectId: string;+ }) => [{ subscriberName, projectId }, "pki-subscriber"] as const,allPkiSubscriberCertificates: () => ["pki-subscriber-certificates"] as const,- forPkiSubscriberCertificates: ({ subscriberName }: { subscriberName: string }) =>- [...pkiSubscriberKeys.allPkiSubscriberCertificates(), subscriberName] as const,+ forPkiSubscriberCertificates: ({+ subscriberName,+ projectId+ }: {+ subscriberName: string;+ projectId: string;+ }) => [...pkiSubscriberKeys.allPkiSubscriberCertificates(), projectId, subscriberName] as const,specificPkiSubscriberCertificates: ({subscriberName,+ projectId,offset,limit}: {subscriberName: string;+ projectId: string;offset: number;limit: number;}) =>[- ...pkiSubscriberKeys.forPkiSubscriberCertificates({ subscriberName }),+ ...pkiSubscriberKeys.forPkiSubscriberCertificates({ subscriberName, projectId }),{ offset, limit }] as const};export const useGetPkiSubscriber = ({- subscriberName+ subscriberName,+ projectId}: {subscriberName: string;+ projectId: string;},options?: TReactQueryOptions["options"]) => {return useQuery({- queryKey: pkiSubscriberKeys.getPkiSubscriber({ subscriberName }),+ queryKey: pkiSubscriberKeys.getPkiSubscriber({ subscriberName, projectId }),queryFn: async () => {const { data: pkiSubscriber } = await apiRequest.get<TPkiSubscriber>(- `/api/v1/pki/subscribers/${subscriberName}`+ `/api/v1/pki/subscribers/${subscriberName}`,+ { params: { projectId } });return pkiSubscriber;},- enabled: Boolean(subscriberName),+ enabled: Boolean(subscriberName) && Boolean(projectId),...options});};@@ -51,10 +66,12 @@ export const useGetPkiSubscriber = (export const useGetPkiSubscriberCertificates = ({subscriberName,+ projectId,offset,limit}: {subscriberName: string;+ projectId: string;offset: number;limit: number;},@@ -63,11 +80,13 @@ export const useGetPkiSubscriberCertificates = (return useQuery({queryKey: pkiSubscriberKeys.specificPkiSubscriberCertificates({subscriberName,+ projectId,offset,limit}),queryFn: async () => {const params = new URLSearchParams({+ projectId,offset: String(offset),limit: String(limit)});@@ -82,7 +101,7 @@ export const useGetPkiSubscriberCertificates = ();return { certificates, totalCount };},- enabled: Boolean(subscriberName),+ enabled: Boolean(subscriberName) && Boolean(projectId),...options});};diff --git a/frontend/src/hooks/api/pkiSubscriber/types.ts b/frontend/src/hooks/api/pkiSubscriber/types.tsindex 8da56d0b5f..d3f6133178 100644--- a/frontend/src/hooks/api/pkiSubscriber/types.ts+++ b/frontend/src/hooks/api/pkiSubscriber/types.ts@@ -70,6 +70,7 @@ export type TUpdatePkiSubscriberDTO = {export type TDeletePkiSubscriberDTO = {subscriberName: string;+ projectId: string;};export type TIssuePkiSubscriberCertDTO = {diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsxindex da8115a29f..9fce2778ab 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx@@ -26,9 +26,11 @@ import {} from "@app/hooks/api/approvalPolicies";import { approvalRequestQuery } from "@app/hooks/api/approvalRequests";import { ApprovalRequestStatus } from "@app/hooks/api/approvalRequests/types";+import { useListCertificateTemplates } from "@app/hooks/api/certificateTemplates/queries";import { useCertManagerInstanceState } from "@app/hooks/api/certManagerInstance";import { useGetPkiAlertsV2 } from "@app/hooks/api/pkiAlertsV2";import { useListPkiSyncs } from "@app/hooks/api/pkiSyncs";+import { useListWorkspacePkiSubscribers } from "@app/hooks/api/projects/queries";import { ProjectNavList } from "./ProjectNavLink";import type { NavItem, Submenu } from "./types";@@ -61,6 +63,13 @@ export const CertManagerNav = ({const { data: syncs } = useListPkiSyncs(projectId, {enabled: isCertManagerAdmin && Boolean(projectId)});+ const { data: legacyTemplates } = useListCertificateTemplates(+ { projectId, limit: 1 },+ { enabled: isCertManagerAdmin }+ );+ const { data: legacySubscribers } = useListWorkspacePkiSubscribers(+ isCertManagerAdmin ? projectId : ""+ );const { data: policies } = useQuery({...approvalPolicyQuery.list({scope: ApprovalPolicyScope.Project,@@ -94,7 +103,14 @@ export const CertManagerNav = ({Boolean(v1AlertsData?.alerts?.length);const hasLegacySyncs = Boolean(syncs?.some((s) => !s.applicationId));const hasLegacyPolicies = Boolean(policies?.some((p) => !p.scopeType));- const hasAnyLegacy = hasLegacyAlerts || hasLegacySyncs || hasLegacyPolicies;+ const hasLegacyTemplates = Boolean(legacyTemplates?.totalCount);+ const hasLegacySubscribers = Boolean(legacySubscribers?.length);+ const hasAnyLegacy =+ hasLegacyAlerts ||+ hasLegacySyncs ||+ hasLegacyPolicies ||+ hasLegacyTemplates ||+ hasLegacySubscribers;const overviewItems: NavItem[] = [{ label: "Dashboard", icon: LayoutDashboard, pathSuffix: "overview" },@@ -183,6 +199,19 @@ export const CertManagerNav = ({pathSuffix: "integrations",search: { selectedTab: "pki-syncs" },hidden: !hasLegacySyncs+ },+ {+ label: "Certificate Templates",+ icon: FileBadge,+ pathSuffix: "certificate-templates",+ hidden: !hasLegacyTemplates+ },+ {+ label: "Subscribers",+ icon: FileKey,+ pathSuffix: "subscribers",+ activeMatch: /\/subscribers\//,+ hidden: !hasLegacySubscribers}];diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsxindex d95a540249..c8ae07a3fd 100644--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx@@ -17,6 +17,7 @@ import {Tooltip} from "@app/components/v2";import { PageHeader } from "@app/components/v3";+import { LegacyPkiResource } from "@app/const/legacyPkiDeprecation";import { ROUTE_PATHS } from "@app/const/routes";import {ProjectPermissionPkiSubscriberActions,@@ -28,6 +29,7 @@ import { useDeletePkiSubscriber, useGetPkiSubscriber } from "@app/hooks/api";import { ProjectType } from "@app/hooks/api/projects/types";import { usePopUp } from "@app/hooks/usePopUp";+import { LegacyPkiDeprecationAlert } from "../components/LegacyPkiDeprecationAlert";import { PkiSubscriberModal } from "../PkiSubscribersPage/components/PkiSubscriberModal";import { PkiSubscriberCertificatesSection, PkiSubscriberDetailsSection } from "./components";@@ -41,7 +43,8 @@ const Page = () => {select: (el) => el.subscriberName});const { data } = useGetPkiSubscriber({- subscriberName+ subscriberName,+ projectId});const { mutateAsync: deletePkiSubscriber } = useDeletePkiSubscriber();@@ -54,7 +57,7 @@ const Page = () => {const onRemoveSubscriberSubmit = async (subscriberNameToDelete: string) => {if (!projectId) return;- await deletePkiSubscriber({ subscriberName: subscriberNameToDelete });+ await deletePkiSubscriber({ subscriberName: subscriberNameToDelete, projectId });createNotification({text: "Successfully deleted subscriber",@@ -126,6 +129,7 @@ const Page = () => {</DropdownMenuContent></DropdownMenu></PageHeader>+ <LegacyPkiDeprecationAlert resource={LegacyPkiResource.PkiSubscriber} /><div className="flex"><div className="mr-4 w-96"><PkiSubscriberDetailsSectiondiff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsxindex e05c8e017f..56a63de1c5 100644--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx@@ -27,6 +27,7 @@ import { Badge } from "@app/components/v3";import {ProjectPermissionPkiSubscriberActions,ProjectPermissionSub,+ useProject,useProjectPermission} from "@app/context";import { useGetPkiSubscriberCertificates } from "@app/hooks/api";@@ -45,12 +46,14 @@ const PER_PAGE_INIT = 25;export const PkiSubscriberCertificatesTable = ({ subscriberName, handlePopUpOpen }: Props) => {const { permission } = useProjectPermission();+ const { currentProject } = useProject();const [page, setPage] = useState(1);const [perPage, setPerPage] = useState(PER_PAGE_INIT);const { data, isPending } = useGetPkiSubscriberCertificates({subscriberName,+ projectId: currentProject.id,offset: (page - 1) * perPage,limit: perPage},diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsxindex 4613ce034b..a8c06c8452 100644--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx@@ -16,6 +16,7 @@ import {import {ProjectPermissionPkiSubscriberActions,ProjectPermissionSub,+ useProject,useProjectPermission} from "@app/context";import { useTimedReset } from "@app/hooks";@@ -44,6 +45,7 @@ type TCertificateDetails = {export const PkiSubscriberDetailsSection = ({ subscriberName, handlePopUpOpen }: Props) => {const { permission } = useProjectPermission();+ const { currentProject } = useProject();const [certificateDetails, setCertificateDetails] = useState<TCertificateDetails | null>(null);const [isModalOpen, setIsModalOpen] = useState(false);const [copyTextId, isCopyingId, setCopyTextId] = useTimedReset<string>({@@ -52,7 +54,8 @@ export const PkiSubscriberDetailsSection = ({ subscriberName, handlePopUpOpen }:const { data: pkiSubscriber } = useGetPkiSubscriber({- subscriberName+ subscriberName,+ projectId: currentProject.id},{refetchInterval: 30_000diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/PkiSubscribersPage.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/PkiSubscribersPage.tsxindex 55275f00b0..edd54d5d56 100644--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/PkiSubscribersPage.tsx+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/PkiSubscribersPage.tsx@@ -2,8 +2,10 @@ import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";import { PageHeader } from "@app/components/v3";+import { LegacyPkiResource } from "@app/const/legacyPkiDeprecation";import { ProjectType } from "@app/hooks/api/projects/types";+import { LegacyPkiDeprecationAlert } from "../components/LegacyPkiDeprecationAlert";import { PkiSubscriberSection } from "./components";export const PkiSubscribersPage = () => {@@ -21,6 +23,7 @@ export const PkiSubscribersPage = () => {title="Subscribers"description="Manage subscribers that request and receive certificates, including user devices, servers, and services."/>+ <LegacyPkiDeprecationAlert resource={LegacyPkiResource.PkiSubscriber} /><PkiSubscriberSection /></div></div>diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsxindex bd3119835e..929997f366 100644--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx@@ -161,7 +161,9 @@ export const PkiSubscriberModal = ({ popUp, handlePopUpToggle }: Props) => {const [tabValue, setTabValue] = useState<FormTab>(FormTab.Configuration);const { data: pkiSubscriber } = useGetPkiSubscriber({- subscriberName: (popUp?.pkiSubscriber?.data as { subscriberName: string })?.subscriberName || ""+ subscriberName:+ (popUp?.pkiSubscriber?.data as { subscriberName: string })?.subscriberName || "",+ projectId});const { mutateAsync: createMutateAsync } = useCreatePkiSubscriber();diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsxindex 1f9181b744..44f62b1ff1 100644--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx@@ -1,9 +1,10 @@-import { faArrowUpRightFromSquare, faPlus } from "@fortawesome/free-solid-svg-icons";+import { faPlus } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";import { Button, DeleteActionModal } from "@app/components/v2";+import { LegacyPkiResource } from "@app/const/legacyPkiDeprecation";import {ProjectPermissionPkiSubscriberActions,ProjectPermissionSub,@@ -13,25 +14,25 @@ import { useDeletePkiSubscriber, useUpdatePkiSubscriber } from "@app/hooks/api";import { PkiSubscriberStatus } from "@app/hooks/api/pkiSubscriber/types";import { usePopUp } from "@app/hooks/usePopUp";+import { LegacyPkiCreationBlockedModal } from "../../components/LegacyPkiCreationBlockedModal";import { PkiSubscriberModal } from "./PkiSubscriberModal";import { PkiSubscribersTable } from "./PkiSubscribersTable";export const PkiSubscriberSection = () => {const { currentProject } = useProject();- // TODO: Use subscription.pkiLegacyTemplates to block legacy templates creation- const canCreateLegacySubscribers = true;const { mutateAsync: deletePkiSubscriber } = useDeletePkiSubscriber();const { mutateAsync: updatePkiSubscriber } = useUpdatePkiSubscriber();const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp(["pkiSubscriber","pkiSubscriberStatus", // enable / disable- "deletePkiSubscriber"+ "deletePkiSubscriber",+ "creationBlocked"] as const);const onRemovePkiSubscriberSubmit = async (subscriberName: string) => {- const subscriber = await deletePkiSubscriber({ subscriberName });+ const subscriber = await deletePkiSubscriber({ subscriberName, projectId: currentProject.id });createNotification({text: `Successfully deleted PKI subscriber: ${subscriber.name}`,@@ -73,42 +74,32 @@ export const PkiSubscriberSection = () => {<div className="mb-4 flex justify-between"><p className="text-xl font-medium text-foreground">Subscribers</p><div className="flex w-full justify-end">- <a- target="_blank"- rel="noopener noreferrer"- href="https://infisical.com/docs/documentation/platform/pki/subscribers"+ <ProjectPermissionCan+ I={ProjectPermissionPkiSubscriberActions.Create}+ a={ProjectPermissionSub.PkiSubscribers}>- <span className="flex w-max cursor-pointer items-center rounded-md border border-border-strong bg-surface-active px-4 py-2 text-foreground-secondary duration-200 hover:border-project/40 hover:bg-project/10 hover:text-foreground-inverse">- Documentation{" "}- <FontAwesomeIcon- icon={faArrowUpRightFromSquare}- className="mb-[0.06rem] ml-1 text-xs"- />- </span>- </a>- {canCreateLegacySubscribers && (- <ProjectPermissionCan- I={ProjectPermissionPkiSubscriberActions.Create}- a={ProjectPermissionSub.PkiSubscribers}- >- {(isAllowed) => (- <Button- colorSchema="primary"- type="submit"- leftIcon={<FontAwesomeIcon icon={faPlus} />}- onClick={() => handlePopUpOpen("pkiSubscriber")}- isDisabled={!isAllowed}- className="ml-4"- >- Add Subscriber- </Button>- )}- </ProjectPermissionCan>- )}+ {(isAllowed) => (+ <Button+ colorSchema="primary"+ type="submit"+ leftIcon={<FontAwesomeIcon icon={faPlus} />}+ onClick={() => handlePopUpOpen("creationBlocked")}+ isDisabled={!isAllowed}+ className="ml-4"+ >+ Add Subscriber+ </Button>+ )}+ </ProjectPermissionCan></div></div><PkiSubscribersTable handlePopUpOpen={handlePopUpOpen} /><PkiSubscriberModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />+ <LegacyPkiCreationBlockedModal+ resource={LegacyPkiResource.PkiSubscriber}+ isOpen={popUp.creationBlocked.isOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("creationBlocked", isOpen)}+ /><DeleteActionModalisOpen={popUp.pkiSubscriberStatus.isOpen}title={`Are you sure you want to ${isEnabling ? "enable" : "disable"} the subscriber ${subscriberName}?`}diff --git a/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx b/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsxindex 588acda31b..309f0948ae 100644--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx@@ -40,10 +40,12 @@ import {Tr} from "@app/components/v2";import { PageHeader } from "@app/components/v3";+import { LegacyPkiResource } from "@app/const/legacyPkiDeprecation";import {ProjectPermissionCertificateActions,ProjectPermissionPkiTemplateActions,ProjectPermissionSub,+ useProject,useSubscription} from "@app/context";import { usePopUp } from "@app/hooks";@@ -53,6 +55,8 @@ import { ProjectType } from "@app/hooks/api/projects/types";import { CertificateModal } from "../CertificatesPage/components/CertificateModal";import { CertificateTemplateEnrollmentModal } from "../CertificatesPage/components/CertificateTemplateEnrollmentModal";+import { LegacyPkiCreationBlockedModal } from "../components/LegacyPkiCreationBlockedModal";+import { LegacyPkiDeprecationAlert } from "../components/LegacyPkiDeprecationAlert";import { PkiTemplateForm } from "./components/PkiTemplateForm";const PER_PAGE_INIT = 25;@@ -66,12 +70,15 @@ export const PkiTemplateListPage = () => {"deleteTemplate","enrollmentOptions","estUpgradePlan",- "certificateFromTemplate"+ "certificateFromTemplate",+ "creationBlocked"] as const);const { subscription } = useSubscription();+ const { currentProject } = useProject();const { data, isPending } = useListCertificateTemplates({+ projectId: currentProject.id,offset: (page - 1) * perPage,limit: perPage});@@ -80,7 +87,8 @@ export const PkiTemplateListPage = () => {const onRemovePkiSubscriberSubmit = async () => {const pkiTemplate = await deleteCertTemplate.mutateAsync({- templateName: popUp?.deleteTemplate?.data?.name+ templateName: popUp?.deleteTemplate?.data?.name,+ projectId: currentProject.id});createNotification({@@ -104,8 +112,8 @@ export const PkiTemplateListPage = () => {title="Certificate Templates"description="Manage certificate template to request and issue dynamic certificates following a strict format."/>+ <LegacyPkiDeprecationAlert resource={LegacyPkiResource.CertificateTemplate} /><div className="container mx-auto mb-6 max-w-8xl rounded-lg border border-border-control bg-surface-base p-4">- {/* TODO: Use subscription.pkiLegacyTemplates to block legacy templates creation */}<div className="mb-4 flex justify-between"><p className="text-xl font-medium text-foreground">Templates</p><div className="flex w-full justify-end">@@ -118,7 +126,7 @@ export const PkiTemplateListPage = () => {colorSchema="primary"type="submit"leftIcon={<FontAwesomeIcon icon={faPlus} />}- onClick={() => handlePopUpOpen("certificateTemplate")}+ onClick={() => handlePopUpOpen("creationBlocked")}isDisabled={!isAllowed}className="ml-4">@@ -307,6 +315,11 @@ export const PkiTemplateListPage = () => {</ModalContent></Modal><CertificateTemplateEnrollmentModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />+ <LegacyPkiCreationBlockedModal+ resource={LegacyPkiResource.CertificateTemplate}+ isOpen={popUp.creationBlocked.isOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("creationBlocked", isOpen)}+ /><CertificateModalpopUp={{certificate: {diff --git a/frontend/src/pages/cert-manager/components/LegacyPkiCreationBlockedModal.tsx b/frontend/src/pages/cert-manager/components/LegacyPkiCreationBlockedModal.tsxnew file mode 100644index 0000000000..01c38fa6eb--- /dev/null+++ b/frontend/src/pages/cert-manager/components/LegacyPkiCreationBlockedModal.tsx@@ -0,0 +1,77 @@+import { useNavigate } from "@tanstack/react-router";++import {+ Button,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle+} from "@app/components/v3";+import { LEGACY_PKI_DEPRECATION_DATE, LegacyPkiResource } from "@app/const/legacyPkiDeprecation";+import { useOrganization, useProject } from "@app/context";+import { useScopeVariant } from "@app/hooks";++import { PkiDocsUrls } from "../pki-docs-urls";++type Props = {+ resource: LegacyPkiResource;+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+};++const RESOURCE_NOUN: Record<LegacyPkiResource, string> = {+ [LegacyPkiResource.CertificateTemplate]: "Certificate templates",+ [LegacyPkiResource.PkiSubscriber]: "Subscribers"+};++// Shown instead of the creation form, which is closed ahead of removal.+export const LegacyPkiCreationBlockedModal = ({ resource, isOpen, onOpenChange }: Props) => {+ const navigate = useNavigate();+ const { currentOrg } = useOrganization();+ const { currentProject } = useProject();+ const scopeVariant = useScopeVariant();++ const noun = RESOURCE_NOUN[resource];++ const handleNavigate = () => {+ navigate({+ to: "/organizations/$orgId/projects/cert-manager/$projectId/applications",+ params: { orgId: currentOrg.id, projectId: currentProject.id }+ });+ onOpenChange(false);+ };++ return (+ <Dialog open={isOpen} onOpenChange={onOpenChange}>+ <DialogContent className="max-w-lg">+ <DialogHeader>+ <DialogTitle>Use Applications Instead</DialogTitle>+ <DialogDescription className="my-4 whitespace-pre-line text-foreground/75">+ {noun} are being removed on {LEGACY_PKI_DEPRECATION_DATE}, and new ones can no longer be+ created. Certificate applications replace them. Your existing {noun.toLowerCase()} keep+ issuing certificates until the removal date.{" "}+ <a+ href={PkiDocsUrls.applications.overview}+ target="_blank"+ rel="noreferrer"+ className="underline hover:opacity-80"+ >+ Read about certificate applications+ </a>+ .+ </DialogDescription>+ </DialogHeader>+ <DialogFooter>+ <Button variant="ghost" onClick={() => onOpenChange(false)}>+ Cancel+ </Button>+ <Button variant={scopeVariant} onClick={handleNavigate}>+ Go to Applications+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+};diff --git a/frontend/src/pages/cert-manager/components/LegacyPkiDeprecationAlert.tsx b/frontend/src/pages/cert-manager/components/LegacyPkiDeprecationAlert.tsxnew file mode 100644index 0000000000..101acac51d--- /dev/null+++ b/frontend/src/pages/cert-manager/components/LegacyPkiDeprecationAlert.tsx@@ -0,0 +1,36 @@+import { TriangleAlertIcon } from "lucide-react";++import { Alert, AlertDescription, AlertTitle } from "@app/components/v3";+import { LEGACY_PKI_DEPRECATION_DATE, LegacyPkiResource } from "@app/const/legacyPkiDeprecation";++import { PkiDocsUrls } from "../pki-docs-urls";++type Props = {+ resource: LegacyPkiResource;+};++const RESOURCE_NOUN: Record<LegacyPkiResource, string> = {+ [LegacyPkiResource.CertificateTemplate]: "Certificate templates",+ [LegacyPkiResource.PkiSubscriber]: "Subscribers"+};++export const LegacyPkiDeprecationAlert = ({ resource }: Props) => (+ <Alert variant="warning">+ <TriangleAlertIcon />+ <AlertTitle>Move to certificate applications</AlertTitle>+ <AlertDescription className="inline">+ {RESOURCE_NOUN[resource]} are being removed on {LEGACY_PKI_DEPRECATION_DATE}. After that date,+ certificates can no longer be issued through them, and any client enrolled against them will+ stop receiving certificates. Certificates you have already issued stay valid.{" "}+ <a+ href={PkiDocsUrls.applications.overview}+ target="_blank"+ rel="noreferrer"+ className="inline underline hover:opacity-80"+ >+ Read about certificate applications+ </a>+ .+ </AlertDescription>+ </Alert>+);