Skip to content

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

Cleanup now soft deletes, keep sync rows on delete, add Default view, show syncs in delete dialog

Carlos Monastyrski099f6571f09d
diff --git a/backend/AGENTS.md b/backend/AGENTS.md
index 98912df459..4be7f08531 100644
--- a/backend/AGENTS.md
+++ b/backend/AGENTS.md
@@ -1096,16 +1096,27 @@ Note that `logger.ts` also has a `redactedKeys` list applied to structured-objec
### Certificate soft delete
-Deleting a certificate stamps `deletedAt`, `deletedByActorType` and `deletedByActorId` on the row and, in the
-same transaction, removes its `certificate_bodies`, `certificate_secrets` and `certificate_syncs` rows. The
-row itself stays, so the inventory, audit trail and renewal chain keep pointing at something. Things that rely
-on that:
+Deleting a certificate goes through `softDeleteCertificates` (`certificate-fns.ts`), which both the delete
+endpoint and the expiry cleanup job (`certificate-cleanup-queue.ts`) call: it stamps `deletedAt`,
+`deletedByActorType` and `deletedByActorId` on the row and, in the same transaction, removes its
+`certificate_bodies`, `certificate_secrets` and PKI collection items and clears the private key copy on
+`certificate_requests.encryptedPrivateKey`. The row itself stays, so the inventory, audit trail and renewal
+chain keep pointing at something. Nothing hard deletes certificates any more, so deleted rows accumulate;
+instance-level hard delete is a possible future option. Things that rely on that:
+
+- **`certificate_syncs` rows are kept.** Linux, Windows and Azure (free-text naming) find what they delivered
+ only through those rows (`syncMetadata.files`, `externalIdentifier`), so the delete queues the auto-sync
+ syncs holding the certificate, the run sees a tracked certificate that is no longer active and removes it
+ from the destination, and the provider untracks the row. A sync with Auto-Sync or "Remove certificates from
+ destination" off keeps the row and the copy until a later run that removes it. The sync's certificate list
+ (`findWithDetails`) hides deleted certificates.
- **Every background or enumeration query filters `whereNull("deletedAt")`**: expiry alerts, auto-renewal,
syncs, discovery, HSM connector usage and stats. A new query over `certificates` needs the same filter unless
it is deliberately showing deleted rows. Reads the API serves skip deleted certificates by default too:
`GET /certificates/:id` returns 404 unless the caller passes `includeDeleted`, and list or search returns
- them only for a `deleted` status filter, so clients written before soft delete keep seeing what they saw
+ them only for a `deleted` status filter or `includeDeleted` (the **All Certificates** view; **Default**
+ hides them), so clients written before soft delete keep seeing what they saw
when the row was hard deleted. The one background job that still reads deleted rows is the DigiCert
revocation sync: it records an upstream revocation on a deleted certificate (without alerts) so the quota
stops counting it.
@@ -1123,6 +1134,7 @@ on that:
- **A sync can still write a link for a certificate deleted mid-run.** `certificate_syncs` inserts are not
filtered on `deletedAt`, so a provider that uploads and then records the link leaves a tracking row, and the
sync the delete queued removes that copy from the destination through it.
+- **Cleanup skips certificates a code signing signer uses**, the same rule the delete endpoint enforces.
- **Deleted certificates are not restored.** Serial numbers stay globally unique
(`certificates_serialnumber_unique`), so re-importing a deleted certificate into the same project fails with
the deleted message (any other project gets the generic serial conflict, so nothing about it leaks), and
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 98df228c3d..6a85fd19ee 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -1134,6 +1134,8 @@ export const PROJECTS = {
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, revoked and deleted. A certificate superseded by a renewal matches renewed rather than active until it expires or is revoked. Deleted certificates match only deleted.",
+ includeDeleted:
+ "Include deleted certificates in the results when no status filter is set. Deleted certificates are excluded by default.",
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/index.ts b/backend/src/server/routes/index.ts
index b10b15b382..7a3d3c3d28 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -3089,16 +3089,6 @@ export const registerRoutes = async (
permissionService
});
- const certificateCleanupQueue = certificateCleanupQueueFactory({
- db,
- cronJob,
- certificateCleanupConfigDAL,
- certificateDAL,
- certificateRequestDAL,
- auditLogService,
- telemetryService
- });
-
const dynamicSecretProviders = buildDynamicSecretProviders({
gatewayV2Service,
gatewayPoolService,
@@ -3766,6 +3756,23 @@ export const registerRoutes = async (
pkiSyncQueue
});
+ const certificateCleanupQueue = certificateCleanupQueueFactory({
+ db,
+ cronJob,
+ certificateCleanupConfigDAL,
+ certificateDAL,
+ certificateBodyDAL,
+ certificateSecretDAL,
+ certificateRequestDAL,
+ pkiCollectionItemDAL,
+ certificateSyncDAL,
+ pkiSyncDAL,
+ pkiSyncQueue,
+ usageMeteringService,
+ auditLogService,
+ telemetryService
+ });
+
const pkiSyncHealthCheckQueue = pkiSyncHealthCheckQueueFactory({
cronJob,
queueService,
diff --git a/backend/src/server/routes/v1/certificate-inventory-view-router.ts b/backend/src/server/routes/v1/certificate-inventory-view-router.ts
index 391ad60aec..17f5f1eb1d 100644
--- a/backend/src/server/routes/v1/certificate-inventory-view-router.ts
+++ b/backend/src/server/routes/v1/certificate-inventory-view-router.ts
@@ -75,6 +75,7 @@ export const registerCertificateInventoryViewRouter = async (server: FastifyZodP
name: z.string(),
filters: z.object({
status: z.array(z.string()).optional(),
+ includeDeleted: z.boolean().optional(),
notAfterTo: z.string().optional()
}),
columns: z.null(),
diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.ts
index 71138855c0..bcc75d3f88 100644
--- a/backend/src/server/routes/v1/project-router.ts
+++ b/backend/src/server/routes/v1/project-router.ts
@@ -1456,6 +1456,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
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),
+ includeDeleted: z.boolean().optional().describe(PROJECTS.SEARCH_CERTIFICATES.includeDeleted),
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),
diff --git a/backend/src/services/certificate-authority/digicert/digicert-code-signing-fns.ts b/backend/src/services/certificate-authority/digicert/digicert-code-signing-fns.ts
index 953d711cf3..1e70cac3f1 100644
--- a/backend/src/services/certificate-authority/digicert/digicert-code-signing-fns.ts
+++ b/backend/src/services/certificate-authority/digicert/digicert-code-signing-fns.ts
@@ -366,7 +366,7 @@ export const digiCertCodeSigningFns = ({
const certObj = new x509.X509Certificate(leaf);
const parsedFields = extractExternallyIssuedCertificateFields(certObj);
const differentCaError = new BadRequestError({
- message: `The certificate in DigiCert order ${orderId} is already in Certificate Manager under a different certificate authority. Remove that copy from the certificate inventory, then try again.`
+ message: `The certificate in DigiCert order ${orderId} is already in Certificate Manager under a different certificate authority, so it can't be added under this one. Request a new code signing certificate instead.`
});
const existingCert = await certificateDAL.findOne({ serialNumber: certObj.serialNumber });
diff --git a/backend/src/services/certificate-cleanup/certificate-cleanup-queue.ts b/backend/src/services/certificate-cleanup/certificate-cleanup-queue.ts
index 3ebeed4984..3175f383d9 100644
--- a/backend/src/services/certificate-cleanup/certificate-cleanup-queue.ts
+++ b/backend/src/services/certificate-cleanup/certificate-cleanup-queue.ts
@@ -8,9 +8,18 @@ import { CronJobName, TCronJobFactory } from "@app/lib/cron/cron-job";
import { logger } from "@app/lib/logger";
import { QueueJobs } from "@app/queue";
import { ActorType } from "@app/services/auth/auth-type";
+import { ActiveCerts, WildcardCerts } from "@app/services/license-client";
+import { TUsageMeteringServiceFactory } from "@app/services/license-client/usage/usage-metering-service";
import { TCertificateRequestDALFactory } from "../certificate-request/certificate-request-dal";
+import { TCertificateSyncDALFactory } from "../certificate-sync/certificate-sync-dal";
+import { TCertificateBodyDALFactory } from "../certificate/certificate-body-dal";
import { TCertificateDALFactory } from "../certificate/certificate-dal";
+import { softDeleteCertificates } from "../certificate/certificate-fns";
+import { TCertificateSecretDALFactory } from "../certificate/certificate-secret-dal";
+import { TPkiCollectionItemDALFactory } from "../pki-collection/pki-collection-item-dal";
+import { TPkiSyncDALFactory } from "../pki-sync/pki-sync-dal";
+import { TPkiSyncQueueFactory } from "../pki-sync/pki-sync-queue";
import { TTelemetryServiceFactory } from "../telemetry/telemetry-service";
import { PostHogEventTypes } from "../telemetry/telemetry-types";
import { TCertificateCleanupConfigDALFactory } from "./certificate-cleanup-dal";
@@ -20,8 +29,15 @@ type TCertificateCleanupQueueFactoryDep = {
db: TDbClient;
cronJob: TCronJobFactory;
certificateCleanupConfigDAL: TCertificateCleanupConfigDALFactory;
- certificateDAL: Pick<TCertificateDALFactory, "delete">;
- certificateRequestDAL: Pick<TCertificateRequestDALFactory, "delete">;
+ certificateDAL: Pick<TCertificateDALFactory, "update">;
+ certificateBodyDAL: Pick<TCertificateBodyDALFactory, "delete">;
+ certificateSecretDAL: Pick<TCertificateSecretDALFactory, "delete">;
+ certificateRequestDAL: Pick<TCertificateRequestDALFactory, "update">;
+ pkiCollectionItemDAL: Pick<TPkiCollectionItemDALFactory, "delete">;
+ certificateSyncDAL: Pick<TCertificateSyncDALFactory, "find">;
+ pkiSyncDAL: Pick<TPkiSyncDALFactory, "find">;
+ pkiSyncQueue: Pick<TPkiSyncQueueFactory, "queuePkiSyncSyncCertificatesById">;
+ usageMeteringService: Pick<TUsageMeteringServiceFactory, "emitForProject">;
auditLogService: Pick<TAuditLogServiceFactory, "createAuditLog">;
telemetryService: Pick<TTelemetryServiceFactory, "sendPostHogEvents">;
};
@@ -33,7 +49,14 @@ export const certificateCleanupQueueFactory = ({
cronJob,
certificateCleanupConfigDAL,
certificateDAL,
+ certificateBodyDAL,
+ certificateSecretDAL,
certificateRequestDAL,
+ pkiCollectionItemDAL,
+ certificateSyncDAL,
+ pkiSyncDAL,
+ pkiSyncQueue,
+ usageMeteringService,
auditLogService,
telemetryService
}: TCertificateCleanupQueueFactoryDep) => {
@@ -69,6 +92,18 @@ export const certificateCleanupQueueFactory = ({
pendingAuditSerials = [];
};
+ const queueAutoSyncsForRemoval = async (pkiSyncIds: string[]) => {
+ if (pkiSyncIds.length === 0) return;
+ try {
+ const pkiSyncs = await pkiSyncDAL.find({ $in: { id: pkiSyncIds }, isAutoSyncEnabled: true });
+ await Promise.all(
+ pkiSyncs.map((pkiSync) => pkiSyncQueue.queuePkiSyncSyncCertificatesById({ syncId: pkiSync.id }))
+ );
+ } catch (err) {
+ logger.error(err, `CertificateCleanup: failed to queue PKI syncs for project ${config.projectId}`);
+ }
+ };
+
const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - config.postExpiryRetentionDays);
@@ -79,6 +114,13 @@ export const certificateCleanupQueueFactory = ({
.replicaNode()(TableName.Certificate)
.where("projectId", config.projectId)
.where("notAfter", "<", cutoffDate)
+ .whereNull("deletedAt")
+ .whereNotExists((qb) => {
+ void qb
+ .select("id")
+ .from(TableName.PkiSigners)
+ .whereRaw(`"${TableName.PkiSigners}"."certificateId" = "${TableName.Certificate}"."id"`);
+ })
.orderBy("id", "asc")
.select("id");
@@ -114,11 +156,23 @@ export const certificateCleanupQueueFactory = ({
if (idsToDelete.length > 0) {
try {
- const deleted = await certificateCleanupConfigDAL.transaction(async (tx) => {
- await certificateRequestDAL.delete({ $in: { certificateId: idsToDelete } }, tx);
- return certificateDAL.delete({ $in: { id: idsToDelete } }, tx);
- });
+ const { deletedCertificates: deleted, pkiSyncIdsHoldingCertificates } =
+ await certificateCleanupConfigDAL.transaction((tx) =>
+ softDeleteCertificates(
+ { certificateIds: idsToDelete, actorType: ActorType.PLATFORM },
+ {
+ certificateDAL,
+ certificateBodyDAL,
+ certificateSecretDAL,
+ certificateRequestDAL,
+ pkiCollectionItemDAL,
+ certificateSyncDAL
+ },
+ tx
+ )
+ );
deletedCount += deleted.length;
+ await queueAutoSyncsForRemoval(pkiSyncIdsHoldingCertificates);
for (const cert of deleted) {
pendingAuditSerials.push(cert.serialNumber);
@@ -152,6 +206,11 @@ export const certificateCleanupQueueFactory = ({
await flushAuditLog();
+ if (deletedCount > 0) {
+ usageMeteringService.emitForProject(config.projectId, ActiveCerts.key);
+ usageMeteringService.emitForProject(config.projectId, WildcardCerts.key);
+ }
+
return { deletedCount, errors: errorMessages.length };
};
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.ts
index 14906d720b..a09f640490 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
@@ -20,6 +20,7 @@ import {
type TSystemViewFilters = {
status?: string[];
+ includeDeleted?: boolean;
notAfterTo?: string;
keyAlgorithm?: string[];
};
@@ -34,7 +35,15 @@ type TSystemView = {
};
const SYSTEM_VIEWS: TSystemView[] = [
- { id: "system-all", name: "All Certificates", filters: {}, columns: null, isSystem: true, createdByUserId: null },
+ { id: "system-default", name: "Default", filters: {}, columns: null, isSystem: true, createdByUserId: null },
+ {
+ id: "system-all",
+ name: "All Certificates",
+ filters: { includeDeleted: true },
+ columns: null,
+ isSystem: true,
+ createdByUserId: null
+ },
{
id: "system-expiring-7d",
name: "Expiring in 7 days",
diff --git a/backend/src/services/certificate-sync/certificate-sync-dal.ts b/backend/src/services/certificate-sync/certificate-sync-dal.ts
index 1ebdf26b5a..ed21835562 100644
--- a/backend/src/services/certificate-sync/certificate-sync-dal.ts
+++ b/backend/src/services/certificate-sync/certificate-sync-dal.ts
@@ -302,7 +302,8 @@ export const certificateSyncDALFactory = (db: TDbClient) => {
const baseQuery = (tx || db.replicaNode())(TableName.CertificateSync)
.leftJoin(TableName.Certificate, `${TableName.CertificateSync}.certificateId`, `${TableName.Certificate}.id`)
- .leftJoin(TableName.PkiSync, `${TableName.CertificateSync}.pkiSyncId`, `${TableName.PkiSync}.id`);
+ .leftJoin(TableName.PkiSync, `${TableName.CertificateSync}.pkiSyncId`, `${TableName.PkiSync}.id`)
+ .whereNull(`${TableName.Certificate}.deletedAt`);
if (filter) {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
diff --git a/backend/src/services/certificate/certificate-dal.ts b/backend/src/services/certificate/certificate-dal.ts
index 31c31011ae..f216ef7574 100644
--- a/backend/src/services/certificate/certificate-dal.ts
+++ b/backend/src/services/certificate/certificate-dal.ts
@@ -137,6 +137,7 @@ export const certificateDALFactory = (db: TDbClient) => {
commonName?: string;
search?: string;
status?: string | string[];
+ includeDeleted?: boolean;
profileIds?: string[];
fromDate?: Date;
toDate?: Date;
@@ -206,7 +207,7 @@ export const certificateDALFactory = (db: TDbClient) => {
});
}
- if (!filters.status) {
+ if (!filters.status && !filters.includeDeleted) {
q = q.whereNull(`${TableName.Certificate}.deletedAt`);
}
@@ -883,6 +884,7 @@ export const certificateDALFactory = (db: TDbClient) => {
commonName,
search,
status,
+ includeDeleted,
profileIds,
fromDate,
toDate,
@@ -915,6 +917,7 @@ export const certificateDALFactory = (db: TDbClient) => {
commonName,
search,
status,
+ includeDeleted,
profileIds,
fromDate,
toDate,
diff --git a/backend/src/services/certificate/certificate-fns.ts b/backend/src/services/certificate/certificate-fns.ts
index ecb7230d9f..fc6f81d2c7 100644
--- a/backend/src/services/certificate/certificate-fns.ts
+++ b/backend/src/services/certificate/certificate-fns.ts
@@ -15,8 +15,13 @@ import {
import { TCertificateSource, toX509Certificate } from "@app/services/certificate-common/certificate-parse-utils";
import { extractDnParts } from "../certificate-authority/certificate-authority-fns";
+import type { TCertificateRequestDALFactory } from "../certificate-request/certificate-request-dal";
+import type { TCertificateSyncDALFactory } from "../certificate-sync/certificate-sync-dal";
+import type { TPkiCollectionItemDALFactory } from "../pki-collection/pki-collection-item-dal";
import { getProjectKmsCertificateKeyId } from "../project/project-fns";
+import type { TCertificateBodyDALFactory } from "./certificate-body-dal";
import type { TCertificateDALFactory } from "./certificate-dal";
+import type { TCertificateSecretDALFactory } from "./certificate-secret-dal";
import {
CertExtendedKeyUsage,
CertExtendedKeyUsageOIDToName,
@@ -563,6 +568,47 @@ export const assertCertificateNotDeleted = (
export const assertCertificateMaterialAvailable = (certificate: TDeletableCertificate) =>
assertCertificateNotDeleted(certificate, "Its certificate and private key are no longer available.");
+export const softDeleteCertificates = async (
+ { certificateIds, actorType, actorId }: { certificateIds: string[]; actorType: string; actorId?: string | null },
+ {
+ certificateDAL,
+ certificateBodyDAL,
+ certificateSecretDAL,
+ certificateRequestDAL,
+ pkiCollectionItemDAL,
+ certificateSyncDAL
+ }: {
+ certificateDAL: Pick<TCertificateDALFactory, "update">;
+ certificateBodyDAL: Pick<TCertificateBodyDALFactory, "delete">;
+ certificateSecretDAL: Pick<TCertificateSecretDALFactory, "delete">;
+ certificateRequestDAL: Pick<TCertificateRequestDALFactory, "update">;
+ pkiCollectionItemDAL: Pick<TPkiCollectionItemDALFactory, "delete">;
+ certificateSyncDAL: Pick<TCertificateSyncDALFactory, "find">;
+ },
+ tx: Knex
+) => {
+ if (certificateIds.length === 0) return { deletedCertificates: [], pkiSyncIdsHoldingCertificates: [] };
+
+ const deletedCertificates = await certificateDAL.update(
+ { $in: { id: certificateIds }, deletedAt: null },
+ { deletedAt: new Date(), deletedByActorType: actorType, deletedByActorId: actorId ?? null },
+ tx
+ );
+ const deletedIds = deletedCertificates.map((cert) => cert.id);
+ if (deletedIds.length === 0) return { deletedCertificates, pkiSyncIdsHoldingCertificates: [] };
+
+ await certificateBodyDAL.delete({ $in: { certId: deletedIds } }, tx);
+ await certificateSecretDAL.delete({ $in: { certId: deletedIds } }, tx);
+ await certificateRequestDAL.update({ $in: { certificateId: deletedIds } }, { encryptedPrivateKey: null }, tx);
+ await pkiCollectionItemDAL.delete({ $in: { certId: deletedIds } }, tx);
+ const syncLinks = await certificateSyncDAL.find({ $in: { certificateId: deletedIds } }, { tx });
+
+ return {
+ deletedCertificates,
+ pkiSyncIdsHoldingCertificates: [...new Set(syncLinks.map((link) => link.pkiSyncId))]
+ };
+};
+
export const linkRenewedCertificate = async (
certificateDAL: Pick<TCertificateDALFactory, "findById" | "updateById">,
originalCertificateId: string,
diff --git a/backend/src/services/certificate/certificate-service.test.ts b/backend/src/services/certificate/certificate-service.test.ts
index ec52125648..ea03684fcf 100644
--- a/backend/src/services/certificate/certificate-service.test.ts
+++ b/backend/src/services/certificate/certificate-service.test.ts
@@ -47,7 +47,7 @@ const buildService = () => {
const certificateBodyDAL = { delete: vi.fn().mockResolvedValue([]) };
const certificateSecretDAL = { delete: vi.fn().mockResolvedValue([]) };
const pkiCollectionItemDAL = { delete: vi.fn().mockResolvedValue([]) };
- const certificateSyncDAL = { delete: vi.fn().mockResolvedValue([]) };
+ const certificateSyncDAL = { find: vi.fn().mockResolvedValue([]) };
const signerDAL = { findOne: vi.fn().mockResolvedValue(undefined) };
const deps = {
@@ -89,8 +89,8 @@ describe("certificateService.deleteCert", () => {
ctx = buildService();
});
- it("keeps the row, stamps who deleted it, and removes its material, collection items and sync links", async () => {
- ctx.certificateSyncDAL.delete.mockResolvedValue([{ pkiSyncId: "sync-1" }, { pkiSyncId: "sync-1" }]);
+ it("keeps the row and its sync links, stamps who deleted it, and removes its material and collection items", async () => {
+ ctx.certificateSyncDAL.find.mockResolvedValue([{ pkiSyncId: "sync-1" }, { pkiSyncId: "sync-1" }]);
const result = await ctx.service.deleteCert({
id: "cert-1",
@@ -99,7 +99,7 @@ describe("certificateService.deleteCert", () => {
});
expect(ctx.certificateDAL.update).toHaveBeenCalledWith(
- { id: "cert-1" },
+ { $in: { id: ["cert-1"] }, deletedAt: null },
expect.objectContaining({
deletedByActorType: ActorType.USER,
deletedByActorId: "user-1",
@@ -107,10 +107,10 @@ describe("certificateService.deleteCert", () => {
}),
tx
);
- expect(ctx.certificateBodyDAL.delete).toHaveBeenCalledWith({ certId: "cert-1" }, tx);
- expect(ctx.certificateSecretDAL.delete).toHaveBeenCalledWith({ certId: "cert-1" }, tx);
- expect(ctx.pkiCollectionItemDAL.delete).toHaveBeenCalledWith({ certId: "cert-1" }, tx);
- expect(ctx.certificateSyncDAL.delete).toHaveBeenCalledWith({ certificateId: "cert-1" }, tx);
+ expect(ctx.certificateBodyDAL.delete).toHaveBeenCalledWith({ $in: { certId: ["cert-1"] } }, tx);
+ expect(ctx.certificateSecretDAL.delete).toHaveBeenCalledWith({ $in: { certId: ["cert-1"] } }, tx);
+ expect(ctx.pkiCollectionItemDAL.delete).toHaveBeenCalledWith({ $in: { certId: ["cert-1"] } }, tx);
+ expect(ctx.certificateSyncDAL.find).toHaveBeenCalledWith({ $in: { certificateId: ["cert-1"] } }, { tx });
expect(result.statusAtDeletion).toBe(CertStatus.ACTIVE);
});
diff --git a/backend/src/services/certificate/certificate-service.ts b/backend/src/services/certificate/certificate-service.ts
index 1d128977bf..2fa0a3d6b6 100644
--- a/backend/src/services/certificate/certificate-service.ts
+++ b/backend/src/services/certificate/certificate-service.ts
@@ -106,7 +106,8 @@ import {
parseCertificateBody,
parsePemCertificateChain,
resolveCertificateStatus,
- revocationReasonToCrlCode
+ revocationReasonToCrlCode,
+ softDeleteCertificates
} from "./certificate-fns";
import { TCertificateSecretDALFactory } from "./certificate-secret-dal";
import {
@@ -160,7 +161,7 @@ type TCertificateServiceFactoryDep = {
projectDAL: Pick<TProjectDALFactory, "findOne" | "updateById" | "findById" | "transaction" | "findProjectBySlug">;
kmsService: Pick<TKmsServiceFactory, "generateKmsKey" | "encryptWithKmsKey" | "decryptWithKmsKey">;
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getResourcePermission">;
- certificateSyncDAL: Pick<TCertificateSyncDALFactory, "findPkiSyncIdsByCertificateId" | "delete">;
+ certificateSyncDAL: Pick<TCertificateSyncDALFactory, "findPkiSyncIdsByCertificateId" | "find">;
certificateRequestDAL: Pick<TCertificateRequestDALFactory, "update">;
signerDAL: Pick<TSignerDALFactory, "findOne">;
userDAL: Pick<TUserDALFactory, "findById">;
@@ -586,26 +587,20 @@ export const certificateServiceFactory = ({
});
}
- const [softDeleted] = await certificateDAL.update(
- { id: cert.id },
+ const { deletedCertificates, pkiSyncIdsHoldingCertificates } = await softDeleteCertificates(
+ { certificateIds: [cert.id], actorType: actor, actorId },
{
- deletedAt: new Date(),
- deletedByActorType: actor,
- deletedByActorId: actorId
+ certificateDAL,
+ certificateBodyDAL,
+ certificateSecretDAL,
+ certificateRequestDAL,
+ pkiCollectionItemDAL,
+ certificateSyncDAL
},
tx
);
- await certificateBodyDAL.delete({ certId: cert.id }, tx);
- await certificateSecretDAL.delete({ certId: cert.id }, tx);
- await certificateRequestDAL.update({ certificateId: cert.id }, { encryptedPrivateKey: null }, tx);
- await pkiCollectionItemDAL.delete({ certId: cert.id }, tx);
- const removedSyncLinks = await certificateSyncDAL.delete({ certificateId: cert.id }, tx);
-
- return {
- deletedCert: softDeleted,
- pkiSyncIdsHoldingCertificate: [...new Set(removedSyncLinks.map((link) => link.pkiSyncId))]
- };
+ return { deletedCert: deletedCertificates[0], pkiSyncIdsHoldingCertificate: pkiSyncIdsHoldingCertificates };
});
await triggerSyncsForDeletedCertificate(
diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.ts
index 0e0c656431..589277cf5e 100644
--- a/backend/src/services/project/project-service.ts
+++ b/backend/src/services/project/project-service.ts
@@ -1389,6 +1389,7 @@ export const projectServiceFactory = ({
forPkiSync = false,
search,
status,
+ includeDeleted,
profileIds,
fromDate,
toDate,
@@ -1461,6 +1462,7 @@ export const projectServiceFactory = ({
...(status && {
status: Array.isArray(status) ? status : status.split(",").map((s) => s.trim())
}),
+ ...(includeDeleted && { includeDeleted }),
...(profileIds && { profileIds }),
...(fromDate && { fromDate }),
...(toDate && { toDate }),
diff --git a/backend/src/services/project/project-types.ts b/backend/src/services/project/project-types.ts
index 7aed061308..5af137c315 100644
--- a/backend/src/services/project/project-types.ts
+++ b/backend/src/services/project/project-types.ts
@@ -146,6 +146,7 @@ export type TListProjectCertsDTO = {
forPkiSync?: boolean;
search?: string;
status?: string | string[];
+ includeDeleted?: boolean;
profileIds?: string[];
fromDate?: Date;
toDate?: Date;
diff --git a/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx b/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx
index 000d7ba552..ca4b0b9923 100644
--- a/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx
+++ b/docs/documentation/platform/pki/concepts/certificate-lifecycle.mdx
@@ -43,11 +43,11 @@ Invalidate a certificate when it's compromised, misconfigured, or no longer need
## Retirement
-Deleting a certificate removes the certificate and its private key, and its details stay in the inventory as **Deleted**. A deleted certificate can't be renewed.
+Deleting a certificate removes the certificate and its private key, and its details stay in the inventory as **Deleted**. Deleting can't be undone. A deleted certificate can't be renewed or imported again, so the only way to replace it is to issue a new one.
- **Revocation:** deleting doesn't revoke a certificate, but you can revoke it afterward if its certificate authority supports revocation
- **Imported certificates:** revoke a certificate imported into a profile with an internal certificate authority before you delete it, because it can't be revoked afterward
- **Quota:** a deleted certificate issued from a certificate authority counts toward your certificate quota until it expires or is revoked (deleted imported and discovered certificates stop counting right away)
-- **Cleanup:** Certificate Cleanup permanently removes expired certificates, including deleted ones
+- **Cleanup:** Certificate Cleanup deletes expired certificates the same way, so their details also stay in the inventory as **Deleted**
[Learn more about Certificate Cleanup →](/documentation/platform/pki/settings/certificate-cleanup)
diff --git a/docs/documentation/platform/pki/monitoring/certificate-inventory.mdx b/docs/documentation/platform/pki/monitoring/certificate-inventory.mdx
index 23a07c88cd..b0332cdc76 100644
--- a/docs/documentation/platform/pki/monitoring/certificate-inventory.mdx
+++ b/docs/documentation/platform/pki/monitoring/certificate-inventory.mdx
@@ -57,7 +57,7 @@ The filters you apply appear as labels above the table. To remove one filter, se
## Views
-A view is a saved set of filters. The views menu next to the filter button shows the view you're using, which is **All Certificates** by default. The menu groups views into:
+A view is a saved set of filters. The views menu next to the filter button shows the view you're using, which is **Default** by default. The menu groups views into:
- **System Views**: views that come with Infisical Certificate Management
- **Shared Views**: views that an admin saved and shared with other admins
@@ -69,7 +69,8 @@ Infisical reopens the last view you used in this browser.
| View | Shows |
| --- | --- |
-| **All Certificates** | Every certificate except deleted ones |
+| **Default** | Every certificate except deleted ones |
+| **All Certificates** | Every certificate, including deleted ones |
| **Expiring in 7 days** | Active certificates that expire in the next 7 days |
| **Expiring in 30 days** | Active certificates that expire in the next 30 days |
| **Renewed** | Certificates that a [renewal](/documentation/platform/pki/applications/certificate-renewal) replaced with a new certificate |
diff --git a/docs/documentation/platform/pki/settings/certificate-cleanup.mdx b/docs/documentation/platform/pki/settings/certificate-cleanup.mdx
index 26c7a67083..28b08fd435 100644
--- a/docs/documentation/platform/pki/settings/certificate-cleanup.mdx
+++ b/docs/documentation/platform/pki/settings/certificate-cleanup.mdx
@@ -1,10 +1,10 @@
---
title: "Certificate cleanup"
sidebarTitle: "Certificate cleanup"
-description: "Automatically remove expired certificates to keep your inventory organized."
+description: "Automatically delete expired certificates to keep your inventory organized."
---
-Automatically remove expired certificates from Infisical Certificate Management. Cleanup runs daily and permanently removes certificates that have been expired for a configurable number of days. If you delete a certificate yourself, its details stay in the inventory until it expires and cleanup removes it.
+Automatically delete expired certificates in Infisical Certificate Management. Cleanup runs daily and deletes certificates that have been expired for a configurable number of days. Cleanup deletes a certificate the same way you would: the certificate and its private key are removed, and its details stay in the inventory as **Deleted**. The **Default** view hides them, and the **All Certificates** and **Deleted** views show them. Cleanup never deletes a certificate that a code signing signer uses.
<Info>
This setting is managed by product admins and applies to all certificates in Infisical Certificate Management.
@@ -24,9 +24,9 @@ Automatically remove expired certificates from Infisical Certificate Management.
| Value | Behavior |
|-------|----------|
- | `3` | Certificates are permanently removed 3 days after expiration |
- | `7` | Certificates are permanently removed 7 days after expiration |
- | `30` | Certificates are permanently removed 30 days after expiration |
+ | `3` | Certificates are deleted 3 days after expiration |
+ | `7` | Certificates are deleted 7 days after expiration |
+ | `30` | Certificates are deleted 30 days after expiration |
<Note>
Values must be between 1 and 30 days.
diff --git a/frontend/src/hooks/api/certificateInventoryViews/types.ts b/frontend/src/hooks/api/certificateInventoryViews/types.ts
index a31d2cba85..eb9793fa05 100644
--- a/frontend/src/hooks/api/certificateInventoryViews/types.ts
+++ b/frontend/src/hooks/api/certificateInventoryViews/types.ts
@@ -28,6 +28,7 @@ export type TCertificateInventoryView = {
export type TSystemViewFilters = {
status?: string[];
+ includeDeleted?: boolean;
notAfterTo?: string;
};
diff --git a/frontend/src/hooks/api/projects/queries.tsx b/frontend/src/hooks/api/projects/queries.tsx
index 448b54d702..794dfc67ae 100644
--- a/frontend/src/hooks/api/projects/queries.tsx
+++ b/frontend/src/hooks/api/projects/queries.tsx
@@ -634,6 +634,7 @@ export const useListWorkspaceCertificates = ({
forPkiSync,
search,
status,
+ includeDeleted,
profileIds,
fromDate,
toDate,
@@ -662,6 +663,7 @@ export const useListWorkspaceCertificates = ({
forPkiSync?: boolean;
search?: string;
status?: string | string[];
+ includeDeleted?: boolean;
profileIds?: string[];
fromDate?: Date;
toDate?: Date;
@@ -692,6 +694,7 @@ export const useListWorkspaceCertificates = ({
forPkiSync,
search,
status,
+ includeDeleted,
profileIds,
fromDate,
toDate,
@@ -725,6 +728,7 @@ export const useListWorkspaceCertificates = ({
...(forPkiSync && { forPkiSync }),
...(search && { search }),
...(status && { status: Array.isArray(status) ? status.join(",") : status }),
+ ...(includeDeleted && { includeDeleted }),
...(profileIds && profileIds.length > 0 && { profileIds }),
...(fromDate && { fromDate: fromDate.toISOString() }),
...(toDate && { toDate: toDate.toISOString() }),
diff --git a/frontend/src/hooks/api/projects/query-keys.tsx b/frontend/src/hooks/api/projects/query-keys.tsx
index 5af59c4583..18b77ae94f 100644
--- a/frontend/src/hooks/api/projects/query-keys.tsx
+++ b/frontend/src/hooks/api/projects/query-keys.tsx
@@ -77,6 +77,7 @@ export const projectKeys = {
forPkiSync,
search,
status,
+ includeDeleted,
profileIds,
fromDate,
toDate,
@@ -105,6 +106,7 @@ export const projectKeys = {
forPkiSync?: boolean;
search?: string;
status?: string | string[];
+ includeDeleted?: boolean;
profileIds?: string[];
fromDate?: Date;
toDate?: Date;
@@ -135,6 +137,7 @@ export const projectKeys = {
forPkiSync,
search,
status,
+ includeDeleted,
profileIds,
fromDate,
toDate,
diff --git a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx
index bd16c4b518..88921b6e1c 100644
--- a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx
@@ -51,6 +51,7 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { ApplicationTab } from "@app/pages/cert-manager/ApplicationDetailsByIDPage/application-tabs";
import { CertificateCertModal } from "../CertificatesPage/components/CertificateCertModal";
+import { CertificateDeletionSyncImpact } from "../CertificatesPage/components/CertificateDeletionSyncImpact";
import {
CertificateExportModal,
ExportOptions
@@ -542,12 +543,16 @@ const Page = () => {
<ConfirmationAlertDialog
isOpen={popUp.deleteCertificate.isOpen}
title={`Delete Certificate ${displayName}?`}
- description={getCertificateDeletionWarning(
- certificate,
- supportsRevocation,
- isRevocableAfterDeletion,
- holdingSyncs
- )}
+ description={
+ <>
+ {getCertificateDeletionWarning(
+ certificate,
+ supportsRevocation,
+ isRevocableAfterDeletion
+ )}
+ <CertificateDeletionSyncImpact holdingSyncs={holdingSyncs} />
+ </>
+ }
onOpenChange={(isOpen) => handlePopUpToggle("deleteCertificate", isOpen)}
isPending={isLoadingHoldingSyncs}
confirmKey="confirm"
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateDeletionSyncImpact.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateDeletionSyncImpact.tsx
new file mode 100644
index 0000000000..6646742a78
--- /dev/null
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateDeletionSyncImpact.tsx
@@ -0,0 +1,70 @@
+import { AlertTriangleIcon, InfoIcon } from "lucide-react";
+
+import {
+ Alert,
+ AlertTitle,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableHeadLabel,
+ TableRow,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";
+import { TPkiSync } from "@app/hooks/api/pkiSyncs/types";
+
+import { isRemovedFromSyncDestination } from "./CertificatesTable.utils";
+
+type Props = {
+ holdingSyncs: TPkiSync[];
+};
+
+export const CertificateDeletionSyncImpact = ({ holdingSyncs }: Props) => {
+ if (!holdingSyncs.length) return null;
+
+ return (
+ <div className="mt-4 w-full">
+ <Alert className="mb-4" variant="warning">
+ <AlertTriangleIcon className="size-4" />
+ <AlertTitle>The following certificate syncs will be affected by this change</AlertTitle>
+ </Alert>
+ <Table containerClassName="max-h-64 overflow-y-auto">
+ <TableHeader>
+ <TableRow>
+ <TableHead className="w-2/5">Certificate Sync</TableHead>
+ <TableHead className="w-2/5">Destination</TableHead>
+ <TableHead className="w-1/5">
+ <TableHeadLabel
+ trailing={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon className="size-3" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">
+ When on, the sync deletes this certificate from its destination.
+ </TooltipContent>
+ </Tooltip>
+ }
+ >
+ Removal
+ </TableHeadLabel>
+ </TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {holdingSyncs.map((sync) => (
+ <TableRow key={sync.id}>
+ <TableCell isTruncatable>{sync.name}</TableCell>
+ <TableCell isTruncatable>{PKI_SYNC_MAP[sync.destination].name}</TableCell>
+ <TableCell>{isRemovedFromSyncDestination(sync) ? "On" : "Off"}</TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
index 7c68ea0a64..24ad70ad3e 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
@@ -28,6 +28,7 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { PkiDocsUrls } from "../../pki-docs-urls";
import { CertificateCertModal } from "./CertificateCertModal";
+import { CertificateDeletionSyncImpact } from "./CertificateDeletionSyncImpact";
import { CertificateExportModal, ExportOptions } from "./CertificateExportModal";
import { CertificateImportSheet } from "./CertificateImportSheet";
import { CertificateManagePkiSyncsModal } from "./CertificateManagePkiSyncsModal";
@@ -237,12 +238,16 @@ export const CertificatesSection = ({
title={`Delete Certificate ${
(popUp?.deleteCertificate?.data as { commonName: string })?.commonName || ""
}?`}
- description={getCertificateDeletionWarning(
- deleteCertificateData,
- deleteCertificateData?.canRevoke,
- deleteCertificateData?.isRevocableAfterDeletion,
- holdingSyncs
- )}
+ description={
+ <>
+ {getCertificateDeletionWarning(
+ deleteCertificateData,
+ deleteCertificateData?.canRevoke,
+ deleteCertificateData?.isRevocableAfterDeletion
+ )}
+ <CertificateDeletionSyncImpact holdingSyncs={holdingSyncs} />
+ </>
+ }
onOpenChange={(isOpen) => handlePopUpToggle("deleteCertificate", isOpen)}
isPending={isLoadingHoldingSyncs}
confirmKey="confirm"
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
index 510616e0d4..f180321efc 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
@@ -256,9 +256,9 @@ export const CertificatesTable = ({
if (dashboardViewId) return dashboardViewId;
if (hasDashboardFilters) return null;
try {
- return localStorage.getItem(getViewStorageKey(applicationId)) || "system-all";
+ return localStorage.getItem(getViewStorageKey(applicationId)) || "system-default";
} catch {
- return "system-all";
+ return "system-default";
}
});
const [isSaveViewOpen, setIsSaveViewOpen] = useState(false);
@@ -388,6 +388,7 @@ export const CertificatesTable = ({
limit: perPage,
search: appliedSearch.trim() || undefined,
status: filterSearchParams.status as string | undefined,
+ includeDeleted: activeViewId === "system-all",
profileIds: filterSearchParams.profileIds as string[] | undefined,
keyAlgorithm: filterSearchParams.keyAlgorithm,
keySizes: filterSearchParams.keySizes,
@@ -484,8 +485,8 @@ export const CertificatesTable = ({
const handleClearAllFilters = () => {
setAppliedFilters([]);
setPendingFilters([]);
- setActiveViewId("system-all");
- persistViewId("system-all");
+ setActiveViewId("system-default");
+ persistViewId("system-default");
setPage(1);
};
@@ -497,7 +498,7 @@ export const CertificatesTable = ({
setPendingFilters([]);
setPage(1);
- if (viewId === "system-all") {
+ if (viewId === "system-default" || viewId === "system-all") {
// do nothing
} else if (viewId === "system-expiring-7d") {
const now = new Date();
@@ -705,7 +706,7 @@ export const CertificatesTable = ({
if (hasRestoredView || !viewsData) return;
setHasRestoredView(true);
- if (!activeViewId || activeViewId === "system-all") return;
+ if (!activeViewId || activeViewId === "system-default") return;
const systemView = viewsData.systemViews.find((v) => v.id === activeViewId);
if (systemView) {
@@ -725,8 +726,8 @@ export const CertificatesTable = ({
return;
}
- setActiveViewId("system-all");
- persistViewId("system-all");
+ setActiveViewId("system-default");
+ persistViewId("system-default");
}, [viewsData, hasRestoredView, handleSelectView]);
const handleExportCSV = () => {
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.test.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.test.ts
index 2bef43771a..53fb8d287f 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.test.ts
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.test.ts
@@ -6,7 +6,8 @@ import { CertStatus } from "@app/hooks/api/certificates/enums";
import {
getCertificateDeletedBySummary,
getCertificateDeletionWarning,
- getCertificateDisplayStatus
+ getCertificateDisplayStatus,
+ isRemovedFromSyncDestination
} from "./CertificatesTable.utils";
const future = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString();
@@ -105,24 +106,26 @@ describe("getCertificateDeletionWarning", () => {
});
});
-describe("getCertificateDeletionWarning sync removal", () => {
- const expired = { status: CertStatus.ACTIVE, notAfter: past, hasPrivateKey: false };
- const holdingSync = { id: "sync-1" };
-
- it("says nothing about syncs when the certificate is in none", () => {
- expect(getCertificateDeletionWarning(expired, false, true, [])).not.toContain("sync");
- });
-
- it("says the certificate is removed from the sync that holds it", () => {
- expect(getCertificateDeletionWarning(expired, false, true, [holdingSync])).toContain(
- "It's also removed from 1 certificate sync."
- );
- });
-
- it("counts every sync that holds the certificate", () => {
+describe("isRemovedFromSyncDestination", () => {
+ it("is true only when Auto-Sync and removal are both on", () => {
expect(
- getCertificateDeletionWarning(expired, false, true, [holdingSync, holdingSync, holdingSync])
- ).toContain("It's also removed from 3 certificate syncs.");
+ isRemovedFromSyncDestination({
+ isAutoSyncEnabled: true,
+ syncOptions: { canRemoveCertificates: true }
+ })
+ ).toBe(true);
+ expect(
+ isRemovedFromSyncDestination({
+ isAutoSyncEnabled: false,
+ syncOptions: { canRemoveCertificates: true }
+ })
+ ).toBe(false);
+ expect(
+ isRemovedFromSyncDestination({
+ isAutoSyncEnabled: true,
+ syncOptions: { canRemoveCertificates: false }
+ })
+ ).toBe(false);
});
});
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 aa9d81740e..165188bad1 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.utils.ts
@@ -85,14 +85,14 @@ type TCertificateDeletionSource = {
hasPrivateKey?: boolean;
};
-const getCertificateSyncRemovalWarning = (holdingSyncs: unknown[]) => {
- if (holdingSyncs.length === 0) return "";
-
- return holdingSyncs.length === 1
- ? " It's also removed from 1 certificate sync."
- : ` It's also removed from ${holdingSyncs.length} certificate syncs.`;
+export type TCertificateHoldingSync = {
+ isAutoSyncEnabled: boolean;
+ syncOptions?: { canRemoveCertificates?: boolean } | null;
};
+export const isRemovedFromSyncDestination = (sync: TCertificateHoldingSync) =>
+ sync.isAutoSyncEnabled && Boolean(sync.syncOptions?.canRemoveCertificates);
+
const getCertificateTrustWarning = (
certificate: TCertificateDeletionSource | undefined,
canRevoke: boolean,
@@ -115,15 +115,14 @@ const getCertificateTrustWarning = (
export const getCertificateDeletionWarning = (
certificate?: TCertificateDeletionSource,
canRevoke = false,
- isRevocableAfterDeletion = true,
- holdingSyncs: unknown[] = []
+ isRevocableAfterDeletion = true
) => {
const removed =
certificate?.hasPrivateKey === false
? "This removes the certificate."
: "This removes the certificate and its private key.";
- return `${removed}${getCertificateTrustWarning(certificate, canRevoke, isRevocableAfterDeletion)}${getCertificateSyncRemovalWarning(holdingSyncs)} This cannot be undone.`;
+ return `${removed}${getCertificateTrustWarning(certificate, canRevoke, isRevocableAfterDeletion)} This cannot be undone.`;
};
export const isExpiringWithinOneDay = (notAfter: string): boolean => {
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx
index 8f4f1c6247..210beca63f 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx
@@ -49,7 +49,7 @@ export const ViewsDropdown = ({
systemViews.find((v) => v.id === activeViewId) ||
sharedViews.find((v) => v.id === activeViewId) ||
customViews.find((v) => v.id === activeViewId);
- const label = activeView?.name || "All Certificates";
+ const label = activeView?.name || "Default";
const renderActions = (viewId: string, isShared: boolean, isActive = false) => {
if (!onDeleteView && !onToggleShare) return null;
@@ -157,7 +157,7 @@ export const ViewsDropdown = ({
</DropdownMenuTrigger>
<DropdownMenuContent sideOffset={2} className="w-64" align="end">
<DropdownMenuLabel>System Views</DropdownMenuLabel>
- <DropdownMenuRadioGroup value={activeViewId || "system-all"}>
+ <DropdownMenuRadioGroup value={activeViewId || "system-default"}>
{systemViews.map((view) => (
<DropdownMenuRadioItem
key={view.id}