Skip to content

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

PKI revamp improvements

Carlos Monastyrski1032a7f086e9
diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.ts
index 0560594013..dd5c3f154d 100644
--- a/backend/src/ee/services/permission/permission-service.ts
+++ b/backend/src/ee/services/permission/permission-service.ts
@@ -158,29 +158,37 @@ type MembershipWithRoles = {
}>;
};
+const isActiveRole = <U extends { isTemporary?: boolean; temporaryAccessEndTime?: Date | null }>(role: U): boolean =>
+ !role.isTemporary ||
+ Boolean(role.isTemporary && role.temporaryAccessEndTime && new Date() < role.temporaryAccessEndTime);
+
const flattenActiveRolesFromMemberships = <T extends string>(
memberships: MembershipWithRoles[],
customRoleValue: T
): { role: string; permissions?: unknown }[] => {
- const filterTemporary = <U extends { isTemporary?: boolean; temporaryAccessEndTime?: Date | null }>(
- items: U[]
- ): U[] =>
- items.filter(
- ({ isTemporary, temporaryAccessEndTime }) =>
- !isTemporary || (isTemporary && temporaryAccessEndTime && new Date() < temporaryAccessEndTime)
- );
return memberships.flatMap((membership) => {
- const activeRoles = filterTemporary(membership?.roles ?? []).map(({ role, permissions }) => ({
- role,
- permissions
- }));
- const activeAdditionalPrivileges = filterTemporary(membership?.additionalPrivileges ?? []).map(
- ({ permissions }) => ({ role: customRoleValue, permissions })
- );
+ const activeRoles = (membership?.roles ?? [])
+ .filter(isActiveRole)
+ .map(({ role, permissions }) => ({ role, permissions }));
+ const activeAdditionalPrivileges = (membership?.additionalPrivileges ?? [])
+ .filter(isActiveRole)
+ .map(({ permissions }) => ({ role: customRoleValue, permissions }));
return activeRoles.concat(activeAdditionalPrivileges);
});
};
+const membershipsHaveActiveRole = (
+ memberships: Array<{
+ roles: Array<{
+ role: string;
+ customRoleSlug?: string | null;
+ isTemporary?: boolean;
+ temporaryAccessEndTime?: Date | null;
+ }>;
+ }>,
+ role: string
+): boolean => memberships.some((m) => m.roles.some((r) => role === (r.customRoleSlug || r.role) && isActiveRole(r)));
+
type TPermissionServiceFactoryDep = {
serviceTokenDAL: Pick<TServiceTokenDALFactory, "findById">;
projectDAL: Pick<TProjectDALFactory, "findById">;
@@ -253,8 +261,7 @@ export const permissionServiceFactory = ({
const permissionFromRoles = flattenActiveRolesFromMemberships(permissionData, OrgMembershipRole.Custom);
- const hasRole = (role: string) =>
- permissionData.some((memberships) => memberships.roles.some((el) => role === (el.customRoleSlug || el.role)));
+ const hasRole = (role: string) => membershipsHaveActiveRole(permissionData, role);
const permission = createMongoAbility<OrgPermissionSet>(buildOrgPermissionRules(permissionFromRoles), {
conditionsMatcher
@@ -536,8 +543,7 @@ export const permissionServiceFactory = ({
const permissionFromRoles = flattenActiveRolesFromMemberships(permissionData, ProjectMembershipRole.Custom);
- const hasRole = (role: string) =>
- permissionData.some((memberships) => memberships.roles.some((el) => role === (el.customRoleSlug || el.role)));
+ const hasRole = (role: string) => membershipsHaveActiveRole(permissionData, role);
// SSO enforcement runs on every request (uses per-request actorAuthMethod, not cached)
if (actor === ActorType.USER) {
@@ -663,8 +669,7 @@ export const permissionServiceFactory = ({
: resourceRules;
const permission = createMongoAbility<ResourcePermissionSet>(mergedRules, { conditionsMatcher });
- const hasRole = (role: string) =>
- resourceMemberships.some((m) => m.roles.some((r) => role === (r.customRoleSlug || r.role)));
+ const hasRole = (role: string) => membershipsHaveActiveRole(resourceMemberships, role);
return {
permission,
diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.ts
index a444fea3ae..3085878445 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts
@@ -184,12 +184,15 @@ export const pkiAcmeServiceFactory = ({
pkiApplicationProfileDAL,
acmeEnrollmentConfigDAL
}: TPkiAcmeServiceFactoryDep): TPkiAcmeServiceFactory => {
- const validateAcmeProfile = async (profileId: string): Promise<TCertificateProfileWithConfigs> => {
+ const validateAcmeProfile = async (
+ profileId: string,
+ applicationId?: string
+ ): Promise<TCertificateProfileWithConfigs> => {
const profile = await certificateProfileDAL.findByIdWithConfigs(profileId);
if (!profile) {
throw new NotFoundError({ message: "Certificate profile not found" });
}
- if (profile.enrollmentType !== EnrollmentType.ACME) {
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.ACME) {
throw new NotFoundError({ message: "Certificate profile is not configured for ACME enrollment" });
}
return profile;
@@ -315,7 +318,10 @@ export const pkiAcmeServiceFactory = ({
schema?: TSchema;
expectedAccountId?: string;
}): Promise<TAuthenciatedJwsPayload<T>> => {
- const profile = await validateAcmeProfile(profileId);
+ const profile = await certificateProfileDAL.findByIdWithConfigs(profileId);
+ if (!profile) {
+ throw new NotFoundError({ message: "Certificate profile not found" });
+ }
const result = await validateJwsPayload({
url,
rawJwsPayload,
@@ -430,7 +436,7 @@ export const pkiAcmeServiceFactory = ({
};
const getAcmeDirectory = async (profileId: string, applicationId?: string): Promise<TGetAcmeDirectoryResponse> => {
- const profile = await validateAcmeProfile(profileId);
+ const profile = await validateAcmeProfile(profileId, applicationId);
let skipEabBinding = profile.acmeConfig?.skipEabBinding ?? false;
if (applicationId) {
const junctionRow = await pkiApplicationProfileDAL.findOneByApplicationAndProfile(applicationId, profile.id);
@@ -450,7 +456,10 @@ export const pkiAcmeServiceFactory = ({
};
const getAcmeNewNonce = async (profileId: string): Promise<string> => {
- await validateAcmeProfile(profileId);
+ const profile = await certificateProfileDAL.findByIdWithConfigs(profileId);
+ if (!profile) {
+ throw new NotFoundError({ message: "Certificate profile not found" });
+ }
const nonce = crypto.randomBytes(32).toString("base64url");
const nonceKey = KeyStorePrefixes.PkiAcmeNonce(nonce);
// TODO: read config from the profile to get the expiration time instead
@@ -476,7 +485,7 @@ export const pkiAcmeServiceFactory = ({
payload: TCreateAcmeAccountPayload;
auditLogInfo: AuditLogInfo;
}): Promise<TAcmeResponse<TCreateAcmeAccountResponse>> => {
- const profile = await validateAcmeProfile(profileId);
+ const profile = await validateAcmeProfile(profileId, applicationId);
const publicKeyThumbprint = await calculateJwkThumbprint(jwk, "sha256");
const junctionRow = applicationId
@@ -697,8 +706,26 @@ export const pkiAcmeServiceFactory = ({
payload: TCreateAcmeOrderPayload;
auditLogInfo: AuditLogInfo;
}): Promise<TAcmeResponse<TAcmeOrderResource>> => {
- const profile = await validateAcmeProfile(profileId);
- const skipDnsOwnershipVerification = profile.acmeConfig?.skipDnsOwnershipVerification ?? false;
+ const orderAccount = await acmeAccountDAL.findByProjectIdAndAccountId(profileId, accountId);
+ const orderAccountApplicationProfileId = (orderAccount as { applicationProfileId?: string | null } | null)
+ ?.applicationProfileId;
+ const accountApplicationId = orderAccountApplicationProfileId
+ ? await acmeAccountDAL.findApplicationIdByJunctionId(orderAccountApplicationProfileId)
+ : null;
+ const profile = await validateAcmeProfile(profileId, accountApplicationId ?? undefined);
+ let skipDnsOwnershipVerification = profile.acmeConfig?.skipDnsOwnershipVerification ?? false;
+ if (accountApplicationId) {
+ const junctionRow = await pkiApplicationProfileDAL.findOneByApplicationAndProfile(
+ accountApplicationId,
+ profileId
+ );
+ const junctionAcmeConfig = junctionRow?.acmeConfigId
+ ? await acmeEnrollmentConfigDAL.findById(junctionRow.acmeConfigId)
+ : null;
+ if (junctionAcmeConfig) {
+ skipDnsOwnershipVerification = junctionAcmeConfig.skipDnsOwnershipVerification ?? false;
+ }
+ }
// TODO: check and see if we have existing orders for this account that meet the criteria
// if we do, return the existing order
// TODO: check the identifiers and see if are they even allowed for this profile.
@@ -1180,6 +1207,7 @@ export const pkiAcmeServiceFactory = ({
keyAlgorithm: null,
signatureAlgorithm: null,
ttl,
+ enrollmentType: EnrollmentType.ACME,
status: CertificateRequestStatus.PENDING_APPROVAL,
organization: certificateRequest.organization || null,
organizationalUnit: certificateRequest.organizationalUnit || null,
diff --git a/backend/src/ee/services/pki-scep/pki-scep-service.ts b/backend/src/ee/services/pki-scep/pki-scep-service.ts
index 6b4ddb6cc0..9102112d68 100644
--- a/backend/src/ee/services/pki-scep/pki-scep-service.ts
+++ b/backend/src/ee/services/pki-scep/pki-scep-service.ts
@@ -116,7 +116,7 @@ export const pkiScepServiceFactory = ({
throw new NotFoundError({ message: "Certificate profile not found" });
}
- if (profile.enrollmentType !== EnrollmentType.SCEP) {
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.SCEP) {
throw new BadRequestError({ message: "Profile is not configured for SCEP enrollment" });
}
@@ -184,7 +184,10 @@ export const pkiScepServiceFactory = ({
const getCaCaps = async ({ profileId, applicationId }: TGetCaCapsDTO): Promise<string> => {
const profile = await certificateProfileDAL.findByIdWithConfigs(profileId);
- if (!profile || profile.enrollmentType !== EnrollmentType.SCEP) {
+ if (!profile) {
+ throw new NotFoundError({ message: "SCEP profile not found" });
+ }
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.SCEP) {
throw new NotFoundError({ message: "SCEP profile not found" });
}
@@ -934,7 +937,10 @@ export const pkiScepServiceFactory = ({
actorOrgId
}: TGenerateDynamicChallengeDTO) => {
const profile = await certificateProfileDAL.findByIdWithConfigs(profileId);
- if (!profile || profile.enrollmentType !== EnrollmentType.SCEP) {
+ if (!profile) {
+ throw new NotFoundError({ message: "SCEP profile not found" });
+ }
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.SCEP) {
throw new NotFoundError({ message: "SCEP profile not found" });
}
diff --git a/backend/src/server/routes/v1/cert-manager-access-routers/identities-router.ts b/backend/src/server/routes/v1/cert-manager-access-routers/identities-router.ts
index ee5003c105..a73f12c157 100644
--- a/backend/src/server/routes/v1/cert-manager-access-routers/identities-router.ts
+++ b/backend/src/server/routes/v1/cert-manager-access-routers/identities-router.ts
@@ -41,7 +41,7 @@ export const registerCertManagerAccessIdentitiesRouter = async (server: FastifyZ
createdAt: z.date(),
updatedAt: z.date(),
roles: z.array(MembershipRoleSchema),
- identity: IdentitiesSchema.pick({ name: true, id: true, orgId: true })
+ identity: IdentitiesSchema.pick({ name: true, id: true, orgId: true, projectId: true })
})
.array(),
totalCount: z.number()
diff --git a/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts b/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts
index a53eb2bfb1..5f497613a3 100644
--- a/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts
+++ b/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts
@@ -132,7 +132,7 @@ export const certificateEstV3ServiceFactory = ({
throw new NotFoundError({ message: "Certificate profile not found" });
}
- if (profile.enrollmentType !== EnrollmentType.EST) {
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.EST) {
throw new BadRequestError({ message: "Profile is not configured for EST enrollment" });
}
@@ -216,7 +216,7 @@ export const certificateEstV3ServiceFactory = ({
throw new NotFoundError({ message: "Certificate profile not found" });
}
- if (profile.enrollmentType !== EnrollmentType.EST) {
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.EST) {
throw new BadRequestError({ message: "Profile is not configured for EST enrollment" });
}
@@ -356,7 +356,7 @@ export const certificateEstV3ServiceFactory = ({
throw new NotFoundError({ message: "Certificate profile not found" });
}
- if (profile.enrollmentType !== EnrollmentType.EST) {
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.EST) {
throw new BadRequestError({ message: "Profile is not configured for EST enrollment" });
}
diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.ts
index 00b1b697b6..223a4434f4 100644
--- a/backend/src/services/certificate-profile/certificate-profile-service.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-service.ts
@@ -1401,7 +1401,7 @@ export const certificateProfileServiceFactory = ({
);
}
- if (profile.enrollmentType !== EnrollmentType.EST) {
+ if (!applicationId && profile.enrollmentType !== EnrollmentType.EST) {
throw new ForbiddenRequestError({
message: "Profile is not configured for EST enrollment"
});
diff --git a/backend/src/services/certificate-request/certificate-request-dal.ts b/backend/src/services/certificate-request/certificate-request-dal.ts
index 124575449d..0db1b9c0c4 100644
--- a/backend/src/services/certificate-request/certificate-request-dal.ts
+++ b/backend/src/services/certificate-request/certificate-request-dal.ts
@@ -19,6 +19,17 @@ type TCertificateRequestWithCertificate = TCertificateRequests & {
profileName: string | null;
};
+const expandStatusFilter = (status: string): string[] => {
+ if (status === CertificateRequestStatus.PENDING) {
+ return [
+ CertificateRequestStatus.PENDING,
+ CertificateRequestStatus.PENDING_APPROVAL,
+ CertificateRequestStatus.PENDING_VALIDATION
+ ];
+ }
+ return [status];
+};
+
type TCertificateRequestQueryResult = TCertificateRequests & {
certId: string | null;
certSerialNumber: string | null;
@@ -172,7 +183,7 @@ export const certificateRequestDALFactory = (db: TDbClient) => {
}
if (status) {
- query = query.where(`${TableName.CertificateRequests}.status`, status);
+ query = query.whereIn(`${TableName.CertificateRequests}.status`, expandStatusFilter(status));
}
if (fromDate) {
@@ -250,7 +261,7 @@ export const certificateRequestDALFactory = (db: TDbClient) => {
}
if (status) {
- query = query.where(`${TableName.CertificateRequests}.status`, status);
+ query = query.whereIn(`${TableName.CertificateRequests}.status`, expandStatusFilter(status));
}
if (fromDate) {
@@ -353,7 +364,7 @@ export const certificateRequestDALFactory = (db: TDbClient) => {
}
if (status) {
- query = query.where(`${TableName.CertificateRequests}.status`, status);
+ query = query.whereIn(`${TableName.CertificateRequests}.status`, expandStatusFilter(status));
}
if (fromDate) {
diff --git a/backend/src/services/certificate-v3/certificate-v3-service.ts b/backend/src/services/certificate-v3/certificate-v3-service.ts
index 84d6d5174c..1c843db9a2 100644
--- a/backend/src/services/certificate-v3/certificate-v3-service.ts
+++ b/backend/src/services/certificate-v3/certificate-v3-service.ts
@@ -195,7 +195,7 @@ const validateProfileAndPermissions = async ({
throw new NotFoundError({ message: "Certificate profile not found" });
}
- if (profile.enrollmentType !== requiredEnrollmentType) {
+ if (!applicationId && profile.enrollmentType !== requiredEnrollmentType) {
throw new ForbiddenRequestError({
message: `Profile is not configured for ${requiredEnrollmentType} enrollment`
});
@@ -912,6 +912,7 @@ export const certificateV3ServiceFactory = ({
keyAlgorithm: certificateRequest.keyAlgorithm || null,
signatureAlgorithm: certificateRequest.signatureAlgorithm || null,
ttl: resolvedTtl,
+ enrollmentType: EnrollmentType.API,
status: CertificateRequestStatus.PENDING_APPROVAL,
organization: certificateRequest.organization || null,
organizationalUnit: certificateRequest.organizationalUnit || null,
@@ -1745,7 +1746,7 @@ export const certificateV3ServiceFactory = ({
certificateId: certResult.certificateId,
basicConstraints,
ttl: validity.ttl,
- enrollmentType: EnrollmentType.API
+ enrollmentType
});
if (metadata && metadata.length > 0) {
@@ -1954,6 +1955,7 @@ export const certificateV3ServiceFactory = ({
country: certificateRequest.country || null,
state: certificateRequest.state || null,
locality: certificateRequest.locality || null,
+ enrollmentType: EnrollmentType.API,
status: CertificateRequestStatus.PENDING_APPROVAL,
createdAt: certRequestCreatedAt
} as Parameters<typeof certificateRequestDAL.create>[0] & { createdAt: Date },
@@ -2720,27 +2722,43 @@ export const certificateV3ServiceFactory = ({
throw new NotFoundError({ message: "Certificate not found" });
}
- const { permission } = await permissionService.getProjectPermission({
- actor,
- actorId,
- projectId: certificate.projectId,
- actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.CertificateManager
- });
-
const metadataRows = await resourceMetadataDAL.find({ certificateId: certificate.id });
const certMetadata = metadataRows.map(({ key, value }) => ({ key, value: value || "" }));
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionCertificateActions.Edit,
- subject(ProjectPermissionSub.Certificates, {
- commonName: certificate.commonName,
- altNames: certificate.altNames?.split(",").map((s) => s.trim()),
- serialNumber: certificate.serialNumber,
- metadata: certMetadata
- })
- );
+ if (certificate.applicationId) {
+ const { permission } = await permissionService.getResourcePermission({
+ actor,
+ actorId,
+ projectId: certificate.projectId,
+ resourceType: ResourceType.CertificateApplication,
+ resourceId: certificate.applicationId,
+ actorAuthMethod,
+ actorOrgId
+ });
+ ForbiddenError.from(permission).throwUnlessCan(
+ ResourcePermissionCertificateActions.Edit,
+ ResourcePermissionSub.Certificates
+ );
+ } else {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: certificate.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Edit,
+ subject(ProjectPermissionSub.Certificates, {
+ commonName: certificate.commonName,
+ altNames: certificate.altNames?.split(",").map((s) => s.trim()),
+ serialNumber: certificate.serialNumber,
+ metadata: certMetadata
+ })
+ );
+ }
if (!certificate.profileId) {
throw new BadRequestError({
@@ -2837,27 +2855,43 @@ export const certificateV3ServiceFactory = ({
throw new NotFoundError({ message: "Certificate not found" });
}
- const { permission } = await permissionService.getProjectPermission({
- actor,
- actorId,
- projectId: certificate.projectId,
- actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.CertificateManager
- });
-
const metadataRows = await resourceMetadataDAL.find({ certificateId: certificate.id });
const certMetadata = metadataRows.map(({ key, value }) => ({ key, value: value || "" }));
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionCertificateActions.Edit,
- subject(ProjectPermissionSub.Certificates, {
- commonName: certificate.commonName,
- altNames: certificate.altNames?.split(",").map((s) => s.trim()),
- serialNumber: certificate.serialNumber,
- metadata: certMetadata
- })
- );
+ if (certificate.applicationId) {
+ const { permission } = await permissionService.getResourcePermission({
+ actor,
+ actorId,
+ projectId: certificate.projectId,
+ resourceType: ResourceType.CertificateApplication,
+ resourceId: certificate.applicationId,
+ actorAuthMethod,
+ actorOrgId
+ });
+ ForbiddenError.from(permission).throwUnlessCan(
+ ResourcePermissionCertificateActions.Edit,
+ ResourcePermissionSub.Certificates
+ );
+ } else {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: certificate.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Edit,
+ subject(ProjectPermissionSub.Certificates, {
+ commonName: certificate.commonName,
+ altNames: certificate.altNames?.split(",").map((s) => s.trim()),
+ serialNumber: certificate.serialNumber,
+ metadata: certMetadata
+ })
+ );
+ }
if (!certificate.profileId) {
throw new BadRequestError({
diff --git a/backend/src/services/certificate/certificate-dal.ts b/backend/src/services/certificate/certificate-dal.ts
index 4d57a02ec5..a636d47db1 100644
--- a/backend/src/services/certificate/certificate-dal.ts
+++ b/backend/src/services/certificate/certificate-dal.ts
@@ -517,7 +517,28 @@ export const certificateDALFactory = (db: TDbClient) => {
.select(db.ref(`${TableName.CertificateSecret}.certId`).as("privateKeyRef"))
.select(db.ref("name").withSchema(TableName.CertificateAuthority).as("caName"))
.select(db.ref("slug").withSchema(TableName.PkiCertificateProfile).as("profileName"))
- .select(db.ref("enrollmentType").withSchema(TableName.PkiCertificateProfile).as("enrollmentType"))
+ .select(
+ db.raw(
+ `COALESCE(
+ (SELECT ??.?? FROM ?? WHERE ??.?? = ??.?? ORDER BY ??.?? ASC LIMIT 1),
+ ??.??
+ ) as ??`,
+ [
+ TableName.CertificateRequests,
+ "enrollmentType",
+ TableName.CertificateRequests,
+ TableName.CertificateRequests,
+ "certificateId",
+ TableName.Certificate,
+ "id",
+ TableName.CertificateRequests,
+ "createdAt",
+ TableName.PkiCertificateProfile,
+ "enrollmentType",
+ "enrollmentType"
+ ]
+ )
+ )
.select(db.ref("name").withSchema(TableName.PkiApplication).as("applicationName"));
const {
diff --git a/backend/src/services/certificate/certificate-service.ts b/backend/src/services/certificate/certificate-service.ts
index 5e0669b75b..c2bee3f4d4 100644
--- a/backend/src/services/certificate/certificate-service.ts
+++ b/backend/src/services/certificate/certificate-service.ts
@@ -295,27 +295,43 @@ export const certificateServiceFactory = ({
const deleteCert = async ({ id, serialNumber, actorId, actorAuthMethod, actor, actorOrgId }: TDeleteCertDTO) => {
const cert = id ? await certificateDAL.findById(id) : await certificateDAL.findOne({ serialNumber });
- const { permission } = await permissionService.getProjectPermission({
- actor,
- actorId,
- projectId: cert.projectId,
- actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.CertificateManager
- });
-
const metadataRows = await resourceMetadataDAL.find({ certificateId: cert.id });
const certMetadata = metadataRows.map(({ key, value }) => ({ key, value: value || "" }));
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionCertificateActions.Delete,
- subject(ProjectPermissionSub.Certificates, {
- commonName: cert.commonName,
- altNames: cert.altNames?.split(",").map((s) => s.trim()),
- serialNumber: cert.serialNumber,
- metadata: certMetadata
- })
- );
+ if (cert.applicationId) {
+ const { permission } = await permissionService.getResourcePermission({
+ actor,
+ actorId,
+ projectId: cert.projectId,
+ resourceType: ResourceType.CertificateApplication,
+ resourceId: cert.applicationId,
+ actorAuthMethod,
+ actorOrgId
+ });
+ ForbiddenError.from(permission).throwUnlessCan(
+ ResourcePermissionCertificateActions.Delete,
+ ResourcePermissionSub.Certificates
+ );
+ } else {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: cert.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Delete,
+ subject(ProjectPermissionSub.Certificates, {
+ commonName: cert.commonName,
+ altNames: cert.altNames?.split(",").map((s) => s.trim()),
+ serialNumber: cert.serialNumber,
+ metadata: certMetadata
+ })
+ );
+ }
let deletedCert;
try {
@@ -379,29 +395,45 @@ export const certificateServiceFactory = ({
});
}
- const { permission } = await permissionService.getProjectPermission({
- actor,
- actorId,
- projectId: ca.projectId,
- actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.CertificateManager
- });
-
const metadataRows = await resourceMetadataDAL.find({ certificateId: cert.id });
const certMetadata = metadataRows.map(({ key, value }) => ({ key, value: value || "" }));
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionCertificateActions.Delete,
- subject(ProjectPermissionSub.Certificates, {
- commonName: cert.commonName,
- altNames: cert.altNames?.split(",").map((s) => s.trim()),
- serialNumber: cert.serialNumber,
- friendlyName: cert.friendlyName,
- status: cert.status,
- metadata: certMetadata
- })
- );
+ if (cert.applicationId) {
+ const { permission } = await permissionService.getResourcePermission({
+ actor,
+ actorId,
+ projectId: ca.projectId,
+ resourceType: ResourceType.CertificateApplication,
+ resourceId: cert.applicationId,
+ actorAuthMethod,
+ actorOrgId
+ });
+ ForbiddenError.from(permission).throwUnlessCan(
+ ResourcePermissionCertificateActions.Delete,
+ ResourcePermissionSub.Certificates
+ );
+ } else {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: ca.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Delete,
+ subject(ProjectPermissionSub.Certificates, {
+ commonName: cert.commonName,
+ altNames: cert.altNames?.split(",").map((s) => s.trim()),
+ serialNumber: cert.serialNumber,
+ friendlyName: cert.friendlyName,
+ status: cert.status,
+ metadata: certMetadata
+ })
+ );
+ }
if (cert.status === CertStatus.REVOKED) throw new Error("Certificate already revoked");
diff --git a/backend/src/services/pki-sync/pki-sync-service.ts b/backend/src/services/pki-sync/pki-sync-service.ts
index 5666f4fce4..fa913c4338 100644
--- a/backend/src/services/pki-sync/pki-sync-service.ts
+++ b/backend/src/services/pki-sync/pki-sync-service.ts
@@ -9,7 +9,7 @@ import {
ResourcePermissionSub
} from "@app/ee/services/permission/resource-permission";
import { getProcessedPermissionRules } from "@app/lib/casl/permission-filter-utils";
-import { BadRequestError, DatabaseError, NotFoundError } from "@app/lib/errors";
+import { BadRequestError, DatabaseError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { OrgServiceActor } from "@app/lib/types";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { TAppConnectionServiceFactory } from "@app/services/app-connection/app-connection-service";
@@ -462,14 +462,7 @@ export const pkiSyncServiceFactory = ({
pkiSyncSubscriber = await pkiSubscriberDAL.findById(pkiSync.subscriberId);
}
- const deleteAllowedByProject = permission.can(
- ProjectPermissionPkiSyncActions.Delete,
- subject(ProjectPermissionSub.PkiSyncs, {
- subscriberName: pkiSyncSubscriber?.name,
- name: pkiSync.name
- })
- );
- if (!deleteAllowedByProject) {
+ if (pkiSync.applicationId) {
const deleteAllowedByResource = await $resourceFallback(
ResourcePermissionPkiSyncActions.Delete,
pkiSync.projectId,
@@ -477,14 +470,18 @@ export const pkiSyncServiceFactory = ({
actor
);
if (!deleteAllowedByResource) {
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionPkiSyncActions.Delete,
- subject(ProjectPermissionSub.PkiSyncs, {
- subscriberName: pkiSyncSubscriber?.name,
- name: pkiSync.name
- })
- );
+ throw new ForbiddenRequestError({
+ message: "You do not have permission to delete this Application's certificate sync"
+ });
}
+ } else {
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSyncActions.Delete,
+ subject(ProjectPermissionSub.PkiSyncs, {
+ subscriberName: pkiSyncSubscriber?.name,
+ name: pkiSync.name
+ })
+ );
}
return pkiSyncDAL.deleteById(id);
diff --git a/backend/src/services/role/role-service.ts b/backend/src/services/role/role-service.ts
index e74c916f51..801f80d2d8 100644
--- a/backend/src/services/role/role-service.ts
+++ b/backend/src/services/role/role-service.ts
@@ -30,6 +30,22 @@ import {
TUpdateRoleDTO
} from "./role-types";
+const stripExpiredTemporaryRoles = <
+ M extends {
+ roles: Array<{
+ role: string;
+ isTemporary?: boolean;
+ temporaryAccessEndTime?: Date | null;
+ }>;
+ }
+>(
+ memberships: M[]
+): M[] =>
+ memberships.map((m) => ({
+ ...m,
+ roles: m.roles.filter((r) => !r.isTemporary || (r.temporaryAccessEndTime && new Date() < r.temporaryAccessEndTime))
+ }));
+
type TRoleServiceFactoryDep = {
roleDAL: TRoleDALFactory;
identityDAL: Pick<TIdentityDALFactory, "findById">;
@@ -259,7 +275,11 @@ export const roleServiceFactory = ({
actorAuthMethod: dto.permission.authMethod,
scope: OrganizationActionScope.Any
});
- return { permissions: packRules(permission.rules), memberships, assumedPrivilegeDetails: undefined };
+ return {
+ permissions: packRules(permission.rules),
+ memberships: stripExpiredTemporaryRoles(memberships),
+ assumedPrivilegeDetails: undefined
+ };
}
if (dto.scopeData.scope === AccessScope.Project) {
@@ -299,7 +319,11 @@ export const roleServiceFactory = ({
assumedPrivilegeDetails.actorEmail = userDetails?.email || "";
}
- return { permissions: packRules(permission.rules), memberships, assumedPrivilegeDetails };
+ return {
+ permissions: packRules(permission.rules),
+ memberships: stripExpiredTemporaryRoles(memberships),
+ assumedPrivilegeDetails
+ };
}
throw new BadRequestError({ message: "Invalid scope defined" });
diff --git a/backend/src/services/smtp/emails/CredentialRotationFailedTemplate.tsx b/backend/src/services/smtp/emails/CredentialRotationFailedTemplate.tsx
index 91bab46931..1bcbbd23f5 100644
--- a/backend/src/services/smtp/emails/CredentialRotationFailedTemplate.tsx
+++ b/backend/src/services/smtp/emails/CredentialRotationFailedTemplate.tsx
@@ -21,14 +21,10 @@ export const CredentialRotationFailedTemplate = ({
content
}: CredentialRotationFailedTemplateProps) => {
return (
- <BaseEmailWrapper
- title="Credential Rotation Failed"
- preview="A credential rotation failed."
- siteUrl={siteUrl}
- >
+ <BaseEmailWrapper title="Credential Rotation Failed" preview="A credential rotation failed." siteUrl={siteUrl}>
<Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">
- Your <strong>{rotationType}</strong> credential rotation for connection{" "}
- <strong>{connectionName}</strong> failed to rotate
+ Your <strong>{rotationType}</strong> credential rotation for connection <strong>{connectionName}</strong> failed
+ to rotate
</Heading>
<Section className="px-[24px] mb-[28px] mt-[36px] pt-[26px] pb-[4px] text-[14px] border border-solid border-gray-200 rounded-md bg-gray-50">
<strong>Connection</strong>
diff --git a/backend/src/services/smtp/emails/SecretRotationFailedTemplate.tsx b/backend/src/services/smtp/emails/SecretRotationFailedTemplate.tsx
index 71a05f4768..7741ef7454 100644
--- a/backend/src/services/smtp/emails/SecretRotationFailedTemplate.tsx
+++ b/backend/src/services/smtp/emails/SecretRotationFailedTemplate.tsx
@@ -46,7 +46,9 @@ export const SecretRotationFailedTemplate = ({
<Text className="text-[14px] text-red-600 mt-[4px]">{content}</Text>
</Section>
<Section className="text-center">
- <BaseButton href={`${rotationUrl}?search=${encodeURIComponent(rotationName)}&secretPath=${encodeURIComponent(secretPath)}&environments=${encodeURIComponent(environmentSlug)}&filterBy=rotation`}>
+ <BaseButton
+ href={`${rotationUrl}?search=${encodeURIComponent(rotationName)}&secretPath=${encodeURIComponent(secretPath)}&environments=${encodeURIComponent(environmentSlug)}&filterBy=rotation`}
+ >
View in Infisical
</BaseButton>
</Section>
diff --git a/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx b/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx
index a5dcdfc160..544e612a89 100644
--- a/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx
+++ b/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx
@@ -24,7 +24,9 @@ export const useProjectPermission = () => {
} = useSuspenseQuery({
queryKey: roleQueryKeys.getUserProjectPermissions({ projectId }),
queryFn: () => fetchUserProjectPermissions({ projectId }),
- staleTime: Infinity,
+ staleTime: 60_000,
+ refetchInterval: 60_000,
+ refetchOnWindowFocus: true,
select: (data) => {
const rule = unpackRules<RawRuleOf<MongoAbility<ProjectPermissionSet>>>(data.permissions);
const ability = evaluatePermissionsAbility(rule);
diff --git a/frontend/src/hooks/api/ca/mutations.tsx b/frontend/src/hooks/api/ca/mutations.tsx
index 7ed6ff8fd5..943dff1417 100644
--- a/frontend/src/hooks/api/ca/mutations.tsx
+++ b/frontend/src/hooks/api/ca/mutations.tsx
@@ -42,7 +42,9 @@ export const useUpdateCa = () => {
queryClient.invalidateQueries({
queryKey: caKeys.getCaById(id)
});
- // Invalidate external CAs list
+ queryClient.invalidateQueries({
+ queryKey: caKeys.listCasByProjectId()
+ });
queryClient.invalidateQueries({
queryKey: caKeys.listExternalCasByProjectId()
});
@@ -64,7 +66,9 @@ export const useCreateCa = () => {
queryClient.invalidateQueries({
queryKey: caKeys.listCasByTypeAndProjectId(type)
});
- // Invalidate external CAs list
+ queryClient.invalidateQueries({
+ queryKey: caKeys.listCasByProjectId()
+ });
queryClient.invalidateQueries({
queryKey: caKeys.listExternalCasByProjectId()
});
@@ -85,7 +89,9 @@ export const useDeleteCa = () => {
queryClient.invalidateQueries({
queryKey: caKeys.listCasByTypeAndProjectId(type)
});
- // Invalidate external CAs list
+ queryClient.invalidateQueries({
+ queryKey: caKeys.listCasByProjectId()
+ });
queryClient.invalidateQueries({
queryKey: caKeys.listExternalCasByProjectId()
});
@@ -123,6 +129,9 @@ export const useImportCaCertificate = () => {
queryClient.invalidateQueries({
queryKey: caKeys.listCasByTypeAndProjectId(CaType.INTERNAL)
});
+ queryClient.invalidateQueries({
+ queryKey: caKeys.listCasByProjectId()
+ });
}
});
};
@@ -182,6 +191,7 @@ export const useOrderCertificateWithProfile = () => {
queryClient.invalidateQueries({
queryKey: projectKeys.allProjectCertificates()
});
+ queryClient.invalidateQueries({ queryKey: ["approval-requests"] });
}
});
};
@@ -229,6 +239,9 @@ export const useInstallCaCertificateVenafi = () => {
queryClient.invalidateQueries({
queryKey: caKeys.listCasByTypeAndProjectId(CaType.INTERNAL)
});
+ queryClient.invalidateQueries({
+ queryKey: caKeys.listCasByProjectId()
+ });
}
});
};
@@ -256,6 +269,9 @@ export const useInstallCaCertificateAdcs = () => {
queryClient.invalidateQueries({
queryKey: caKeys.listCasByTypeAndProjectId(CaType.INTERNAL)
});
+ queryClient.invalidateQueries({
+ queryKey: caKeys.listCasByProjectId()
+ });
}
});
};
@@ -372,6 +388,9 @@ export const useGenerateCaCertificate = () => {
queryClient.invalidateQueries({
queryKey: caKeys.listCasByTypeAndProjectId(CaType.INTERNAL)
});
+ queryClient.invalidateQueries({
+ queryKey: caKeys.listCasByProjectId()
+ });
}
});
};
diff --git a/frontend/src/hooks/api/certificateProfiles/mutations.tsx b/frontend/src/hooks/api/certificateProfiles/mutations.tsx
index 3a76ca1d30..e38d8ce262 100644
--- a/frontend/src/hooks/api/certificateProfiles/mutations.tsx
+++ b/frontend/src/hooks/api/certificateProfiles/mutations.tsx
@@ -1,6 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
+import { pkiApplicationKeys } from "@app/hooks/api/pkiApplications/queries";
import { certificateProfileKeys } from "./queries";
import {
@@ -24,6 +25,7 @@ export const useCreateCertificateProfile = () => {
queryClient.invalidateQueries({
queryKey: ["certificate-profiles", "list"]
});
+ queryClient.invalidateQueries({ queryKey: pkiApplicationKeys.all });
}
});
};
@@ -45,6 +47,7 @@ export const useUpdateCertificateProfile = () => {
queryClient.invalidateQueries({
queryKey: certificateProfileKeys.getById(profileId)
});
+ queryClient.invalidateQueries({ queryKey: pkiApplicationKeys.all });
}
});
};
@@ -66,6 +69,7 @@ export const useDeleteCertificateProfile = () => {
queryClient.removeQueries({
queryKey: certificateProfileKeys.getById(profileId)
});
+ queryClient.invalidateQueries({ queryKey: pkiApplicationKeys.all });
}
});
};
diff --git a/frontend/src/hooks/api/certificates/mutations.tsx b/frontend/src/hooks/api/certificates/mutations.tsx
index 523ee16b73..887aee7d35 100644
--- a/frontend/src/hooks/api/certificates/mutations.tsx
+++ b/frontend/src/hooks/api/certificates/mutations.tsx
@@ -255,6 +255,7 @@ export const useUnifiedCertificateIssuance = () => {
queryClient.invalidateQueries({
queryKey: ["cert-dashboard-stats"]
});
+ queryClient.invalidateQueries({ queryKey: ["approval-requests"] });
}
});
};
diff --git a/frontend/src/hooks/api/pkiApplications/queries.ts b/frontend/src/hooks/api/pkiApplications/queries.ts
index d3687d9533..68ed453ca8 100644
--- a/frontend/src/hooks/api/pkiApplications/queries.ts
+++ b/frontend/src/hooks/api/pkiApplications/queries.ts
@@ -81,6 +81,31 @@ export const useGetPkiApplicationByName = (
...options
});
+export const useGetPkiApplicationById = (
+ applicationId: string,
+ options?: Omit<
+ UseQueryOptions<
+ { application: TPkiApplication },
+ unknown,
+ TPkiApplication,
+ ReturnType<typeof pkiApplicationKeys.byId>
+ >,
+ "queryKey" | "queryFn"
+ >
+) =>
+ useQuery({
+ queryKey: pkiApplicationKeys.byId(applicationId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ application: TPkiApplication }>(
+ `${BASE_URL}/${applicationId}`
+ );
+ return data;
+ },
+ enabled: Boolean(applicationId),
+ select: (data) => data.application,
+ ...options
+ });
+
export const useListPkiApplicationProfiles = (applicationId: string) =>
useQuery({
queryKey: pkiApplicationKeys.profiles(applicationId),
diff --git a/frontend/src/hooks/api/projectIdentityMembership/mutations.tsx b/frontend/src/hooks/api/projectIdentityMembership/mutations.tsx
index 97d1b64133..c609cb4751 100644
--- a/frontend/src/hooks/api/projectIdentityMembership/mutations.tsx
+++ b/frontend/src/hooks/api/projectIdentityMembership/mutations.tsx
@@ -3,6 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { identitiesKeys, projectKeys } from "@app/hooks/api";
import { identityMembershipsBase } from "@app/hooks/api/certManagerAccess";
+import { pkiApplicationKeys } from "@app/hooks/api/pkiApplications/queries";
import { projectIdentityQuery } from "@app/hooks/api/projectIdentity";
import {
@@ -40,6 +41,7 @@ export const useCreateProjectIdentityMembership = () => {
queryClient.invalidateQueries({
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
});
+ queryClient.invalidateQueries({ queryKey: pkiApplicationKeys.all });
}
});
};
@@ -99,6 +101,7 @@ export const useDeleteProjectIdentityMembership = () => {
queryClient.invalidateQueries({
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
});
+ queryClient.invalidateQueries({ queryKey: pkiApplicationKeys.all });
}
});
};
diff --git a/frontend/src/hooks/api/projects/mutations.tsx b/frontend/src/hooks/api/projects/mutations.tsx
index e9298dcea2..b4ee345371 100644
--- a/frontend/src/hooks/api/projects/mutations.tsx
+++ b/frontend/src/hooks/api/projects/mutations.tsx
@@ -5,6 +5,7 @@ import { groupMembershipsBase } from "@app/hooks/api/certManagerAccess";
import { groupKeys } from "../groups/queries";
import { TGroupMembership } from "../groups/types";
+import { pkiApplicationKeys } from "../pkiApplications/queries";
import { userKeys } from "../users/query-keys";
import { projectKeys } from "./query-keys";
import {
@@ -99,6 +100,8 @@ export const useDeleteGroupFromWorkspace = () => {
if (username) {
queryClient.invalidateQueries({ queryKey: userKeys.listUserGroupMemberships(username) });
}
+
+ queryClient.invalidateQueries({ queryKey: pkiApplicationKeys.all });
}
});
};
diff --git a/frontend/src/hooks/api/projects/queries.tsx b/frontend/src/hooks/api/projects/queries.tsx
index aebb96c5bc..9c40383b81 100644
--- a/frontend/src/hooks/api/projects/queries.tsx
+++ b/frontend/src/hooks/api/projects/queries.tsx
@@ -11,6 +11,7 @@ import { TGroupMembership } from "../groups/types";
import { IntegrationAuth } from "../integrationAuth/types";
import { TIntegration } from "../integrations/types";
import { TPkiAlert } from "../pkiAlerts/types";
+import { pkiApplicationKeys } from "../pkiApplications/queries";
import { TPkiCollection } from "../pkiCollections/types";
import { TPkiSubscriber } from "../pkiSubscriber/types";
import { TSshCertificate, TSshCertificateAuthority } from "../sshCa/types";
@@ -428,6 +429,7 @@ export const useDeleteUserFromWorkspace = () => {
queryClient.invalidateQueries({
queryKey: userKeys.allOrgMembershipProjectMemberships(orgId)
});
+ queryClient.invalidateQueries({ queryKey: pkiApplicationKeys.all });
}
});
};
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
index a26035aaeb..ec9674e8e5 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
@@ -16,17 +16,17 @@ import {
DialogHeader,
DialogTitle
} from "@app/components/v3";
-import { useOrganization } from "@app/context";
+import { useOrganization, useProject } from "@app/context";
import {
useGetIdentityMembershipOrgs,
useGetOrganizationGroups
} from "@app/hooks/api/organization";
-import { useCreateOrgIdentity } from "@app/hooks/api/orgIdentity";
import {
TPkiApplicationMember,
useAddPkiApplicationMember,
useAddPkiApplicationUserMembers
} from "@app/hooks/api/pkiApplications";
+import { useCreateProjectIdentity } from "@app/hooks/api/projectIdentity";
import {
useCreateProjectIdentityMembership,
useListProjectIdentityMemberships
@@ -81,8 +81,8 @@ const NoUserOptions = () => (
const NoIdentityOptions = () => (
<p>
- No matching identities. Type a name to create a new machine identity in the org and attach it to
- this Application.
+ No matching identities. Type a name to create a new machine identity in this project and attach
+ it to this Application.
</p>
);
@@ -93,7 +93,9 @@ export const AddApplicationMemberModal = ({
existingMembers
}: Props) => {
const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const orgId = currentOrg?.id ?? "";
+ const projectId = currentProject?.id ?? "";
const [type, setType] = useState<ActorType>("user");
const [selectedUsers, setSelectedUsers] = useState<Option[]>([]);
@@ -118,7 +120,7 @@ export const AddApplicationMemberModal = ({
const addMember = useAddPkiApplicationMember();
const addUserMembers = useAddPkiApplicationUserMembers();
- const createIdentity = useCreateOrgIdentity();
+ const createProjectIdentity = useCreateProjectIdentity();
const addIdentityToProject = useCreateProjectIdentityMembership();
const taken = useMemo(() => {
@@ -207,22 +209,24 @@ export const AddApplicationMemberModal = ({
const submitIdentities = async () => {
if (selectedIdentities.length === 0) return;
+ const newlyCreatedIds = new Set<string>();
const identityIds: string[] = [];
await runSequential(selectedIdentities, async (item) => {
if (item.isNew) {
- const created = await createIdentity.mutateAsync({
- organizationId: orgId,
+ const created = await createProjectIdentity.mutateAsync({
+ projectId,
name: item.value,
hasDeleteProtection: false
});
identityIds.push(created.id);
+ newlyCreatedIds.add(created.id);
} else {
identityIds.push(item.value);
}
});
const idsNeedingProjectMembership = identityIds.filter(
- (id) => !identityIdsAlreadyInProject.has(id)
+ (id) => !newlyCreatedIds.has(id) && !identityIdsAlreadyInProject.has(id)
);
await runSequential(idsNeedingProjectMembership, async (identityId) => {
await addIdentityToProject.mutateAsync({
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
index 53b18191aa..267feb5a30 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
@@ -587,29 +587,42 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
<TableRow key={p.profileId}>
<TableCell className="font-mono">{p.profileSlug}</TableCell>
<TableCell>
- <button
- type="button"
- onClick={() => setProfileToConfigure(p)}
- className="group -mx-2 inline-flex items-center gap-2 rounded-sm px-2 py-1 text-left transition-colors hover:bg-mineshaft-700/50"
- aria-label={
- hasMethods
- ? `Edit enrollment for ${p.profileSlug}`
- : `Configure enrollment for ${p.profileSlug}`
- }
- >
- {hasMethods ? (
- <div className="flex flex-wrap gap-1.5">
- {methods.map((m) => (
- <Badge key={m} variant="neutral">
- {m}
- </Badge>
- ))}
- </div>
- ) : (
- <span className="text-xs text-accent">Configure</span>
- )}
- <PencilIcon className="size-3 shrink-0 text-accent opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" />
- </button>
+ {/* eslint-disable-next-line no-nested-ternary */}
+ {canConfigureEnrollment ? (
+ <button
+ type="button"
+ onClick={() => setProfileToConfigure(p)}
+ className="group -mx-2 inline-flex items-center gap-2 rounded-sm px-2 py-1 text-left transition-colors hover:bg-mineshaft-700/50"
+ aria-label={
+ hasMethods
+ ? `Edit enrollment for ${p.profileSlug}`
+ : `Configure enrollment for ${p.profileSlug}`
+ }
+ >
+ {hasMethods ? (
+ <div className="flex flex-wrap gap-1.5">
+ {methods.map((m) => (
+ <Badge key={m} variant="neutral">
+ {m}
+ </Badge>
+ ))}
+ </div>
+ ) : (
+ <span className="text-xs text-accent">Configure</span>
+ )}
+ <PencilIcon className="size-3 shrink-0 text-accent opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" />
+ </button>
+ ) : hasMethods ? (
+ <div className="flex flex-wrap gap-1.5">
+ {methods.map((m) => (
+ <Badge key={m} variant="neutral">
+ {m}
+ </Badge>
+ ))}
+ </div>
+ ) : (
+ <span className="text-xs text-accent">—</span>
+ )}
</TableCell>
<TableCell className="text-right">
{canConfigureEnrollment || canManageProfileAttachments ? (
@@ -692,51 +705,55 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
</CardAction>
</CardHeader>
<CardContent>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="w-full">Name</TableHead>
- <TableHead className="whitespace-nowrap">Event Type</TableHead>
- <TableHead className="whitespace-nowrap">Status</TableHead>
- <TableHead className="whitespace-nowrap">Alert Before</TableHead>
- <TableHead className="whitespace-nowrap">Last Run</TableHead>
- <TableHead className="w-5 text-right">Actions</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {isAlertsLoading &&
- Array.from({ length: 3 }, (_, idx) => (
- <TableRow key={`alert-skeleton-${idx + 1}`}>
- {Array.from({ length: 6 }, (__, cellIdx) => (
- <TableCell key={`alert-skeleton-cell-${cellIdx + 1}`}>
- <Skeleton className="h-4 w-24" />
- </TableCell>
- ))}
- </TableRow>
- ))}
- {!isAlertsLoading && alerts.length === 0 && (
+ {!isAlertsLoading && alerts.length === 0 ? (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No alerts configured</EmptyTitle>
+ <EmptyDescription>
+ Create one to get notified about certificate events for this Application.
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ ) : (
+ <Table>
+ <TableHeader>
<TableRow>
- <TableCell colSpan={6} className="py-8 text-center text-accent">
- No PKI alerts configured yet.
- </TableCell>
+ <TableHead className="w-full">Name</TableHead>
+ <TableHead className="whitespace-nowrap">Event Type</TableHead>
+ <TableHead className="whitespace-nowrap">Status</TableHead>
+ <TableHead className="whitespace-nowrap">Alert Before</TableHead>
+ <TableHead className="whitespace-nowrap">Last Run</TableHead>
+ <TableHead className="w-5 text-right">Actions</TableHead>
</TableRow>
- )}
- {!isAlertsLoading &&
- alerts.map((a: TPkiAlertV2) => (
- <AlertRow
- key={a.id}
- alert={a}
- onView={() => setViewAlertModal({ isOpen: true, alertId: a.id })}
- onEdit={() => setAlertModal({ isOpen: true, alertId: a.id })}
- onDelete={() =>
- setDeleteAlertModal({ isOpen: true, alertId: a.id, name: a.name })
- }
- canEdit={canEditAlerts}
- canDelete={canDeleteAlerts}
- />
- ))}
- </TableBody>
- </Table>
+ </TableHeader>
+ <TableBody>
+ {isAlertsLoading &&
+ Array.from({ length: 3 }, (_, idx) => (
+ <TableRow key={`alert-skeleton-${idx + 1}`}>
+ {Array.from({ length: 6 }, (__, cellIdx) => (
+ <TableCell key={`alert-skeleton-cell-${cellIdx + 1}`}>
+ <Skeleton className="h-4 w-24" />
+ </TableCell>
+ ))}
+ </TableRow>
+ ))}
+ {!isAlertsLoading &&
+ alerts.map((a: TPkiAlertV2) => (
+ <AlertRow
+ key={a.id}
+ alert={a}
+ onView={() => setViewAlertModal({ isOpen: true, alertId: a.id })}
+ onEdit={() => setAlertModal({ isOpen: true, alertId: a.id })}
+ onDelete={() =>
+ setDeleteAlertModal({ isOpen: true, alertId: a.id, name: a.name })
+ }
+ canEdit={canEditAlerts}
+ canDelete={canDeleteAlerts}
+ />
+ ))}
+ </TableBody>
+ </Table>
+ )}
</CardContent>
</Card>
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
index 5597d3f625..192f116fc9 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { faCheck, faCopy, faDownload } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { Plus } from "lucide-react";
+import { EyeIcon, EyeOffIcon, FileTextIcon, Plus, RotateCwIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { ConfirmActionModal, Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
@@ -26,15 +26,21 @@ import {
FieldDescription,
FieldError,
FieldLabel,
- IconButton,
Input,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupButton,
+ InputGroupInput,
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
Switch,
- TextArea
+ TextArea,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
} from "@app/components/v3";
import { downloadFile } from "@app/helpers/download";
import { useToggle } from "@app/hooks";
@@ -65,35 +71,102 @@ type Props = {
const errorText = (err: unknown, fallback: string) =>
err instanceof Error ? err.message : fallback;
+const SectionCard = ({
+ title,
+ actions,
+ children,
+ className
+}: {
+ title: string;
+ actions?: React.ReactNode;
+ children: React.ReactNode;
+ className?: string;
+}) => (
+ <section
+ className={`rounded-md border border-border bg-foreground/[0.02] ${className ?? ""}`.trim()}
+ >
+ <header className="flex items-center justify-between gap-3 border-b border-border px-4 py-2.5">
+ <h3 className="text-xs font-semibold tracking-wider text-accent uppercase">{title}</h3>
+ {actions ? <div className="flex items-center gap-2">{actions}</div> : null}
+ </header>
+ <div className="space-y-4 px-4 py-4">{children}</div>
+ </section>
+);
+
const CopyableField = ({
label,
value,
helper
+}: {
+ label: string;
+ value: string;
+ helper?: React.ReactNode;
+}) => {
+ const [copied, setCopied] = useToggle(false);
+ return (
+ <div>
+ {label ? <FieldLabel>{label}</FieldLabel> : null}
+ <InputGroup>
+ <InputGroupInput value={value} readOnly className="font-mono text-xs" />
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ aria-label={`copy ${label || "value"}`}
+ onClick={() => {
+ navigator.clipboard.writeText(value);
+ setCopied.on();
+ setTimeout(() => setCopied.off(), COPY_RESET_MS);
+ }}
+ >
+ <FontAwesomeIcon icon={copied ? faCheck : faCopy} />
+ </InputGroupButton>
+ </InputGroupAddon>
+ </InputGroup>
+ {helper ? <p className="mt-1 text-xs text-accent">{helper}</p> : null}
+ </div>
+ );
+};
+
+const SecretField = ({
+ label,
+ value,
+ helper
}: {
label: string;
value: string;
helper?: string;
}) => {
const [copied, setCopied] = useToggle(false);
+ const [shown, setShown] = useToggle(false);
return (
<div>
<FieldLabel>{label}</FieldLabel>
- <div className="flex gap-2">
- <Input value={value} disabled />
- <IconButton
- aria-label={`copy ${label}`}
- variant="outline"
- className="w-10"
- onClick={() => {
- navigator.clipboard.writeText(value);
- setCopied.on();
- setTimeout(() => setCopied.off(), COPY_RESET_MS);
- }}
- >
- <FontAwesomeIcon icon={copied ? faCheck : faCopy} />
- </IconButton>
- </div>
- {helper ? <p className="mt-1 text-xs text-mineshaft-400">{helper}</p> : null}
+ <InputGroup>
+ <InputGroupInput
+ value={value}
+ readOnly
+ type={shown ? "text" : "password"}
+ className="font-mono text-xs"
+ />
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ aria-label={shown ? "hide value" : "show value"}
+ onClick={setShown.toggle}
+ >
+ {shown ? <EyeOffIcon /> : <EyeIcon />}
+ </InputGroupButton>
+ <InputGroupButton
+ aria-label={`copy ${label}`}
+ onClick={() => {
+ navigator.clipboard.writeText(value);
+ setCopied.on();
+ setTimeout(() => setCopied.off(), COPY_RESET_MS);
+ }}
+ >
+ <FontAwesomeIcon icon={copied ? faCheck : faCopy} />
+ </InputGroupButton>
+ </InputGroupAddon>
+ </InputGroup>
+ {helper ? <p className="mt-1 text-xs text-accent">{helper}</p> : null}
</div>
);
};
@@ -186,54 +259,71 @@ const ApiPanel = ({
}
};
+ const apiEndpointUrl =
+ typeof window !== "undefined"
+ ? `${window.location.origin}/api/v1/cert-manager/certificates`
+ : "/api/v1/cert-manager/certificates";
+
return (
- <div className="space-y-4">
- <p className="text-sm text-mineshaft-300">
- API enrollment lets clients request certificates by calling the Infisical API with this
- profile.
- </p>
- <Controller
- control={control}
- name="autoRenew"
- render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Auto-renew</FieldLabel>
- <p className="text-xs text-mineshaft-400">
- Automatically renew certificates issued via this profile before they expire.
- </p>
- </div>
- <Switch id="api-auto-renew" checked={field.value} onCheckedChange={field.onChange} />
- </div>
- )}
- />
- {autoRenew && (
+ <div className="space-y-5">
+ <SectionCard title="Endpoint">
+ <CopyableField
+ label="API endpoint URL"
+ value={apiEndpointUrl}
+ helper={
+ <>
+ POST to this endpoint with <code className="font-mono">applicationId</code>,{" "}
+ <code className="font-mono">profileId</code>, and an{" "}
+ <code className="font-mono">attributes</code> object (commonName, ttl, etc.) in the
+ body to issue a certificate from this profile.
+ </>
+ }
+ />
+ </SectionCard>
+ <SectionCard title="Renewal">
<Controller
control={control}
- name="renewBeforeDays"
- rules={{ min: 1, max: 365 }}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Renew before (days)</FieldLabel>
- <FieldContent>
- <Input
- type="number"
- min={1}
- max={365}
- value={field.value ?? ""}
- onChange={(e) =>
- field.onChange(e.target.value === "" ? undefined : Number(e.target.value))
- }
- placeholder="30"
- isError={Boolean(error)}
- />
- </FieldContent>
- {error ? <FieldError>Must be between 1 and 365</FieldError> : null}
- <FieldDescription>How many days before expiry to trigger renewal.</FieldDescription>
- </Field>
+ name="autoRenew"
+ render={({ field }) => (
+ <div className="flex items-start justify-between gap-4">
+ <div>
+ <FieldLabel>Auto-renew</FieldLabel>
+ <p className="text-xs text-accent">
+ Automatically renew certificates issued via this profile before they expire.
+ </p>
+ </div>
+ <Switch id="api-auto-renew" checked={field.value} onCheckedChange={field.onChange} />
+ </div>
)}
/>
- )}
+ {autoRenew && (
+ <Controller
+ control={control}
+ name="renewBeforeDays"
+ rules={{ min: 1, max: 365 }}
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel>Renew before (days)</FieldLabel>
+ <FieldContent>
+ <Input
+ type="number"
+ min={1}
+ max={365}
+ value={field.value ?? ""}
+ onChange={(e) =>
+ field.onChange(e.target.value === "" ? undefined : Number(e.target.value))
+ }
+ placeholder="30"
+ isError={Boolean(error)}
+ />
+ </FieldContent>
+ {error ? <FieldError>Must be between 1 and 365</FieldError> : null}
+ <FieldDescription>How many days before expiry to trigger renewal.</FieldDescription>
+ </Field>
+ )}
+ />
+ )}
+ </SectionCard>
<div className="flex justify-end gap-2 pt-2">
{enabled && (
<DisableEnrollmentButton
@@ -309,67 +399,84 @@ const EstPanel = ({
};
return (
- <div className="space-y-4">
- <p className="text-sm text-mineshaft-300">
- EST clients will authenticate to this profile with the passphrase below.
- </p>
+ <div className="space-y-5">
{enabled && initial?.estEndpointUrl ? (
- <div className="space-y-3 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3">
+ <SectionCard title="Endpoint">
<CopyableField
label="EST endpoint base URL"
value={initial.estEndpointUrl}
- helper="Append /simpleenroll, /simplereenroll, or /cacerts depending on the operation."
+ helper={
+ <>
+ Append <code className="font-mono">/simpleenroll</code>,{" "}
+ <code className="font-mono">/simplereenroll</code>, or{" "}
+ <code className="font-mono">/cacerts</code> depending on the operation.
+ </>
+ }
/>
- </div>
+ </SectionCard>
) : null}
- <Controller
- control={control}
- name="passphrase"
- rules={{ required: !enabled, minLength: 8 }}
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- {enabled ? "New passphrase (leave blank to keep current)" : "Passphrase"}
- </FieldLabel>
- <FieldContent>
- <Input type="password" {...field} placeholder="••••••••" isError={Boolean(error)} />
- </FieldContent>
- {error ? <FieldError>Minimum 8 characters</FieldError> : null}
- </Field>
- )}
- />
- <Controller
- control={control}
- name="caChain"
- render={({ field }) => (
- <Field>
- <FieldLabel>CA chain (optional)</FieldLabel>
- <FieldContent>
- <TextArea {...field} rows={3} placeholder="-----BEGIN CERTIFICATE-----..." />
- </FieldContent>
- <FieldDescription>PEM-encoded chain returned by the EST endpoint.</FieldDescription>
- </Field>
- )}
- />
- <Controller
- control={control}
- name="disableBootstrapCaValidation"
- render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Disable bootstrap CA validation</FieldLabel>
- <p className="text-xs text-mineshaft-400">
- Allow EST clients to skip server certificate validation during enrollment.
- </p>
+ <SectionCard title="Authentication">
+ <Controller
+ control={control}
+ name="passphrase"
+ rules={{ required: !enabled, minLength: 8 }}
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel>{enabled ? "New passphrase" : "Passphrase"}</FieldLabel>
+ <FieldContent>
+ <Input type="password" {...field} placeholder="••••••••" isError={Boolean(error)} />
+ </FieldContent>
+ <FieldDescription>
+ {enabled
+ ? "Leave blank to keep the current passphrase."
+ : "Minimum 8 characters. EST clients authenticate with this passphrase."}
+ </FieldDescription>
+ {error ? <FieldError>Minimum 8 characters</FieldError> : null}
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="caChain"
+ render={({ field }) => (
+ <Field>
+ <FieldLabel>CA chain (optional)</FieldLabel>
+ <FieldContent>
+ <TextArea
+ {...field}
+ rows={4}
+ placeholder={
+ "-----BEGIN CERTIFICATE-----\nMIIDdzCCAl+gAwIBAgIUJrK4...\n-----END CERTIFICATE-----"
+ }
+ className="font-mono text-xs"
+ />
+ </FieldContent>
+ <FieldDescription>PEM-encoded chain returned by the EST endpoint.</FieldDescription>
+ </Field>
+ )}
+ />
+ </SectionCard>
+ <SectionCard title="Advanced options">
+ <Controller
+ control={control}
+ name="disableBootstrapCaValidation"
+ render={({ field }) => (
+ <div className="flex items-start justify-between gap-4">
+ <div>
+ <FieldLabel>Disable bootstrap CA validation</FieldLabel>
+ <p className="text-xs text-accent">
+ Allow EST clients to skip server-certificate validation during enrollment.
+ </p>
+ </div>
+ <Switch
+ id="est-disable-bootstrap"
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
</div>
- <Switch
- id="est-disable-bootstrap"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </div>
- )}
- />
+ )}
+ />
+ </SectionCard>
<div className="flex justify-end gap-2 pt-2">
{enabled && (
<DisableEnrollmentButton
@@ -457,6 +564,10 @@ const AcmePanel = ({
};
const onReveal = async () => {
+ if (credentials) {
+ setCredentials(null);
+ return;
+ }
try {
const data = await revealMutation.mutateAsync({ applicationId, profileId });
setCredentials({ eabKid: data.eabKid, eabSecret: data.eabSecret });
@@ -477,80 +588,148 @@ const AcmePanel = ({
};
return (
- <div className="space-y-4">
- <p className="text-sm text-mineshaft-300">
- ACME clients use the EAB credentials below to register an account against this profile.
- </p>
+ <div className="space-y-5">
{enabled && initial?.directoryUrl ? (
- <div className="space-y-3 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3">
- <CopyableField label="ACME directory URL" value={initial.directoryUrl} />
- </div>
+ <SectionCard title="Endpoint">
+ <CopyableField
+ label="ACME directory URL"
+ value={initial.directoryUrl}
+ helper="Point your ACME client at this URL to register an account."
+ />
+ </SectionCard>
) : null}
- <p className="text-xs text-mineshaft-400">
- Pick at most one of the two options below — they are mutually exclusive.
- </p>
- <Controller
- control={control}
- name="skipDnsOwnershipVerification"
- render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Skip DNS ownership verification</FieldLabel>
- <p className="text-xs text-mineshaft-400">
- Skip DNS-01 / HTTP-01 challenge enforcement. Use only inside trusted networks.
- </p>
- </div>
- <Switch
- id="acme-skip-dns"
- checked={field.value}
- onCheckedChange={(v) => {
- field.onChange(v);
- if (v) setValue("skipEabBinding", false);
- }}
- disabled={skipEab}
- />
- </div>
- )}
- />
- <Controller
- control={control}
- name="skipEabBinding"
- render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Skip EAB binding</FieldLabel>
- <p className="text-xs text-mineshaft-400">
- Allow accounts to register without an EAB key. Recommended off in production.
- </p>
- </div>
- <Switch
- id="acme-skip-eab"
- checked={field.value}
- onCheckedChange={(v) => {
- field.onChange(v);
- if (v) setValue("skipDnsOwnershipVerification", false);
- }}
- disabled={skipDns}
- />
- </div>
- )}
- />
{enabled && (
- <div className="flex gap-2">
- <Button variant="outline" onClick={onReveal} isPending={revealMutation.isPending}>
- Reveal EAB credentials
- </Button>
- <Button variant="outline" onClick={onRotate} isPending={rotateMutation.isPending}>
- Rotate EAB secret
- </Button>
- </div>
- )}
- {credentials && (
- <div className="space-y-3 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3">
- <CopyableField label="EAB KID" value={credentials.eabKid} />
- <CopyableField label="EAB Secret" value={credentials.eabSecret} />
- </div>
+ <SectionCard
+ title="EAB credentials"
+ actions={
+ <>
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={onReveal}
+ isPending={revealMutation.isPending}
+ >
+ {credentials ? <EyeOffIcon /> : <EyeIcon />}
+ {credentials ? "Hide" : "Reveal"}
+ </Button>
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={onRotate}
+ isPending={rotateMutation.isPending}
+ >
+ <RotateCwIcon />
+ Rotate
+ </Button>
+ </>
+ }
+ >
+ {credentials ? (
+ <>
+ <CopyableField label="EAB KID" value={credentials.eabKid} />
+ <SecretField
+ label="EAB Secret"
+ value={credentials.eabSecret}
+ helper="External Account Binding key + secret used by ACME clients to register against this profile."
+ />
+ </>
+ ) : (
+ <p className="text-xs text-accent">
+ EAB credentials are hidden by default. Reveal them to copy into your ACME client.
+ </p>
+ )}
+ </SectionCard>
)}
+ <SectionCard title="Advanced options">
+ <Controller
+ control={control}
+ name="skipDnsOwnershipVerification"
+ render={({ field }) => (
+ <div className="flex items-start justify-between gap-4">
+ <div>
+ <FieldLabel>Skip DNS ownership verification</FieldLabel>
+ <p className="text-xs text-accent">
+ Skip DNS-01 / HTTP-01 challenge enforcement during enrollment.
+ </p>
+ </div>
+ {skipEab ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ {/* span wrapper lets the tooltip listen for hover on a disabled control */}
+ <span className="inline-flex">
+ <Switch
+ id="acme-skip-dns"
+ checked={field.value}
+ onCheckedChange={(v) => {
+ field.onChange(v);
+ if (v) setValue("skipEabBinding", false);
+ }}
+ disabled
+ />
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ You can only enable one of these at a time. Disable “Skip EAB binding” first.
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ <Switch
+ id="acme-skip-dns"
+ checked={field.value}
+ onCheckedChange={(v) => {
+ field.onChange(v);
+ if (v) setValue("skipEabBinding", false);
+ }}
+ />
+ )}
+ </div>
+ )}
+ />
+ <Controller
+ control={control}
+ name="skipEabBinding"
+ render={({ field }) => (
+ <div className="flex items-start justify-between gap-4">
+ <div>
+ <FieldLabel>Skip EAB binding</FieldLabel>
+ <p className="text-xs text-accent">
+ Allow ACME accounts to register without providing an EAB key.
+ </p>
+ </div>
+ {skipDns ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="inline-flex">
+ <Switch
+ id="acme-skip-eab"
+ checked={field.value}
+ onCheckedChange={(v) => {
+ field.onChange(v);
+ if (v) setValue("skipDnsOwnershipVerification", false);
+ }}
+ disabled
+ />
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ You can only enable one of these at a time. Disable “Skip DNS ownership
+ verification” first.
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ <Switch
+ id="acme-skip-eab"
+ checked={field.value}
+ onCheckedChange={(v) => {
+ field.onChange(v);
+ if (v) setValue("skipDnsOwnershipVerification", false);
+ }}
+ />
+ )}
+ </div>
+ )}
+ />
+ </SectionCard>
<div className="flex justify-end gap-2 pt-2">
{enabled && (
<DisableEnrollmentButton
@@ -660,13 +839,9 @@ const ScepPanel = ({
: null;
return (
- <div className="space-y-4">
- <p className="text-sm text-mineshaft-300">
- SCEP clients enroll by presenting a challenge password. Use static for shared passwords,
- dynamic for one-time per-client challenges.
- </p>
+ <div className="space-y-5">
{enabled && initial ? (
- <div className="space-y-3 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3">
+ <SectionCard title="Endpoint">
<CopyableField
label="SCEP endpoint URL"
value={initial.scepEndpointUrl}
@@ -676,150 +851,177 @@ const ScepPanel = ({
<CopyableField
label="Challenge endpoint URL"
value={initial.challengeEndpointUrl}
- helper="Authenticated POST endpoint to mint a one-time challenge (e.g., the JAMF SCEPChallenge webhook)."
+ helper="Authenticated POST endpoint to mint a one-time challenge (e.g. the JAMF SCEPChallenge webhook)."
/>
) : null}
- {initial.raCertificatePem ? (
- <div>
- <FieldLabel>RA certificate</FieldLabel>
- <div className="flex items-center justify-between rounded-md border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
- <p className="text-xs text-mineshaft-400">
- Expires: {raCertExpiresAtLabel ?? "Unknown"}
- </p>
- <IconButton
- aria-label="download RA certificate"
- variant="outline"
- onClick={() =>
- downloadFile(
- initial.raCertificatePem,
- `${profileSlug}-ra-cert.pem`,
- "application/x-pem-file"
- )
- }
- className="flex w-auto items-center gap-2 px-3"
- >
- <FontAwesomeIcon icon={faDownload} />
- <span className="text-sm">Download PEM</span>
- </IconButton>
- </div>
+ </SectionCard>
+ ) : null}
+ {enabled && initial?.raCertificatePem ? (
+ <SectionCard
+ title="RA certificate"
+ actions={
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={() =>
+ downloadFile(
+ initial.raCertificatePem,
+ `${profileSlug}-ra-cert.pem`,
+ "application/x-pem-file"
+ )
+ }
+ >
+ <FontAwesomeIcon icon={faDownload} />
+ Download PEM
+ </Button>
+ }
+ >
+ <div className="flex items-center gap-3">
+ <div className="flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-foreground/[0.04] text-accent">
+ <FileTextIcon />
</div>
- ) : null}
- </div>
+ <div className="flex flex-col">
+ <span className="font-mono text-sm text-foreground">{profileSlug}-ra-cert.pem</span>
+ <span className="text-xs text-accent">
+ Expires {raCertExpiresAtLabel ?? "Unknown"}
+ </span>
+ </div>
+ </div>
+ </SectionCard>
) : null}
- <Controller
- control={control}
- name="challengeType"
- render={({ field }) => (
- <Field>
- <FieldLabel>Challenge type</FieldLabel>
- <FieldContent>
- <Select value={field.value} onValueChange={field.onChange}>
- <SelectTrigger className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="static">Static password</SelectItem>
- <SelectItem value="dynamic">Dynamic (per-client)</SelectItem>
- </SelectContent>
- </Select>
- </FieldContent>
- </Field>
- )}
- />
- {challengeType === "static" && (
+ <SectionCard title="Challenge">
<Controller
control={control}
- name="challengePassword"
- rules={{ required: !enabled }}
- render={({ field, fieldState: { error } }) => (
+ name="challengeType"
+ render={({ field }) => (
<Field>
- <FieldLabel>
- {enabled
- ? "New challenge password (leave blank to keep current)"
- : "Challenge password"}
- </FieldLabel>
+ <FieldLabel>Challenge type</FieldLabel>
<FieldContent>
- <Input type="password" {...field} placeholder="••••••••" isError={Boolean(error)} />
+ <Select value={field.value} onValueChange={field.onChange}>
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="static">Static password</SelectItem>
+ <SelectItem value="dynamic">Dynamic (per-client)</SelectItem>
+ </SelectContent>
+ </Select>
</FieldContent>
- {error ? <FieldError>Required</FieldError> : null}
+ <FieldDescription>
+ {field.value === "static"
+ ? "All clients present the same shared challenge password."
+ : "Each client requests a fresh, one-time challenge before enrolling."}
+ </FieldDescription>
</Field>
)}
/>
- )}
- {challengeType === "dynamic" && (
- <div className="grid grid-cols-2 gap-4">
+ {challengeType === "static" && (
<Controller
control={control}
- name="dynamicChallengeExpiryMinutes"
- render={({ field }) => (
+ name="challengePassword"
+ rules={{ required: !enabled }}
+ render={({ field, fieldState: { error } }) => (
<Field>
- <FieldLabel>Challenge expiry (minutes)</FieldLabel>
+ <FieldLabel>{enabled ? "New challenge password" : "Challenge password"}</FieldLabel>
<FieldContent>
<Input
- type="number"
- min={5}
- max={1440}
- value={field.value ?? ""}
- onChange={(e) =>
- field.onChange(e.target.value === "" ? undefined : Number(e.target.value))
- }
+ type="password"
+ {...field}
+ placeholder="••••••••"
+ isError={Boolean(error)}
/>
</FieldContent>
+ <FieldDescription>
+ {enabled
+ ? "Leave blank to keep the current challenge password."
+ : "Shared password presented by every SCEP client during enrollment."}
+ </FieldDescription>
+ {error ? <FieldError>Required</FieldError> : null}
</Field>
)}
/>
- <Controller
- control={control}
- name="dynamicChallengeMaxPending"
- render={({ field }) => (
- <Field>
- <FieldLabel>Max pending challenges</FieldLabel>
- <FieldContent>
- <Input
- type="number"
- min={1}
- max={1000}
- value={field.value ?? ""}
- onChange={(e) =>
- field.onChange(e.target.value === "" ? undefined : Number(e.target.value))
- }
- />
- </FieldContent>
- </Field>
- )}
- />
- </div>
- )}
- <Controller
- control={control}
- name="includeCaCertInResponse"
- render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Include CA cert in response</FieldLabel>
- <p className="text-xs text-mineshaft-400">
- Return the issuing CA certificate inline alongside the issued cert.
- </p>
- </div>
- <Switch id="scep-include-ca" checked={field.value} onCheckedChange={field.onChange} />
- </div>
)}
- />
- <Controller
- control={control}
- name="allowCertBasedRenewal"
- render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Allow cert-based renewal</FieldLabel>
- <p className="text-xs text-mineshaft-400">
- Let clients renew using their existing certificate as authentication.
- </p>
- </div>
- <Switch id="scep-cert-renewal" checked={field.value} onCheckedChange={field.onChange} />
+ {challengeType === "dynamic" && (
+ <div className="grid grid-cols-2 gap-4">
+ <Controller
+ control={control}
+ name="dynamicChallengeExpiryMinutes"
+ render={({ field }) => (
+ <Field>
+ <FieldLabel>Challenge expiry (minutes)</FieldLabel>
+ <FieldContent>
+ <Input
+ type="number"
+ min={5}
+ max={1440}
+ value={field.value ?? ""}
+ onChange={(e) =>
+ field.onChange(e.target.value === "" ? undefined : Number(e.target.value))
+ }
+ />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="dynamicChallengeMaxPending"
+ render={({ field }) => (
+ <Field>
+ <FieldLabel>Max pending challenges</FieldLabel>
+ <FieldContent>
+ <Input
+ type="number"
+ min={1}
+ max={1000}
+ value={field.value ?? ""}
+ onChange={(e) =>
+ field.onChange(e.target.value === "" ? undefined : Number(e.target.value))
+ }
+ />
+ </FieldContent>
+ </Field>
+ )}
+ />
</div>
)}
- />
+ </SectionCard>
+ <SectionCard title="Advanced options">
+ <Controller
+ control={control}
+ name="includeCaCertInResponse"
+ render={({ field }) => (
+ <div className="flex items-start justify-between gap-4">
+ <div>
+ <FieldLabel>Include CA cert in response</FieldLabel>
+ <p className="text-xs text-accent">
+ Return the issuing CA certificate inline alongside the issued cert.
+ </p>
+ </div>
+ <Switch id="scep-include-ca" checked={field.value} onCheckedChange={field.onChange} />
+ </div>
+ )}
+ />
+ <Controller
+ control={control}
+ name="allowCertBasedRenewal"
+ render={({ field }) => (
+ <div className="flex items-start justify-between gap-4">
+ <div>
+ <FieldLabel>Allow cert-based renewal</FieldLabel>
+ <p className="text-xs text-accent">
+ Let clients renew using their existing certificate as authentication.
+ </p>
+ </div>
+ <Switch
+ id="scep-cert-renewal"
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </div>
+ )}
+ />
+ </SectionCard>
<div className="flex justify-end gap-2 pt-2">
{enabled && (
<DisableEnrollmentButton
@@ -908,10 +1110,15 @@ export const ConfigureEnrollmentModal = ({
return (
<Dialog open={isOpen} onOpenChange={onOpenChange}>
- <DialogContent className="max-w-2xl overflow-visible">
+ <DialogContent className="max-h-[90vh] thin-scrollbar max-w-3xl overflow-y-auto">
<DialogHeader>
- <DialogTitle>
- Configure enrollment: <span className="font-mono">{profile?.profileSlug ?? ""}</span>
+ <DialogTitle className="flex items-center gap-2">
+ <span>Configure enrollment methods for</span>
+ {profile?.profileSlug ? (
+ <code className="rounded bg-primary/15 px-1.5 py-0.5 font-mono text-sm text-primary">
+ {profile.profileSlug}
+ </code>
+ ) : null}
</DialogTitle>
<DialogDescription>
Enable an enrollment method to allow clients to request certificates from this Profile
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
index b63d8b2598..eb642e1d2d 100644
--- a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
@@ -9,7 +9,9 @@ import {
Card,
CardAction,
CardContent,
+ CardDescription,
CardHeader,
+ CardTitle,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -161,9 +163,14 @@ export const ApplicationsPage = () => {
/>
<Card>
- <CardHeader>
+ <CardHeader className="gap-x-6">
+ <CardTitle>Applications</CardTitle>
+ <CardDescription>
+ Each Application represents a service or workload that issues and manages its own
+ certificates.
+ </CardDescription>
{canCreateApplication ? (
- <CardAction className="ml-auto">
+ <CardAction className="@xs:self-center">
<Button variant="project" onClick={() => handlePopUpOpen("application")}>
<PlusIcon />
Create Application
diff --git a/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx b/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx
index ba8fe648e0..2b39373e31 100644
--- a/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx
@@ -10,7 +10,7 @@ import { Button, ConfirmActionModal, ContentLoader, EmptyState } from "@app/comp
import { Badge } from "@app/components/v3";
import { useOrganization, useProject, useUser } from "@app/context";
import { usePopUp } from "@app/hooks";
-import { ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
+import { ApprovalPolicyScope, ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
import {
approvalRequestQuery,
ApprovalRequestStatus,
@@ -18,6 +18,7 @@ import {
CodeSigningRequestData,
useCancelApprovalRequest
} from "@app/hooks/api/approvalRequests";
+import { useGetPkiApplicationById } from "@app/hooks/api/pkiApplications";
import {
ApprovalStepsSection,
@@ -113,6 +114,10 @@ const PageContent = () => {
})
);
+ const requestApplicationId =
+ request?.scopeType === ApprovalPolicyScope.PkiApplication ? (request.scopeId ?? "") : "";
+ const { data: requestApplication } = useGetPkiApplicationById(requestApplicationId);
+
const handleRequestCancel = async () => {
if (cancelApprovalRequest.isPending || !request) return;
@@ -240,6 +245,23 @@ const PageContent = () => {
{reqData.certificateRequest?.commonName || reqData.profileName}
</span>{" "}
by {request.requesterName || "Unknown"}
+ {requestApplication && (
+ <>
+ {" "}
+ on application{" "}
+ <Link
+ to="/organizations/$orgId/projects/cert-manager/$projectId/applications/$applicationName"
+ params={{
+ orgId: currentOrg.id,
+ projectId: currentProject.id,
+ applicationName: requestApplication.name
+ }}
+ className="font-medium text-mineshaft-200 underline hover:text-mineshaft-100"
+ >
+ {requestApplication.name}
+ </Link>
+ </>
+ )}
</p>
</>
);
@@ -276,7 +298,7 @@ const PageContent = () => {
className={linkClass}
>
<FontAwesomeIcon icon={faChevronLeft} />
- {applicationName}
+ Go back to Application
</Link>
);
}
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningGrantsTab/CodeSigningGrantsTab.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningGrantsTab/CodeSigningGrantsTab.tsx
index 65f712c411..24b41a530c 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningGrantsTab/CodeSigningGrantsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningGrantsTab/CodeSigningGrantsTab.tsx
@@ -376,7 +376,7 @@ export const CodeSigningGrantsTab = () => {
</Table>
{!isGrantsLoading && !filteredGrants.length && (
- <Empty className="border">
+ <Empty className="border border-solid">
<EmptyHeader>
<EmptyTitle>
{grants.length ? "No signing grants match search" : "No signing grants yet"}
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/components/CodeSigningPoliciesTable.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/components/CodeSigningPoliciesTable.tsx
index 5636d5ca47..7c5f39bb4b 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/components/CodeSigningPoliciesTable.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningPolicyTab/components/CodeSigningPoliciesTable.tsx
@@ -118,7 +118,7 @@ export const CodeSigningPoliciesTable = ({ handlePopUpOpen }: Props) => {
</TableBody>
</Table>
{!isPoliciesLoading && !sortedPolicies.length && (
- <Empty className="border">
+ <Empty className="border border-solid">
<EmptyHeader>
<EmptyTitle>No signing policies yet</EmptyTitle>
<EmptyDescription>
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
index d6ca5b5a7e..753c1f2826 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
@@ -90,7 +90,7 @@ export const CaTable = ({ handlePopUpOpen }: Props) => {
<TableHead>Status</TableHead>
<TableHead>Type</TableHead>
<TableHead>Valid Until</TableHead>
- <TableHead />
+ <TableHead className="w-5" />
</TableRow>
</TableHeader>
<TableBody>
@@ -134,10 +134,10 @@ export const CaTable = ({ handlePopUpOpen }: Props) => {
</p>
</div>
</TableCell>
- <TableCell className="flex justify-end">
+ <TableCell className="text-right" onClick={(e) => e.stopPropagation()}>
<DropdownMenu>
<DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
+ <div className="inline-flex hover:text-primary-400 data-[state=open]:text-primary-400">
<Tooltip content="More options">
<FontAwesomeIcon size="lg" icon={faEllipsis} />
</Tooltip>
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx
index b1770cd890..23d1f2d0b7 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx
@@ -80,7 +80,7 @@ export const ExternalCaTable = ({ handlePopUpOpen }: Props) => {
<TableHead>Name</TableHead>
<TableHead>Type</TableHead>
<TableHead>Status</TableHead>
- <TableHead />
+ <TableHead className="w-5" />
</TableRow>
</TableHeader>
<TableBody>
@@ -112,10 +112,10 @@ export const ExternalCaTable = ({ handlePopUpOpen }: Props) => {
{caStatusToNameMap[ca.status]}
</Badge>
</TableCell>
- <TableCell className="flex justify-end">
+ <TableCell className="text-right" onClick={(e) => e.stopPropagation()}>
<DropdownMenu>
<DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
+ <div className="inline-flex hover:text-primary-400 data-[state=open]:text-primary-400">
<Tooltip content="More options">
<FontAwesomeIcon size="lg" icon={faEllipsis} />
</Tooltip>
diff --git a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx
index 8e685f0301..7550ada2da 100644
--- a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/CertificateDetailsByIDPage.tsx
@@ -68,6 +68,7 @@ const Page = () => {
const { fromApplication } = useSearch({ strict: false }) as { fromApplication?: string };
const { data: certificateData, isLoading } = useGetCertificateById(certificateId);
const certificate = certificateData?.certificate;
+ const isInventoryView = !fromApplication;
const projectId = currentProject?.id || "";
@@ -215,7 +216,7 @@ const Page = () => {
className="mb-4 flex w-fit items-center gap-x-1 text-sm text-mineshaft-400 transition duration-100 hover:text-mineshaft-400/80"
>
<ChevronLeftIcon size={16} />
- Application Certificates
+ Go back to Application
</Link>
) : (
<Link
@@ -269,7 +270,8 @@ const Page = () => {
)}
</ProjectPermissionCan>
{/* Enable/Manage auto renewal - conditional */}
- {certificate.profileId &&
+ {!isInventoryView &&
+ certificate.profileId &&
certificate.hasPrivateKey !== false &&
!certificate.renewedByCertificateId &&
!isRevoked &&
@@ -322,7 +324,8 @@ const Page = () => {
</ProjectPermissionCan>
)}
{/* Disable auto renewal - conditional */}
- {certificate.profileId &&
+ {!isInventoryView &&
+ certificate.profileId &&
certificate.hasPrivateKey !== false &&
!certificate.renewedByCertificateId &&
!isRevoked &&
@@ -350,7 +353,8 @@ const Page = () => {
</ProjectPermissionCan>
)}
{/* Renew Now - conditional */}
- {(certificate.profileId || certificate.caId) &&
+ {!isInventoryView &&
+ (certificate.profileId || certificate.caId) &&
certificate.hasPrivateKey !== false &&
!certificate.renewedByCertificateId &&
!isRevoked &&
@@ -381,7 +385,8 @@ const Page = () => {
</ProjectPermissionCan>
)}
{/* Manage PKI Syncs - conditional */}
- {certificate.status === CertStatus.ACTIVE &&
+ {!isInventoryView &&
+ certificate.status === CertStatus.ACTIVE &&
!certificate.renewedByCertificateId &&
certificate.source === CertSource.Issued && (
<ProjectPermissionCan
@@ -406,7 +411,8 @@ const Page = () => {
{/* Revoke Certificate - conditional */}
{supportsRevocation &&
!isRevoked &&
- certificate.source === CertSource.Issued && (
+ certificate.source === CertSource.Issued &&
+ !(isInventoryView && certificate.applicationId) && (
<ProjectPermissionCan
I={ProjectPermissionCertificateActions.Delete}
a={subject(ProjectPermissionSub.Certificates, {
@@ -431,27 +437,29 @@ const Page = () => {
)}
</ProjectPermissionCan>
)}
- {/* Delete Certificate - always available */}
- <ProjectPermissionCan
- I={ProjectPermissionCertificateActions.Delete}
- a={subject(ProjectPermissionSub.Certificates, {
- commonName: certificate.commonName,
- altNames: certificate.altNames?.split(",").map((s) => s.trim()),
- serialNumber: certificate.serialNumber,
- friendlyName: certificate.friendlyName,
- metadata: certificate.metadata
- })}
- >
- {(canDelete) => (
- <DropdownMenuItem
- variant="danger"
- isDisabled={!canDelete}
- onClick={() => handlePopUpOpen("deleteCertificate")}
- >
- Delete Certificate
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
+ {/* Delete Certificate - hidden in inventory when cert is app-bound */}
+ {!(isInventoryView && certificate.applicationId) && (
+ <ProjectPermissionCan
+ I={ProjectPermissionCertificateActions.Delete}
+ a={subject(ProjectPermissionSub.Certificates, {
+ commonName: certificate.commonName,
+ altNames: certificate.altNames?.split(",").map((s) => s.trim()),
+ serialNumber: certificate.serialNumber,
+ friendlyName: certificate.friendlyName,
+ metadata: certificate.metadata
+ })}
+ >
+ {(canDelete) => (
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!canDelete}
+ onClick={() => handlePopUpOpen("deleteCertificate")}
+ >
+ Delete Certificate
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ )}
</DropdownMenuContent>
</DropdownMenu>
</PageHeader>
@@ -485,6 +493,7 @@ const Page = () => {
<CertificateManagePkiSyncsModal
popUp={popUp.managePkiSyncs}
handlePopUpToggle={handlePopUpToggle}
+ applicationName={fromApplication}
/>
<DeleteActionModal
isOpen={popUp.deleteCertificate.isOpen}
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateManagePkiSyncsModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateManagePkiSyncsModal.tsx
index 9d928ec8df..1974dec278 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateManagePkiSyncsModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateManagePkiSyncsModal.tsx
@@ -38,11 +38,16 @@ type Props = {
};
};
handlePopUpToggle: (popUpName: "managePkiSyncs", state?: boolean) => void;
+ applicationName?: string;
};
const PER_PAGE = 10;
-export const CertificateManagePkiSyncsModal = ({ popUp, handlePopUpToggle }: Props) => {
+export const CertificateManagePkiSyncsModal = ({
+ popUp,
+ handlePopUpToggle,
+ applicationName
+}: Props) => {
const [selectedSyncIds, setSelectedSyncIds] = useState<Set<string>>(new Set());
const [initialSyncIds, setInitialSyncIds] = useState<Set<string>>(new Set());
const [isSubmitting, setIsSubmitting] = useState(false);
@@ -90,16 +95,28 @@ export const CertificateManagePkiSyncsModal = ({ popUp, handlePopUpToggle }: Pro
const handleNavigateToPkiSyncs = () => {
if (!currentProject?.id) return;
- navigate({
- to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,
- params: {
- orgId: currentOrg.id,
- projectId: currentProject.id
- },
- search: {
- selectedTab: IntegrationsListPageTabs.PkiSyncs
- }
- });
+ if (applicationName) {
+ navigate({
+ to: "/organizations/$orgId/projects/cert-manager/$projectId/applications/$applicationName",
+ params: {
+ orgId: currentOrg.id,
+ projectId: currentProject.id,
+ applicationName
+ },
+ search: { selectedTab: "syncs" }
+ });
+ } else {
+ navigate({
+ to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,
+ params: {
+ orgId: currentOrg.id,
+ projectId: currentProject.id
+ },
+ search: {
+ selectedTab: IntegrationsListPageTabs.PkiSyncs
+ }
+ });
+ }
handleClose();
};
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
index 6f72a7654b..63562f7ced 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
@@ -201,6 +201,7 @@ export const CertificatesSection = ({
<CertificateManagePkiSyncsModal
popUp={popUp.managePkiSyncs}
handlePopUpToggle={handlePopUpToggle}
+ applicationName={applicationName}
/>
<DeleteActionModal
isOpen={popUp.deleteCertificate.isOpen}
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
index 4efd0e4ee0..fd72bf9e7b 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
@@ -172,6 +172,7 @@ export const CertificatesTable = ({
applicationId,
applicationName
}: Props) => {
+ const isInventoryView = !applicationId;
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
const [search, setSearch] = useState(externalFilter?.search || "");
@@ -815,7 +816,8 @@ export const CertificatesTable = ({
certificate.renewBeforeDays && certificate.renewBeforeDays > 0
);
const canShowAutoRenewalIcon = Boolean(
- certificate.profileId &&
+ !isInventoryView &&
+ certificate.profileId &&
certificate.hasPrivateKey !== false &&
!certificate.renewedByCertificateId &&
!isRevoked &&
@@ -1065,6 +1067,7 @@ export const CertificatesTable = ({
</ProjectPermissionCan>
{(() => {
const canManageRenewal =
+ !isInventoryView &&
certificate.profileId &&
certificate.hasPrivateKey !== false &&
!certificate.renewedByCertificateId &&
@@ -1130,6 +1133,7 @@ export const CertificatesTable = ({
})()}
{(() => {
const canDisableRenewal =
+ !isInventoryView &&
certificate.profileId &&
certificate.hasPrivateKey !== false &&
!certificate.renewedByCertificateId &&
@@ -1173,6 +1177,7 @@ export const CertificatesTable = ({
})()}
{(() => {
const canRenew =
+ !isInventoryView &&
(certificate.profileId || certificate.caId) &&
certificate.hasPrivateKey !== false &&
!certificate.renewedByCertificateId &&
@@ -1212,7 +1217,8 @@ export const CertificatesTable = ({
</ProjectPermissionCan>
);
})()}
- {certificate.status === CertStatus.ACTIVE &&
+ {!isInventoryView &&
+ certificate.status === CertStatus.ACTIVE &&
!certificate.renewedByCertificateId &&
certificate.source !== CertSource.Discovered && (
<ProjectPermissionCan
@@ -1258,7 +1264,8 @@ export const CertificatesTable = ({
if (
!supportsRevocation ||
isRevoked ||
- certificate.source === CertSource.Discovered
+ certificate.source === CertSource.Discovered ||
+ (isInventoryView && certificate.applicationId)
) {
return null;
}
@@ -1294,33 +1301,35 @@ export const CertificatesTable = ({
</ProjectPermissionCan>
);
})()}
- <ProjectPermissionCan
- I={ProjectPermissionCertificateActions.Delete}
- a={subject(ProjectPermissionSub.Certificates, {
- commonName: certificate.commonName,
- altNames: certificate.altNames?.split(",").map((s) => s.trim()),
- serialNumber: certificate.serialNumber,
- friendlyName: certificate.friendlyName,
- metadata: certificate.metadata
- })}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- variant="danger"
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteCertificate", {
- certificateId: certificate.id,
- commonName: certificate.commonName
- });
- }}
- >
- <Trash2Icon />
- Delete Certificate
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
+ {!(isInventoryView && certificate.applicationId) && (
+ <ProjectPermissionCan
+ I={ProjectPermissionCertificateActions.Delete}
+ a={subject(ProjectPermissionSub.Certificates, {
+ commonName: certificate.commonName,
+ altNames: certificate.altNames?.split(",").map((s) => s.trim()),
+ serialNumber: certificate.serialNumber,
+ friendlyName: certificate.friendlyName,
+ metadata: certificate.metadata
+ })}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!isAllowed}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deleteCertificate", {
+ certificateId: certificate.id,
+ commonName: certificate.commonName
+ });
+ }}
+ >
+ <Trash2Icon />
+ Delete Certificate
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ )}
</DropdownMenuContent>
</DropdownMenu>
</div>
diff --git a/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx b/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
index 5712fc46e9..c085cb8a19 100644
--- a/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
+++ b/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
@@ -29,6 +29,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
Empty,
+ EmptyDescription,
EmptyHeader,
EmptyTitle,
IconButton,
@@ -280,9 +281,10 @@ export const SignersTable = ({ projectId, onCreateSigner }: Props) => {
</TableBody>
</Table>
{!isLoading && signers.length === 0 && (
- <Empty>
+ <Empty className="border border-solid">
<EmptyHeader>
- <EmptyTitle>No signers found</EmptyTitle>
+ <EmptyTitle>No signers yet</EmptyTitle>
+ <EmptyDescription>Create a signer to start signing artifacts</EmptyDescription>
</EmptyHeader>
</Empty>
)}
diff --git a/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/InstallationDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/InstallationDetailsByIDPage.tsx
index 3c5a59f843..f45e8cf798 100644
--- a/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/InstallationDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/InstallationDetailsByIDPage.tsx
@@ -56,7 +56,8 @@ const Page = () => {
handlePopUpClose("deleteInstallation");
navigate({
to: "/organizations/$orgId/projects/cert-manager/$projectId/discovery",
- params: { orgId, projectId }
+ params: { orgId, projectId },
+ search: { selectedTab: "installations" }
});
} catch {
// Error handled by mutation
@@ -76,6 +77,7 @@ const Page = () => {
<Link
to="/organizations/$orgId/projects/cert-manager/$projectId/discovery"
params={{ orgId: currentOrg.id, projectId: currentProject.id }}
+ search={{ selectedTab: "installations" }}
className="mb-4 flex w-fit items-center gap-x-1 text-sm text-mineshaft-400 transition duration-100 hover:text-mineshaft-400/80"
>
<ChevronLeftIcon size={16} />
diff --git a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx
index a966839e3a..078d84a24e 100644
--- a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx
+++ b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx
@@ -40,6 +40,11 @@ import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionPkiSyncActions } from "@app/context/ProjectPermissionContext/types";
import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";
import { useToggle } from "@app/hooks";
+import {
+ PkiApplicationResourceActions,
+ PkiApplicationResourceSub,
+ useGetPkiApplicationPermissions
+} from "@app/hooks/api/pkiApplications";
import { PkiSyncStatus, TPkiSync, usePkiSyncOption } from "@app/hooks/api/pkiSyncs";
import { PkiSyncDestinationCol } from "./PkiSyncDestinationCol";
@@ -84,6 +89,14 @@ export const PkiSyncRow = ({
const { currentOrg } = useOrganization();
const [isIdCopied, setIsIdCopied] = useToggle(false);
+ const { data: appPermissionData } = useGetPkiApplicationPermissions(applicationId ?? "");
+ const canDeleteAppSync = Boolean(
+ appPermissionData?.permission?.can(
+ PkiApplicationResourceActions.Delete,
+ PkiApplicationResourceSub.PkiSyncs
+ )
+ );
+
const handleCopyId = useCallback(() => {
setIsIdCopied.on();
navigator.clipboard.writeText(id);
@@ -180,7 +193,7 @@ export const PkiSyncRow = ({
<PkiSyncDestinationCol pkiSync={pkiSync} />
<TableCell>
<div className="flex items-center gap-1">
- {syncStatus && (
+ {syncStatus ? (
<Tooltip
position="left"
className="max-w-sm"
@@ -225,6 +238,13 @@ export const PkiSyncRow = ({
<PkiSyncStatusBadge status={syncStatus} />
</div>
</Tooltip>
+ ) : (
+ <Tooltip
+ className="text-xs"
+ content="This sync has not run yet — no certificates have been pushed to the destination."
+ >
+ <Badge variant="neutral">Not Synced</Badge>
+ </Tooltip>
)}
{!isAutoSyncEnabled && (
<Tooltip
@@ -233,7 +253,7 @@ export const PkiSyncRow = ({
>
<Badge variant="neutral">
<BanIcon />
- {!syncStatus && "Auto-Sync Disabled"}
+ Auto-Sync Disabled
</Badge>
</Tooltip>
)}
@@ -371,13 +391,9 @@ export const PkiSyncRow = ({
</DropdownMenuItem>
)}
</ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPkiSyncActions.Delete}
- a={permissionSubject}
- >
- {(allowed: boolean) => (
+ {applicationId ? (
+ canDeleteAppSync && (
<DropdownMenuItem
- isDisabled={!allowed}
icon={<FontAwesomeIcon icon={faTrash} />}
onClick={(e) => {
e.stopPropagation();
@@ -386,8 +402,26 @@ export const PkiSyncRow = ({
>
Delete Sync
</DropdownMenuItem>
- )}
- </ProjectPermissionCan>
+ )
+ ) : (
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSyncActions.Delete}
+ a={permissionSubject}
+ >
+ {(allowed: boolean) => (
+ <DropdownMenuItem
+ isDisabled={!allowed}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ onClick={(e) => {
+ e.stopPropagation();
+ onDelete(pkiSync);
+ }}
+ >
+ Delete Sync
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ )}
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsx
index 997859dca8..d0c3a22e95 100644
--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsx
@@ -99,7 +99,7 @@ const PageContent = () => {
});
}}
>
- {applicationName || "PKI Syncs"}
+ {applicationName ? "Back to Application" : "PKI Syncs"}
</Button>
<div className="mb-6 flex w-full items-center gap-3">
<img
diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsx
index 931a0e796f..2a7a52cf8f 100644
--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsx
+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsx
@@ -40,6 +40,11 @@ import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionPkiSyncActions } from "@app/context/ProjectPermissionContext/types";
import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";
import { usePopUp, useToggle } from "@app/hooks";
+import {
+ PkiApplicationResourceActions,
+ PkiApplicationResourceSub,
+ useGetPkiApplicationPermissions
+} from "@app/hooks/api/pkiApplications";
import {
TPkiSync,
usePkiSyncOption,
@@ -53,9 +58,16 @@ type Props = {
};
export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {
- const { destination, projectId, id } = pkiSync;
+ const { destination, projectId, id, applicationId } = pkiSync;
const navigate = useNavigate();
+ const { data: appPermissionData } = useGetPkiApplicationPermissions(applicationId ?? "");
+ const canDeleteAppSync = Boolean(
+ appPermissionData?.permission?.can(
+ PkiApplicationResourceActions.Delete,
+ PkiApplicationResourceSub.PkiSyncs
+ )
+ );
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
"importCertificates",
"removeCertificates",
@@ -250,20 +262,31 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {
)}
</ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPkiSyncActions.Delete}
- a={permissionSubject}
- >
- {(isAllowed: boolean) => (
+ {applicationId ? (
+ canDeleteAppSync && (
<DropdownMenuItem
- isDisabled={!isAllowed}
icon={<FontAwesomeIcon icon={faTrash} />}
onClick={() => handlePopUpOpen("deleteSync")}
>
Delete Sync
</DropdownMenuItem>
- )}
- </ProjectPermissionCan>
+ )
+ ) : (
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSyncActions.Delete}
+ a={permissionSubject}
+ >
+ {(isAllowed: boolean) => (
+ <DropdownMenuItem
+ isDisabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ onClick={() => handlePopUpOpen("deleteSync")}
+ >
+ Delete Sync
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ )}
</DropdownMenuContent>
</DropdownMenu>
</div>
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/CertificateCleanupTab.tsx b/frontend/src/pages/cert-manager/SettingsPage/components/CertificateCleanupTab.tsx
index dee07df876..6637b27b7c 100644
--- a/frontend/src/pages/cert-manager/SettingsPage/components/CertificateCleanupTab.tsx
+++ b/frontend/src/pages/cert-manager/SettingsPage/components/CertificateCleanupTab.tsx
@@ -5,7 +5,19 @@ import { format } from "date-fns";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Badge, Button, Input, Skeleton, Switch } from "@app/components/v3";
+import {
+ Badge,
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Input,
+ Skeleton,
+ Switch
+} from "@app/components/v3";
import {
useGetCertificateCleanupConfig,
useUpdateCertificateCleanupConfig
@@ -69,89 +81,99 @@ export const CertificateCleanupTab = () => {
if (isLoading) {
return (
- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <Skeleton className="h-6 w-48" />
- <Skeleton className="mt-2 h-4 w-80" />
- <div className="mt-6 flex flex-col gap-4">
- <Skeleton className="h-10 w-full" />
- <Skeleton className="h-10 w-full" />
- <Skeleton className="h-10 w-full" />
- </div>
- </div>
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ <Skeleton className="h-5 w-48" />
+ </CardTitle>
+ <CardDescription>
+ <Skeleton className="h-4 w-80" />
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <div className="flex flex-col gap-3">
+ <Skeleton className="h-10 w-full" />
+ <Skeleton className="h-10 w-full" />
+ <Skeleton className="h-10 w-full" />
+ </div>
+ </CardContent>
+ </Card>
);
}
return (
<form onSubmit={handleSubmit(onSubmit)}>
- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <div className="flex items-start justify-between">
- <div>
- <h2 className="text-xl font-medium text-mineshaft-100">Certificate Cleanup</h2>
- <p className="mt-1 text-sm text-gray-400">Automatically remove expired certificates</p>
- </div>
- <Controller
- control={control}
- name="isEnabled"
- render={({ field: { value, onChange } }) => (
- <Switch variant="project" checked={value} onCheckedChange={onChange} />
- )}
- />
- </div>
-
- {config?.lastRunAt && (
- <div className="mt-6 rounded-md border border-mineshaft-600 bg-mineshaft-800 px-4 py-3">
- <p className="mb-2 text-xs font-medium tracking-wide text-gray-400 uppercase">
- Last Execution
- </p>
- <div className="flex items-center gap-6">
- <div className="flex items-center gap-2">
- <span className="text-xs text-gray-400">Status:</span>
- <Badge variant={config.lastRunStatus === "success" ? "success" : "danger"}>
- {config.lastRunStatus === "success" ? "Success" : "Error"}
- </Badge>
- </div>
- <div className="flex items-center gap-2">
- <span className="text-xs text-gray-400">Last Run:</span>
- <span className="text-xs font-medium text-mineshaft-100">
- {format(new Date(config.lastRunAt), "yyyy-MM-dd, hh:mm a")}
- </span>
- </div>
- <div className="flex items-center gap-2">
- <span className="text-xs text-gray-400">Certificates Removed:</span>
- <span className="text-xs font-medium text-mineshaft-100">
- {config.lastRunCertsDeleted}
- </span>
- </div>
- </div>
- </div>
- )}
-
- <div className="mt-6 flex flex-col gap-5">
- <div className="flex items-center gap-2">
- <span className="text-sm text-mineshaft-100">Delete certificates</span>
+ <Card>
+ <CardHeader>
+ <CardTitle>Certificate Cleanup</CardTitle>
+ <CardDescription>
+ Automatically remove certificates that have been expired beyond a configurable retention
+ window.
+ </CardDescription>
+ <CardAction className="@xs:self-center">
<Controller
control={control}
- name="postExpiryRetentionDays"
- render={({ field }) => (
- <Input
- {...field}
- type="number"
- className="w-20"
- min={1}
- max={30}
- disabled={!isEnabled}
- />
+ name="isEnabled"
+ render={({ field: { value, onChange } }) => (
+ <Switch variant="project" checked={value} onCheckedChange={onChange} />
)}
/>
- <span className="text-sm text-gray-400">days after expiration</span>
- </div>
+ </CardAction>
+ </CardHeader>
+ <CardContent>
+ {config?.lastRunAt && (
+ <div className="mb-6 rounded-md border border-border bg-foreground/[0.03] px-4 py-3">
+ <p className="mb-2 text-xs font-medium tracking-wide text-accent uppercase">
+ Last Execution
+ </p>
+ <div className="flex flex-wrap items-center gap-x-6 gap-y-2">
+ <div className="flex items-center gap-2">
+ <span className="text-xs text-accent">Status:</span>
+ <Badge variant={config.lastRunStatus === "success" ? "success" : "danger"}>
+ {config.lastRunStatus === "success" ? "Success" : "Error"}
+ </Badge>
+ </div>
+ <div className="flex items-center gap-2">
+ <span className="text-xs text-accent">Last Run:</span>
+ <span className="text-xs font-medium text-foreground">
+ {format(new Date(config.lastRunAt), "yyyy-MM-dd, hh:mm a")}
+ </span>
+ </div>
+ <div className="flex items-center gap-2">
+ <span className="text-xs text-accent">Certificates Removed:</span>
+ <span className="text-xs font-medium text-foreground">
+ {config.lastRunCertsDeleted}
+ </span>
+ </div>
+ </div>
+ </div>
+ )}
+
+ <div className="flex flex-col gap-5">
+ <div className="flex items-center gap-2">
+ <span className="text-sm text-foreground">Delete certificates</span>
+ <Controller
+ control={control}
+ name="postExpiryRetentionDays"
+ render={({ field }) => (
+ <Input
+ {...field}
+ type="number"
+ className="w-20"
+ min={1}
+ max={30}
+ disabled={!isEnabled}
+ />
+ )}
+ />
+ <span className="text-sm text-accent">days after expiration</span>
+ </div>
- <div className="flex flex-col divide-y divide-mineshaft-600">
<Controller
control={control}
name="skipCertsWithActiveSyncs"
render={({ field: { value, onChange } }) => (
- <div className="flex items-center gap-4 py-4">
+ <div className="flex items-center gap-4 border-t border-border py-4">
<Switch
variant="project"
checked={isEnabled && value}
@@ -159,25 +181,27 @@ export const CertificateCleanupTab = () => {
disabled={!isEnabled}
/>
<div>
- <p className="text-sm font-medium text-mineshaft-100">
+ <p className="text-sm font-medium text-foreground">
Skip Certificates with Active Syncs
</p>
- <p className="mt-0.5 text-xs text-gray-400">
+ <p className="mt-0.5 text-xs text-accent">
Do not remove certificates that are synced to external services
</p>
</div>
</div>
)}
/>
- </div>
- {isDirty && (
- <Button type="submit" variant="project" isPending={isSubmitting}>
- Save
- </Button>
- )}
- </div>
- </div>
+ {isDirty && (
+ <div>
+ <Button type="submit" variant="project" isPending={isSubmitting}>
+ Save
+ </Button>
+ </div>
+ )}
+ </div>
+ </CardContent>
+ </Card>
</form>
);
};
diff --git a/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx b/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx
index ebead1db9a..cf35152ba7 100644
--- a/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx
+++ b/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx
@@ -125,7 +125,7 @@ export const SignerOverviewSection = ({ signer, projectId, onEdit }: Props) => {
orgId: currentOrg.id,
projectId
}}
- search={{ tab: "approvals", subtab: "policies" }}
+ search={{ selectedTab: "signing-policies" }}
className="flex items-center gap-1 text-primary hover:underline"
>
{signer.approvalPolicyName}
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
index ae81e857cf..21cfdc7269 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
@@ -305,7 +305,7 @@ export const IdentityTab = withProjectPermission(
{debouncedSearch.trim().length > 0 || isTableFiltered
? "No machine identities match search"
: isCertManager
- ? "No machine identities have been added to this Certificate Manager"
+ ? "No machine identities have been added"
: "No machine identities have been added to this project"}
</EmptyTitle>
<EmptyDescription>
@@ -530,7 +530,7 @@ export const IdentityTab = withProjectPermission(
{identityProjectId ? (
<>
<ProjectIcon />
- Project
+ {productLabel}
</>
) : isSubOrganization && currentOrg.id === identityOrgId ? (
<>
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx
index 46c2508ee4..f8d0999783 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx
@@ -118,7 +118,7 @@ export const ProjectIdentityDetailsSection = ({
) : (
<Badge variant="project">
<ProjectIcon />
- Project
+ {isCertManager ? "Certificate Manager" : "Project"}
</Badge>
)}
</DetailValue>
diff --git a/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsx b/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsx
index c3e83f02dd..772063fe45 100644
--- a/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsx
+++ b/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsx
@@ -1,31 +1,14 @@
-import { useEffect, useState } from "react";
import { faKey } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { CertificateDisplayName } from "@app/components/utilities/certificateDisplayUtils";
-import {
- GenericFieldLabel,
- Modal,
- ModalContent,
- Pagination,
- Skeleton,
- Table,
- TableContainer,
- TBody,
- Td,
- Th,
- THead,
- Tooltip,
- Tr
-} from "@app/components/v2";
+import { GenericFieldLabel, Modal, ModalContent, Skeleton, Tooltip } from "@app/components/v2";
import { Badge } from "@app/components/v3";
import {
PkiAlertChannelTypeV2,
PkiAlertEventTypeV2,
TPkiAlertChannelConfigEmail,
TPkiAlertChannelConfigWebhookResponse,
- useGetPkiAlertV2ById,
- useGetPkiAlertV2MatchingCertificates
+ useGetPkiAlertV2ById
} from "@app/hooks/api/pkiAlertsV2";
import {
@@ -58,31 +41,11 @@ const SectionHeader = ({ title }: { title: string }) => (
);
export const ViewPkiAlertV2Modal = ({ isOpen, onOpenChange, alertId }: Props) => {
- const [certificatesPage, setCertificatesPage] = useState(1);
- const certificatesPerPage = 10;
-
const { data: alert, isLoading: isLoadingAlert } = useGetPkiAlertV2ById(
{ alertId: alertId || "" },
{ enabled: !!alertId && isOpen }
);
- const showMatchingCertificates =
- alert?.eventType && alert.eventType !== PkiAlertEventTypeV2.ISSUANCE;
-
- const { data: certificatesData, isLoading: isLoadingCertificates } =
- useGetPkiAlertV2MatchingCertificates(
- {
- alertId: alertId || "",
- limit: certificatesPerPage,
- offset: (certificatesPage - 1) * certificatesPerPage
- },
- { enabled: !!alertId && isOpen && !!showMatchingCertificates }
- );
-
- useEffect(() => {
- if (!isOpen) setCertificatesPage(1);
- }, [isOpen]);
-
if (isLoadingAlert) {
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
@@ -109,14 +72,14 @@ export const ViewPkiAlertV2Modal = ({ isOpen, onOpenChange, alertId }: Props) =>
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent
- title="Certificate Alert Details"
- className={showMatchingCertificates ? "max-w-5xl" : "max-w-3xl"}
- >
+ <ModalContent title="Certificate Alert Details" className="max-w-3xl">
<div className="space-y-6">
<div className="flex items-start justify-between gap-3">
<div className="min-w-0">
- <p className="truncate text-base font-semibold text-mineshaft-100">{alert.name}</p>
+ <p className="text-xs text-mineshaft-400">Alert Name</p>
+ <p className="mt-1 truncate text-base font-semibold text-mineshaft-100">
+ {alert.name}
+ </p>
{alert.description && (
<p className="mt-1 text-sm text-mineshaft-400">{alert.description}</p>
)}
@@ -146,31 +109,6 @@ export const ViewPkiAlertV2Modal = ({ isOpen, onOpenChange, alertId }: Props) =>
</div>
</div>
- <div className="space-y-3">
- <SectionHeader title="Filter Rules" />
- {(alert.filters || []).length === 0 ? (
- <p className="text-sm text-mineshaft-400/70 italic">No filter rules configured.</p>
- ) : (
- <ul className="space-y-1.5">
- {(alert.filters || []).map((filter) => {
- const field = filter.field.replace(/_/g, " ");
- const operator = filter.operator.replace(/_/g, " ");
- const value = Array.isArray(filter.value)
- ? filter.value.join(", ")
- : String(filter.value);
- return (
- <li
- key={`filter-${filter.field}-${filter.operator}-${String(filter.value)}`}
- className="text-sm text-mineshaft-100 capitalize"
- >
- {field} {operator} {value}
- </li>
- );
- })}
- </ul>
- )}
- </div>
-
<div className="space-y-3">
<SectionHeader title="Notification Channels" />
{(alert.channels || []).length === 0 ? (
@@ -244,109 +182,6 @@ export const ViewPkiAlertV2Modal = ({ isOpen, onOpenChange, alertId }: Props) =>
</div>
)}
</div>
-
- {showMatchingCertificates && (
- <div className="space-y-3">
- <SectionHeader title="Matching Certificates" />
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th className="w-1/2">SAN / CN</Th>
- <Th className="w-1/6">Status</Th>
- <Th className="w-1/6">Not Before</Th>
- <Th className="w-1/6">Not After</Th>
- </Tr>
- </THead>
- <TBody>
- {(() => {
- if (isLoadingCertificates) {
- return Array.from({ length: 5 }, (_, index) => (
- <Tr key={`skeleton-row-${index}`}>
- <Td>
- <Skeleton className="h-4 w-32" />
- </Td>
- <Td>
- <Skeleton className="h-4 w-16" />
- </Td>
- <Td>
- <Skeleton className="h-4 w-24" />
- </Td>
- <Td>
- <Skeleton className="h-4 w-24" />
- </Td>
- </Tr>
- ));
- }
- if (certificatesData?.certificates?.length) {
- return certificatesData.certificates.map((cert) => {
- const now = new Date();
- const isExpired = new Date(cert.notAfter) < now;
- // eslint-disable-next-line no-nested-ternary
- const statusVariant = isExpired
- ? "danger"
- : cert.status === "active"
- ? "success"
- : "neutral";
- const statusLabel = isExpired ? "Expired" : cert.status;
- return (
- <Tr key={cert.id} className="group h-10">
- <Td className="max-w-0">
- <div className="flex items-center gap-2">
- <CertificateDisplayName
- cert={{
- altNames: cert.san?.join(", ") || null,
- commonName: cert.commonName
- }}
- maxLength={48}
- fallback="—"
- />
- {cert.enrollmentType === "ca" && <Badge variant="info">CA</Badge>}
- </div>
- </Td>
- <Td>
- <Badge variant={statusVariant} className="capitalize">
- {statusLabel}
- </Badge>
- </Td>
- <Td>
- {cert.notBefore
- ? new Date(cert.notBefore).toLocaleDateString("en-CA")
- : "-"}
- </Td>
- <Td>
- {cert.notAfter
- ? new Date(cert.notAfter).toLocaleDateString("en-CA")
- : "-"}
- </Td>
- </Tr>
- );
- });
- }
- return (
- <Tr>
- <Td colSpan={4} className="py-6 text-center text-sm text-mineshaft-400">
- No certificates currently match this alert&apos;s criteria.
- </Td>
- </Tr>
- );
- })()}
- </TBody>
- </Table>
- </TableContainer>
- {(certificatesData?.total || 0) > certificatesPerPage && (
- <div className="flex justify-center">
- <Pagination
- count={certificatesData?.total || 0}
- page={certificatesPage}
- onChangePage={setCertificatesPage}
- perPage={certificatesPerPage}
- onChangePerPage={() => {}}
- />
- </div>
- )}
- </div>
- )}
</div>
</ModalContent>
</Modal>