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
feat(cert-manager): show renewed certificates as Renewed instead of Active
Carlos Monastyrski0528c4755c3a
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex dc632fe884..5315095d30 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -1093,7 +1093,8 @@ export const PROJECTS = {limit: "The number of certificates to return.",forPkiSync: "Retrieve only certificates available for PKI sync.",search: "Search by SAN, CN, certificate ID, or serial number.",- status: "Filter by certificate status.",+ 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.",profileIds: "Filter by certificate profile IDs.",fromDate: "Filter certificates created from this date.",toDate: "Filter certificates created until this date.",diff --git a/backend/src/server/routes/v1/certificate-inventory-view-router.ts b/backend/src/server/routes/v1/certificate-inventory-view-router.tsindex 1319b162c6..dd08b67f99 100644--- a/backend/src/server/routes/v1/certificate-inventory-view-router.ts+++ b/backend/src/server/routes/v1/certificate-inventory-view-router.ts@@ -7,10 +7,11 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";import { openApiHidden } from "@app/server/lib/schemas";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { AuthMode } from "@app/services/auth/auth-type";+import { certificateStatusFilterSchema } from "@app/services/certificate/certificate-types";const InventoryViewFiltersSchema = z.object({- status: z.string().max(100).optional(),+ status: certificateStatusFilterSchema.optional(),notAfterTo: z.coerce.date().optional(),notAfterFrom: z.coerce.date().optional(),notBeforeTo: z.coerce.date().optional(),diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.tsindex d1b6b5d8f7..e6b2721d81 100644--- a/backend/src/server/routes/v1/project-router.ts+++ b/backend/src/server/routes/v1/project-router.ts@@ -26,6 +26,7 @@ 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 { certificateStatusFilterSchema } 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";@@ -1263,7 +1264,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {.optional().describe("Retrieve only certificates available for PKI sync"),search: z.string().trim().optional().describe("Search by SAN, CN, certificate ID, or serial number"),- status: z.string().optional().describe("Filter by certificate status"),+ status: certificateStatusFilterSchema.optional().describe(PROJECTS.SEARCH_CERTIFICATES.status),profileIds: z.union([z.string().uuid(), z.array(z.string().uuid())]).transform((val) => (Array.isArray(val) ? val : [val]))@@ -1317,7 +1318,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {limit: z.number().min(1).max(100).default(25).describe(PROJECTS.SEARCH_CERTIFICATES.limit),forPkiSync: z.boolean().default(false).optional().describe(PROJECTS.SEARCH_CERTIFICATES.forPkiSync),search: z.string().trim().optional().describe(PROJECTS.SEARCH_CERTIFICATES.search),- status: z.string().optional().describe(PROJECTS.SEARCH_CERTIFICATES.status),+ status: certificateStatusFilterSchema.optional().describe(PROJECTS.SEARCH_CERTIFICATES.status),profileIds: z.array(z.string().uuid()).optional().describe(PROJECTS.SEARCH_CERTIFICATES.profileIds),fromDate: z.coerce.date().optional().describe(PROJECTS.SEARCH_CERTIFICATES.fromDate),toDate: z.coerce.date().optional().describe(PROJECTS.SEARCH_CERTIFICATES.toDate),@@ -1417,6 +1418,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {totals: z.object({total: z.number(),active: z.number(),+ renewed: z.number(),expiringSoon: z.number(),expired: z.number(),revoked: z.number()diff --git a/backend/src/services/certificate-inventory-view/certificate-inventory-view-service.ts b/backend/src/services/certificate-inventory-view/certificate-inventory-view-service.tsindex d9f41a7660..d5eee7f376 100644--- a/backend/src/services/certificate-inventory-view/certificate-inventory-view-service.ts+++ b/backend/src/services/certificate-inventory-view/certificate-inventory-view-service.ts@@ -49,6 +49,14 @@ const SYSTEM_VIEWS: TSystemView[] = [isSystem: true,createdByUserId: null},+ {+ id: "system-renewed",+ name: "Renewed",+ filters: { status: ["renewed"] },+ columns: null,+ isSystem: true,+ createdByUserId: null+ },{id: "system-expired",name: "Expired",diff --git a/backend/src/services/certificate-profile/certificate-profile-dal.ts b/backend/src/services/certificate-profile/certificate-profile-dal.tsindex 82085f3314..2860c5d6d7 100644--- a/backend/src/services/certificate-profile/certificate-profile-dal.ts+++ b/backend/src/services/certificate-profile/certificate-profile-dal.ts@@ -8,6 +8,7 @@ import {applyProcessedPermissionRulesToQuery,type ProcessedPermissionRules} from "@app/lib/knex/permission-filter-utils";+import { CertStatus } from "@app/services/certificate/certificate-types";import {EnrollmentType,@@ -637,7 +638,7 @@ export const certificateProfileDALFactory = (db: TDbClient) => {options: {offset?: number;limit?: number;- status?: "active" | "expired" | "revoked";+ status?: CertStatus;search?: string;} = {},tx?: Knex@@ -658,13 +659,16 @@ export const certificateProfileDALFactory = (db: TDbClient) => {if (status) {switch (status) {- case "active":- query = query.where("notAfter", ">", now).whereNull("revokedAt");+ case CertStatus.ACTIVE:+ query = query.where("notAfter", ">", now).whereNull("revokedAt").whereNull("renewedByCertificateId");break;- case "expired":+ case CertStatus.RENEWED:+ query = query.where("notAfter", ">", now).whereNull("revokedAt").whereNotNull("renewedByCertificateId");+ break;+ case CertStatus.EXPIRED:query = query.where("notAfter", "<=", now).whereNull("revokedAt");break;- case "revoked":+ case CertStatus.REVOKED:query = query.whereNotNull("revokedAt");break;default:diff --git a/backend/src/services/certificate-profile/certificate-profile-service.test.ts b/backend/src/services/certificate-profile/certificate-profile-service.test.tsindex 3a45e1ddc1..ff26ecefff 100644--- a/backend/src/services/certificate-profile/certificate-profile-service.test.ts+++ b/backend/src/services/certificate-profile/certificate-profile-service.test.ts@@ -11,6 +11,7 @@ import { ForbiddenRequestError, NotFoundError } from "@app/lib/errors";import { ActorType, AuthMethod } from "../auth/auth-type";import type { TCertificateBodyDALFactory } from "../certificate/certificate-body-dal";import type { TCertificateSecretDALFactory } from "../certificate/certificate-secret-dal";+import { CertStatus } from "../certificate/certificate-types";import type { TCertificateAuthorityDALFactory } from "../certificate-authority/certificate-authority-dal";import type { TExternalCertificateAuthorityDALFactory } from "../certificate-authority/external-certificate-authority-dal";import type { TCertificatePolicyDALFactory } from "../certificate-policy/certificate-policy-dal";@@ -719,14 +720,14 @@ describe("CertificateProfileService", () => {profileId: "profile-123",offset: 10,limit: 5,- status: "active",+ status: CertStatus.ACTIVE,search: "example"});expect(mockCertificateProfileDAL.getCertificatesByProfile).toHaveBeenCalledWith("profile-123", {offset: 10,limit: 5,- status: "active",+ status: CertStatus.ACTIVE,search: "example"});});@@ -927,14 +928,14 @@ describe("CertificateProfileService", () => {const result = await service.getProfileCertificates({...mockActor,profileId: "profile-123",- status: "active"+ status: CertStatus.ACTIVE});expect(result).toEqual(activeCerts);expect(mockCertificateProfileDAL.getCertificatesByProfile).toHaveBeenCalledWith("profile-123", {offset: 0,limit: 20,- status: "active",+ status: CertStatus.ACTIVE,search: undefined});});diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.tsindex 0ca3a602fe..cd43d5981b 100644--- a/backend/src/services/certificate-profile/certificate-profile-service.ts+++ b/backend/src/services/certificate-profile/certificate-profile-service.ts@@ -27,6 +27,7 @@ import { ActorAuthMethod, ActorType } from "../auth/auth-type";import { TCertificateBodyDALFactory } from "../certificate/certificate-body-dal";import { getCertificateCredentials, isCertChainValid } from "../certificate/certificate-fns";import { TCertificateSecretDALFactory } from "../certificate/certificate-secret-dal";+import { CertStatus } from "../certificate/certificate-types";import { TCertificateAuthorityCertDALFactory } from "../certificate-authority/certificate-authority-cert-dal";import { TCertificateAuthorityDALFactory } from "../certificate-authority/certificate-authority-dal";import { CaType } from "../certificate-authority/certificate-authority-enums";@@ -1365,7 +1366,7 @@ export const certificateProfileServiceFactory = ({profileId: string;offset?: number;limit?: number;- status?: "active" | "expired" | "revoked";+ status?: CertStatus;search?: string;}): Promise<TCertificateProfileCertificate[]> => {const profile = await certificateProfileDAL.findById(profileId);diff --git a/backend/src/services/certificate/certificate-dal.ts b/backend/src/services/certificate/certificate-dal.tsindex 6f24bcdba9..86de261de6 100644--- a/backend/src/services/certificate/certificate-dal.ts+++ b/backend/src/services/certificate/certificate-dal.ts@@ -163,7 +163,15 @@ export const certificateDALFactory = (db: TDbClient) => {void qb[whereMethod]((innerQb: Knex.QueryBuilder) => {void innerQb.where(`${TableName.Certificate}.notAfter`, ">", now)- .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED);+ .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED)+ .whereNull(`${TableName.Certificate}.renewedByCertificateId`);+ });+ } else if (statusValue === CertStatus.RENEWED) {+ void qb[whereMethod]((innerQb: Knex.QueryBuilder) => {+ void innerQb+ .where(`${TableName.Certificate}.notAfter`, ">", now)+ .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED)+ .whereNotNull(`${TableName.Certificate}.renewedByCertificateId`);});} else if (statusValue === CertStatus.EXPIRED) {void qb[whereMethod]((innerQb: Knex.QueryBuilder) => {@@ -811,6 +819,7 @@ export const certificateDALFactory = (db: TDbClient) => {interface TotalsRow {total: number;active: number;+ renewed: number;expiringSoon: number;expired: number;revoked: number;@@ -839,11 +848,15 @@ export const certificateDALFactory = (db: TDbClient) => {.select(db.raw("COUNT(*)::int as total"),db.raw(- `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."status" != ?)::int as active`,+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."status" != ? AND "${TableName.Certificate}"."renewedByCertificateId" IS NULL)::int as active`,+ [now, CertStatus.REVOKED]+ ),+ db.raw(+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."status" != ? AND "${TableName.Certificate}"."renewedByCertificateId" IS NOT NULL)::int as renewed`,[now, CertStatus.REVOKED]),db.raw(- `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ?)::int as "expiringSoon"`,+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ? AND "${TableName.Certificate}"."renewedByCertificateId" IS NULL)::int as "expiringSoon"`,[now, thirtyDaysFromNow, CertStatus.REVOKED]),db.raw(@@ -854,7 +867,7 @@ export const certificateDALFactory = (db: TDbClient) => {CertStatus.REVOKED]),db.raw(- `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ? AND "${TableName.Certificate}"."renewBeforeDays" IS NULL)::int as "expiringSoonNoAutoRenewal"`,+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ? AND "${TableName.Certificate}"."renewedByCertificateId" IS NULL AND "${TableName.Certificate}"."renewBeforeDays" IS NULL)::int as "expiringSoonNoAutoRenewal"`,[now, thirtyDaysFromNow, CertStatus.REVOKED]),db.raw(@@ -884,6 +897,7 @@ export const certificateDALFactory = (db: TDbClient) => {const byStatus = [{ label: "Active", count: totals.active },+ { label: "Renewed", count: totals.renewed },{ label: "Expired", count: totals.expired },{ label: "Revoked", count: totals.revoked }];@@ -970,6 +984,7 @@ export const certificateDALFactory = (db: TDbClient) => {totals: {total: totals.total,active: totals.active,+ renewed: totals.renewed,expiringSoon: totals.expiringSoon,expired: totals.expired,revoked: totals.revokeddiff --git a/backend/src/services/certificate/certificate-types.ts b/backend/src/services/certificate/certificate-types.tsindex 5ea82d6761..c20c3affb0 100644--- a/backend/src/services/certificate/certificate-types.ts+++ b/backend/src/services/certificate/certificate-types.ts@@ -1,3 +1,5 @@+import { z } from "zod";+import { TProjectPermission } from "@app/lib/types";import {CERT_EXTENDED_KEY_USAGES,@@ -14,9 +16,31 @@ import { TCertificateSecretDALFactory } from "./certificate-secret-dal";export enum CertStatus {ACTIVE = "active",EXPIRED = "expired",- REVOKED = "revoked"+ REVOKED = "revoked",+ RENEWED = "renewed"}+export const parseCertificateStatusFilter = (value: string) =>+ value+ .split(",")+ .map((status) => status.trim())+ .filter(Boolean);++export const certificateStatusFilterSchema = z+ .string()+ .trim()+ .max(100)+ .refine(+ (value) => {+ const statuses = parseCertificateStatusFilter(value);+ const allowed = Object.values(CertStatus) as string[];+ return statuses.length > 0 && statuses.every((status) => allowed.includes(status));+ },+ {+ message: `Certificate status filter must be a comma-separated list of: ${Object.values(CertStatus).join(", ")}.`+ }+ );+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.tsindex dde4507539..cf22a48b18 100644--- a/backend/src/services/project/project-service.ts+++ b/backend/src/services/project/project-service.ts@@ -61,6 +61,7 @@ import { TPkiSubscriberDALFactory } from "@app/services/pki-subscriber/pki-subscimport { 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";@@ -1351,7 +1352,7 @@ export const projectServiceFactory = ({...(commonName && { commonName }),...(search && { search }),...(status && {- status: Array.isArray(status) ? status : status.split(",").map((s) => s.trim())+ status: Array.isArray(status) ? status : parseCertificateStatusFilter(status)}),...(profileIds && { profileIds }),...(fromDate && { fromDate }),diff --git a/docs/documentation/platform/pki/applications/certificate-renewal.mdx b/docs/documentation/platform/pki/applications/certificate-renewal.mdxindex 940e779ecb..921cf5ce8e 100644--- a/docs/documentation/platform/pki/applications/certificate-renewal.mdx+++ b/docs/documentation/platform/pki/applications/certificate-renewal.mdx@@ -140,7 +140,9 @@ Sending a property the CSR already carries is rejected rather than quietly ignorThe renewal produces a new certificate with its own serial number, linked to the one it replaced.+- The previous certificate reports a status of **Renewed** rather than **Active**, and links to its replacement under **Renewed by**. The replacement links back under **Renewed from**.- The previous certificate stays valid until its own expiry, so you can roll over on your own schedule. It cannot be renewed a second time.+- Because it is no longer the current certificate, it drops out of the active count on the dashboard and out of expiry alerts. Filter the inventory by the **Renewed** status, or open the **Renewed** view, to list every certificate that has been superseded.- Metadata carries over to the renewed certificate.- Certificate syncs attached to the certificate move to the renewed one and push it to their destinations.- Automatic renewal carries over. A certificate set to renew 4 days before expiry keeps that window, measured against the renewed certificate's own expiry rather than the previous one.diff --git a/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx b/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdxindex 612c5c75e0..9dd559fc82 100644--- a/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx+++ b/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx@@ -33,6 +33,20 @@ Install issued certificates on the systems that need them — web servers, loadReplace 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>+## RevocationInvalidate a certificate when it's compromised, misconfigured, or no longer needed. The CA publishes revocation status through CRLs (Certificate Revocation Lists) or OCSP (Online Certificate Status Protocol) so clients know not to trust the certificate. A new certificate can be issued and deployed as a replacement.diff --git a/frontend/src/hooks/api/certificates/constants.tsx b/frontend/src/hooks/api/certificates/constants.tsxindex cb21f03f89..9c55b1d272 100644--- a/frontend/src/hooks/api/certificates/constants.tsx+++ b/frontend/src/hooks/api/certificates/constants.tsx@@ -1,26 +1,4 @@-import {- CertExtendedKeyUsage,- CertKeyAlgorithm,- CertKeyUsage,- CertStatus,- CrlReason-} from "./enums";--export const certStatusToNameMap: { [K in CertStatus]: string } = {- [CertStatus.ACTIVE]: "Active",- [CertStatus.REVOKED]: "Revoked"-};--export const getCertStatusBadgeVariant = (status: CertStatus) => {- switch (status) {- case CertStatus.ACTIVE:- return "success";- case CertStatus.REVOKED:- return "danger";- default:- return "primary";- }-};+import { CertExtendedKeyUsage, CertKeyAlgorithm, CertKeyUsage, CrlReason } from "./enums";export const certKeyAlgorithmToNameMap: { [K in CertKeyAlgorithm]: string } = {[CertKeyAlgorithm.RSA_2048]: "RSA 2048",diff --git a/frontend/src/hooks/api/certificates/enums.tsx b/frontend/src/hooks/api/certificates/enums.tsxindex 6395877ed8..42a3ed9674 100644--- a/frontend/src/hooks/api/certificates/enums.tsx+++ b/frontend/src/hooks/api/certificates/enums.tsx@@ -1,5 +1,7 @@export enum CertStatus {ACTIVE = "active",+ RENEWED = "renewed",+ EXPIRED = "expired",REVOKED = "revoked"}diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.tsindex c676e90e80..5b43b5e8b5 100644--- a/frontend/src/hooks/api/certificates/types.ts+++ b/frontend/src/hooks/api/certificates/types.ts@@ -308,6 +308,7 @@ export type TDashboardStats = {totals: {total: number;active: number;+ renewed: number;expiringSoon: number;expired: number;revoked: number;diff --git a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsx b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsxindex 6a257bf599..8042137f1d 100644--- a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsx+++ b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateOverviewSection.tsx@@ -20,6 +20,7 @@ import {import { CertSource, CertStatus, useGetCertificateById } from "@app/hooks/api";import {+ getCertificateDisplayStatus,getCertSourceLabel,getCertValidUntilBadgeDetails} from "../../CertificatesPage/components/CertificatesTable.utils";@@ -64,6 +65,7 @@ export const CertificateOverviewSection = ({ certificateId }: Props) => {const { variant: expiryVariant, label: expiryLabel } = getCertValidUntilBadgeDetails(certificate.notAfter);+ const displayStatus = getCertificateDisplayStatus(certificate);const showCaLink = certificate.caId && certificate.caName && certificate.caType === "internal";@@ -83,10 +85,10 @@ export const CertificateOverviewSection = ({ certificateId }: Props) => {<Detail><DetailLabel>Status</DetailLabel><DetailValue>- {certificate.status === CertStatus.REVOKED ? (- <Badge variant="danger">Revoked</Badge>- ) : (+ {displayStatus.status === CertStatus.ACTIVE ? (<Badge variant={expiryVariant}>{expiryLabel}</Badge>+ ) : (+ <Badge variant={displayStatus.variant}>{displayStatus.label}</Badge>)}</DetailValue></Detail>diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsxindex 3de5d91645..fe5796c7e2 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx@@ -94,6 +94,7 @@ import { UsePopUpState } from "@app/hooks/usePopUp";import { ActiveFilterChips } from "./ActiveFilterChips";import { AssignCertificateToApplicationModal } from "./AssignCertificateToApplicationModal";import {+ getCertificateDisplayStatus,getCertSourceLabel,getCertValidUntilBadgeDetails,isExpiringWithinOneDay@@ -491,7 +492,7 @@ export const CertificatesTable = ({const now = new Date();const in7d = new Date(now.getTime() + 7 * MS_PER_DAY);setAppliedFilters([- { id: "sv-status", field: "status", operator: "in", value: ["active"] },+ { id: "sv-status", field: "status", operator: "in", value: [CertStatus.ACTIVE] },{id: "sv-expiry",field: "notAfter",@@ -503,7 +504,7 @@ export const CertificatesTable = ({const now = new Date();const in30d = new Date(now.getTime() + 30 * MS_PER_DAY);setAppliedFilters([- { id: "sv-status", field: "status", operator: "in", value: ["active"] },+ { id: "sv-status", field: "status", operator: "in", value: [CertStatus.ACTIVE] },{id: "sv-expiry",field: "notAfter",@@ -511,13 +512,17 @@ export const CertificatesTable = ({value: in30d.toISOString().split("T")[0]}]);+ } else if (viewId === "system-renewed") {+ setAppliedFilters([+ { id: "sv-status", field: "status", operator: "in", value: [CertStatus.RENEWED] }+ ]);} else if (viewId === "system-expired") {setAppliedFilters([- { id: "sv-status", field: "status", operator: "in", value: ["expired"] }+ { id: "sv-status", field: "status", operator: "in", value: [CertStatus.EXPIRED] }]);} else if (viewId === "system-revoked") {setAppliedFilters([- { id: "sv-status", field: "status", operator: "in", value: ["revoked"] }+ { id: "sv-status", field: "status", operator: "in", value: [CertStatus.REVOKED] }]);} else if (viewId === "system-pqc") {setAppliedFilters([@@ -881,6 +886,7 @@ export const CertificatesTable = ({{!isPending &&certificates.map((certificate) => {const { variant, label } = getCertValidUntilBadgeDetails(certificate.notAfter);+ const displayStatus = getCertificateDisplayStatus(certificate);const isRevoked = certificate.status === CertStatus.REVOKED;const isExpired = new Date(certificate.notAfter) < new Date();const isExpiringWithinDay = isExpiringWithinOneDay(certificate.notAfter);@@ -954,13 +960,7 @@ export const CertificatesTable = ({)}{visibleColumns.has("status") && (<TableCell>- {isRevoked ? (- <Badge variant="danger">Revoked</Badge>- ) : isExpired ? (- <Badge variant="danger">Expired</Badge>- ) : (- <Badge variant="success">Active</Badge>- )}+ <Badge variant={displayStatus.variant}>{displayStatus.label}</Badge></TableCell>)}{visibleColumns.has("health") && (diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.tsindex c3fbd7896d..a48973c9cd 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts@@ -1,6 +1,6 @@import ms from "ms";-import { CertSource } from "@app/hooks/api/certificates/enums";+import { CertSource, CertStatus } from "@app/hooks/api/certificates/enums";import { TCertificateSource } from "@app/hooks/api/certificates/types";export const getCertSourceLabel = (source: TCertificateSource): string => {@@ -15,6 +15,28 @@ export const getCertSourceLabel = (source: TCertificateSource): string => {}};+type TCertificateStatusSource = {+ status?: string | null;+ notAfter: string;+ renewedByCertificateId?: string | null;+};++export const getCertificateDisplayStatus = (certificate: TCertificateStatusSource) => {+ 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 => {const expiryDate = new Date(notAfter);const now = new Date();diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.tsindex d5e1e5db17..276872a01f 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts@@ -1,6 +1,6 @@import { TCertificate, TCertificateSource } from "@app/hooks/api/certificates/types";-import { getCertSourceLabel } from "./CertificatesTable.utils";+import { getCertificateDisplayStatus, getCertSourceLabel } from "./CertificatesTable.utils";const CSV_COLUMNS = [{ key: "commonName", header: "Common Name" },@@ -41,6 +41,9 @@ export const certificatesToCSV = (certificates: TCertificate[]): string => {if (col.key === "source") {return escapeCSV(getCertSourceLabel((cert.source ?? null) as TCertificateSource));}+ if (col.key === "status") {+ return escapeCSV(getCertificateDisplayStatus(cert).label);+ }const value = cert[col.key as keyof TCertificate];if (value === null || value === undefined) return "";if (typeof value === "object") return escapeCSV(JSON.stringify(value));diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/inventory-types.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/inventory-types.tsindex 3ae5f4a424..c7cc23f564 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/inventory-types.ts+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/inventory-types.ts@@ -1,4 +1,5 @@import type { TInventoryViewFilters } from "@app/hooks/api/certificateInventoryViews/types";+import { CertStatus } from "@app/hooks/api/certificates/enums";export type FilterRule = {id: string;@@ -22,9 +23,10 @@ export const FILTER_FIELDS: FilterFieldDefinition[] = [operators: [{ value: "in", label: "in" }],valueType: "multi-select",options: [- { value: "active", label: "Active" },- { value: "expired", label: "Expired" },- { value: "revoked", label: "Revoked" }+ { value: CertStatus.ACTIVE, label: "Active" },+ { value: CertStatus.RENEWED, label: "Renewed" },+ { value: CertStatus.EXPIRED, label: "Expired" },+ { value: CertStatus.REVOKED, label: "Revoked" }]},{