Skip to content

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

Simplify cert-renew docs and UI

Carlos Monastyrski18fc28979fab
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index b51ed9b122..5f818cfb36 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -1094,9 +1094,7 @@ export const PROJECTS = {
forPkiSync: "Retrieve only certificates available for PKI sync.",
search: "Search by SAN, CN, certificate ID, or serial number.",
status:
- "Comma-separated list of certificate statuses to filter by. Supported values are active, renewed, expired and revoked. A certificate that has been renewed reports renewed instead of active until it expires or is revoked.",
- lifecycleStatus:
- "The certificate's effective status, derived from whether it is revoked, past its expiry, or has been superseded by a renewal.",
+ "Comma-separated list of certificate statuses to filter by. Supported values are active, renewed, expired and revoked. A certificate superseded by a renewal matches renewed rather than active until it expires or is revoked.",
profileIds: "Filter by certificate profile IDs.",
fromDate: "Filter certificates created from this date.",
toDate: "Filter certificates created until this date.",
@@ -2148,9 +2146,7 @@ export const CERTIFICATES = {
GET: {
id: "The ID of the certificate to get.",
serialNumber: "The serial number of the certificate to get.",
- hasPrivateKey: "Whether Infisical holds the private key for this certificate.",
- lifecycleStatus:
- "The certificate's effective status, derived from whether it is revoked, past its expiry, or has been superseded by a renewal."
+ hasPrivateKey: "Whether Infisical holds the private key for this certificate."
},
RENEW: {
id: "The ID of the certificate to renew.",
diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts
index e596c3347d..d15aff98c9 100644
--- a/backend/src/server/routes/v1/certificate-router.ts
+++ b/backend/src/server/routes/v1/certificate-router.ts
@@ -13,13 +13,7 @@ import { openApiHidden } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { resolveCertificateLifecycleStatus } from "@app/services/certificate/certificate-fns";
-import {
- CertKeyAlgorithm,
- CertSignatureAlgorithm,
- CertStatus,
- CrlReason
-} from "@app/services/certificate/certificate-types";
+import { CertKeyAlgorithm, CertSignatureAlgorithm, CrlReason } from "@app/services/certificate/certificate-types";
import { CaType } from "@app/services/certificate-authority/certificate-authority-enums";
import { validateCaDateField } from "@app/services/certificate-authority/certificate-authority-validators";
import {
@@ -1384,7 +1378,6 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
profileName: z.string().nullable().optional(),
applicationName: z.string().nullable().optional(),
hasPrivateKey: z.boolean().describe(CERTIFICATES.GET.hasPrivateKey),
- lifecycleStatus: z.nativeEnum(CertStatus).describe(CERTIFICATES.GET.lifecycleStatus),
metadata: z.array(z.object({ key: z.string(), value: z.string() })).optional()
})
})
@@ -1413,7 +1406,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
});
return {
- certificate: { ...cert, lifecycleStatus: resolveCertificateLifecycleStatus(cert) }
+ certificate: cert
};
}
});
diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.ts
index 8fb7cf311b..ee0d5a2456 100644
--- a/backend/src/server/routes/v1/project-router.ts
+++ b/backend/src/server/routes/v1/project-router.ts
@@ -26,8 +26,6 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
-import { resolveCertificateLifecycleStatus } from "@app/services/certificate/certificate-fns";
-import { CertStatus } from "@app/services/certificate/certificate-types";
import { CaStatus } from "@app/services/certificate-authority/certificate-authority-enums";
import { sanitizedCertificateTemplate } from "@app/services/certificate-template/certificate-template-schema";
import { validateMicrosoftTeamsChannelsSchema } from "@app/services/microsoft-teams/microsoft-teams-fns";
@@ -1369,7 +1367,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
certificates: z.array(
CertificatesSchema.extend({
hasPrivateKey: z.boolean(),
- lifecycleStatus: z.nativeEnum(CertStatus).describe(PROJECTS.SEARCH_CERTIFICATES.lifecycleStatus),
caName: z.string().nullable().optional(),
profileName: z.string().nullable().optional(),
enrollmentType: z.string().nullable().optional(),
@@ -1397,13 +1394,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
sortBy,
sortOrder
});
- return {
- certificates: certificates.map((certificate) => ({
- ...certificate,
- lifecycleStatus: resolveCertificateLifecycleStatus(certificate)
- })),
- totalCount
- };
+ return { certificates, totalCount };
}
});
diff --git a/backend/src/services/certificate/certificate-dal.ts b/backend/src/services/certificate/certificate-dal.ts
index 3d00dfe261..dc20f185c7 100644
--- a/backend/src/services/certificate/certificate-dal.ts
+++ b/backend/src/services/certificate/certificate-dal.ts
@@ -945,10 +945,10 @@ export const certificateDALFactory = (db: TDbClient) => {
.join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)
.where(`${TableName.CertificateAuthority}.projectId`, projectId)
.where(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED)
- .whereNot((qb) => {
+ .where((qb) => {
void qb
- .whereNotNull(`${TableName.Certificate}.renewedByCertificateId`)
- .andWhere(`${TableName.Certificate}.notAfter`, ">", now);
+ .whereNull(`${TableName.Certificate}.renewedByCertificateId`)
+ .orWhere(`${TableName.Certificate}.notAfter`, "<=", now);
})
.select(
db.raw(
diff --git a/backend/src/services/certificate/certificate-fns.test.ts b/backend/src/services/certificate/certificate-fns.test.ts
index 83deb0db9f..cd5301f463 100644
--- a/backend/src/services/certificate/certificate-fns.test.ts
+++ b/backend/src/services/certificate/certificate-fns.test.ts
@@ -9,10 +9,8 @@ import {
CertificateThumbprintAlgorithm,
extractCertificateFields,
normalizeThumbprint,
- parseCertificateBody,
- resolveCertificateLifecycleStatus
+ parseCertificateBody
} from "./certificate-fns";
-import { CertStatus } from "./certificate-types";
describe("normalizeThumbprint", () => {
const sha1Hex = "a".repeat(40);
@@ -111,53 +109,3 @@ describe("parseCertificateBody usages", () => {
expect(fields.isCA).toBe(false);
});
});
-
-describe("resolveCertificateLifecycleStatus", () => {
- const future = new Date(Date.now() + 90 * 24 * 60 * 60 * 1000);
- const past = new Date(Date.now() - 60 * 1000);
-
- test("reports active when nothing has happened to the certificate", () => {
- expect(resolveCertificateLifecycleStatus({ status: CertStatus.ACTIVE, notAfter: future })).toBe(CertStatus.ACTIVE);
- });
-
- test("reports renewed once a replacement has been issued", () => {
- expect(
- resolveCertificateLifecycleStatus({
- status: CertStatus.ACTIVE,
- notAfter: future,
- renewedByCertificateId: "b7c1f4e2-0000-4000-8000-000000000001"
- })
- ).toBe(CertStatus.RENEWED);
- });
-
- test("prefers expired over renewed", () => {
- expect(
- resolveCertificateLifecycleStatus({
- status: CertStatus.ACTIVE,
- notAfter: past,
- renewedByCertificateId: "b7c1f4e2-0000-4000-8000-000000000001"
- })
- ).toBe(CertStatus.EXPIRED);
- });
-
- test("prefers revoked over both expired and renewed", () => {
- expect(
- resolveCertificateLifecycleStatus({
- status: CertStatus.REVOKED,
- notAfter: past,
- renewedByCertificateId: "b7c1f4e2-0000-4000-8000-000000000001"
- })
- ).toBe(CertStatus.REVOKED);
- });
-
- test("treats the expiry boundary as expired", () => {
- const now = new Date();
- expect(resolveCertificateLifecycleStatus({ status: CertStatus.ACTIVE, notAfter: now })).toBe(CertStatus.EXPIRED);
- });
-
- test("accepts an ISO string notAfter, as returned over the API", () => {
- expect(resolveCertificateLifecycleStatus({ status: CertStatus.ACTIVE, notAfter: future.toISOString() })).toBe(
- CertStatus.ACTIVE
- );
- });
-});
diff --git a/backend/src/services/certificate/certificate-fns.ts b/backend/src/services/certificate/certificate-fns.ts
index 88f03c63ab..d954f7ca38 100644
--- a/backend/src/services/certificate/certificate-fns.ts
+++ b/backend/src/services/certificate/certificate-fns.ts
@@ -13,7 +13,6 @@ import {
CertKeyAlgorithm,
CertKeyUsage,
CertSignatureAlgorithm,
- CertStatus,
CrlReason,
TCertificateFingerprints,
TCertificateSubject,
@@ -21,21 +20,6 @@ import {
TParsedCertificateBody
} from "./certificate-types";
-export const resolveCertificateLifecycleStatus = ({
- status,
- notAfter,
- renewedByCertificateId
-}: {
- status?: string | null;
- notAfter: Date | string;
- renewedByCertificateId?: string | null;
-}): CertStatus => {
- if (status === CertStatus.REVOKED) return CertStatus.REVOKED;
- if (new Date(notAfter) <= new Date()) return CertStatus.EXPIRED;
- if (renewedByCertificateId) return CertStatus.RENEWED;
- return CertStatus.ACTIVE;
-};
-
export const keySizeToAlgorithms = (keySize: number): string[] => {
const map: Record<number, string[]> = {
2048: [CertKeyAlgorithm.RSA_2048],
diff --git a/backend/src/services/certificate/certificate-types.ts b/backend/src/services/certificate/certificate-types.ts
index b6d849af37..321ae1a8e1 100644
--- a/backend/src/services/certificate/certificate-types.ts
+++ b/backend/src/services/certificate/certificate-types.ts
@@ -18,12 +18,6 @@ export enum CertStatus {
RENEWED = "renewed"
}
-export const parseCertificateStatusFilter = (value: string) =>
- value
- .split(",")
- .map((status) => status.trim())
- .filter(Boolean);
-
export enum CertKeyAlgorithm {
RSA_2048 = "RSA_2048",
RSA_3072 = "RSA_3072",
diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.ts
index cf22a48b18..dde4507539 100644
--- a/backend/src/services/project/project-service.ts
+++ b/backend/src/services/project/project-service.ts
@@ -61,7 +61,6 @@ import { TPkiSubscriberDALFactory } from "@app/services/pki-subscriber/pki-subsc
import { TGroupDALFactory } from "../../ee/services/group/group-dal";
import { ActorAuthMethod, ActorType } from "../auth/auth-type";
import { TCertificateDALFactory } from "../certificate/certificate-dal";
-import { parseCertificateStatusFilter } from "../certificate/certificate-types";
import { TCertificateAuthorityDALFactory } from "../certificate-authority/certificate-authority-dal";
import { expandInternalCa } from "../certificate-authority/certificate-authority-fns";
import { TCertificateTemplateDALFactory } from "../certificate-template/certificate-template-dal";
@@ -1352,7 +1351,7 @@ export const projectServiceFactory = ({
...(commonName && { commonName }),
...(search && { search }),
...(status && {
- status: Array.isArray(status) ? status : parseCertificateStatusFilter(status)
+ status: Array.isArray(status) ? status : status.split(",").map((s) => s.trim())
}),
...(profileIds && { profileIds }),
...(fromDate && { fromDate }),
diff --git a/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx b/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx
index 9dd559fc82..6b176972fd 100644
--- a/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx
+++ b/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx
@@ -33,19 +33,7 @@ Install issued certificates on the systems that need them — web servers, load
Replace a certificate before it expires to maintain trust and availability. Renewal can reuse the same key pair or rotate to a new one. In Infisical, renewal can be **server-driven** (Infisical auto-renews and syncs to external systems) or **client-driven** (an agent or workload initiates renewal when key material needs to stay under client control).
-### What happens to the original certificate
-
-Renewal issues a new certificate with a new serial number instead of changing the existing one, because the certificate already installed on your systems has to keep working until the replacement is deployed. Infisical links the two so the relationship is visible from either side:
-
-- The original reports a status of **Renewed** and links to its replacement under **Renewed by**.
-- The replacement reports **Active** and links back under **Renewed from**.
-
-A renewed certificate no longer counts as active in the inventory or on the dashboard and is left out of expiry alerts, and any Certificate Sync attached to it moves to the replacement, so the replacement is what gets pushed to your destinations. It stays cryptographically valid until it expires, which is what gives you a window to roll the replacement out. If the original needs to stop being trusted before then, revoke it.
-
-<Note>
- Renewal never revokes the original certificate. Any client still holding it continues to trust it
- until it expires or you revoke it.
-</Note>
+[Learn more about Certificate Renewal →](/documentation/platform/pki/applications/certificate-renewal)
## Revocation
diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.ts
index c90fa28359..5b43b5e8b5 100644
--- a/frontend/src/hooks/api/certificates/types.ts
+++ b/frontend/src/hooks/api/certificates/types.ts
@@ -46,7 +46,6 @@ export type TCertificate = {
renewedBy?: string;
renewedFromCertificateId?: string;
renewedByCertificateId?: string;
- lifecycleStatus?: CertStatus;
renewalError?: string;
hasPrivateKey?: boolean;
keyAlgorithm?: string | null;
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts
index d3771106dc..a48973c9cd 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts
@@ -15,34 +15,26 @@ export const getCertSourceLabel = (source: TCertificateSource): string => {
}
};
-const CERT_STATUS_PRESENTATION: Record<
- CertStatus,
- { label: string; variant: "success" | "danger" | "neutral" }
-> = {
- [CertStatus.ACTIVE]: { label: "Active", variant: "success" },
- [CertStatus.RENEWED]: { label: "Renewed", variant: "neutral" },
- [CertStatus.EXPIRED]: { label: "Expired", variant: "danger" },
- [CertStatus.REVOKED]: { label: "Revoked", variant: "danger" }
-};
-
type TCertificateStatusSource = {
- lifecycleStatus?: CertStatus;
status?: string | null;
notAfter: string;
renewedByCertificateId?: string | null;
};
-const resolveLifecycleStatus = (certificate: TCertificateStatusSource): CertStatus => {
- if (certificate.lifecycleStatus) return certificate.lifecycleStatus;
- if (certificate.status === CertStatus.REVOKED) return CertStatus.REVOKED;
- if (new Date(certificate.notAfter) < new Date()) return CertStatus.EXPIRED;
- if (certificate.renewedByCertificateId) return CertStatus.RENEWED;
- return CertStatus.ACTIVE;
-};
-
export const getCertificateDisplayStatus = (certificate: TCertificateStatusSource) => {
- const status = resolveLifecycleStatus(certificate);
- return { status, ...CERT_STATUS_PRESENTATION[status] };
+ if (certificate.status === CertStatus.REVOKED) {
+ return { status: CertStatus.REVOKED, label: "Revoked", variant: "danger" as const };
+ }
+
+ if (new Date(certificate.notAfter) < new Date()) {
+ return { status: CertStatus.EXPIRED, label: "Expired", variant: "danger" as const };
+ }
+
+ if (certificate.renewedByCertificateId) {
+ return { status: CertStatus.RENEWED, label: "Renewed", variant: "neutral" as const };
+ }
+
+ return { status: CertStatus.ACTIVE, label: "Active", variant: "success" as const };
};
export const isExpiringWithinOneDay = (notAfter: string): boolean => {