Skip to content

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

Add frontend audit log ui for pki alerting / collection

Tuan Dange1b9965f0197
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index e2968ef357..41186756a1 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -148,7 +148,6 @@ export enum EventType {
GET_PKI_ALERT = "get-pki-alert",
UPDATE_PKI_ALERT = "update-pki-alert",
DELETE_PKI_ALERT = "delete-pki-alert",
- // new
CREATE_PKI_COLLECTION = "create-pki-collection",
GET_PKI_COLLECTION = "get-pki-collection",
UPDATE_PKI_COLLECTION = "update-pki-collection",
@@ -156,7 +155,6 @@ export enum EventType {
GET_PKI_COLLECTION_ITEMS = "get-pki-collection-items",
ADD_PKI_COLLECTION_ITEM = "add-pki-collection-item",
DELETE_PKI_COLLECTION_ITEM = "delete-pki-collection-item",
- // end
CREATE_KMS = "create-kms",
UPDATE_KMS = "update-kms",
DELETE_KMS = "delete-kms",
diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx
index 819c36c200..8aadda2d8f 100644
--- a/frontend/src/hooks/api/auditLogs/constants.tsx
+++ b/frontend/src/hooks/api/auditLogs/constants.tsx
@@ -57,6 +57,17 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.DELETE_CERT]: "Delete certificate",
[EventType.REVOKE_CERT]: "Revoke certificate",
[EventType.GET_CERT_BODY]: "Get certificate body",
+ [EventType.CREATE_PKI_ALERT]: "Create PKI alert",
+ [EventType.GET_PKI_ALERT]: "Get PKI alert",
+ [EventType.UPDATE_PKI_ALERT]: "Update PKI alert",
+ [EventType.DELETE_PKI_ALERT]: "Delete PKI alert",
+ [EventType.CREATE_PKI_COLLECTION]: "Create PKI collection",
+ [EventType.GET_PKI_COLLECTION]: "Get PKI collection",
+ [EventType.UPDATE_PKI_COLLECTION]: "Update PKI collection",
+ [EventType.DELETE_PKI_COLLECTION]: "Delete PKI collection",
+ [EventType.GET_PKI_COLLECTION_ITEMS]: "Get PKI collection items",
+ [EventType.ADD_PKI_COLLECTION_ITEM]: "Add PKI collection item",
+ [EventType.DELETE_PKI_COLLECTION_ITEM]: "Delete PKI collection item",
[EventType.ORG_ADMIN_ACCESS_PROJECT]: "Org admin accessed project"
};
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index 94963f640e..a6a2ada93a 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -71,5 +71,16 @@ export enum EventType {
DELETE_CERT = "delete-cert",
REVOKE_CERT = "revoke-cert",
GET_CERT_BODY = "get-cert-body",
+ CREATE_PKI_ALERT = "create-pki-alert",
+ GET_PKI_ALERT = "get-pki-alert",
+ UPDATE_PKI_ALERT = "update-pki-alert",
+ DELETE_PKI_ALERT = "delete-pki-alert",
+ CREATE_PKI_COLLECTION = "create-pki-collection",
+ GET_PKI_COLLECTION = "get-pki-collection",
+ UPDATE_PKI_COLLECTION = "update-pki-collection",
+ DELETE_PKI_COLLECTION = "delete-pki-collection",
+ GET_PKI_COLLECTION_ITEMS = "get-pki-collection-items",
+ ADD_PKI_COLLECTION_ITEM = "add-pki-collection-item",
+ DELETE_PKI_COLLECTION_ITEM = "delete-pki-collection-item",
ORG_ADMIN_ACCESS_PROJECT = "org-admin-accessed-project"
}
diff --git a/frontend/src/hooks/api/auditLogs/types.tsx b/frontend/src/hooks/api/auditLogs/types.tsx
index 1d80d6128b..0a34186f6a 100644
--- a/frontend/src/hooks/api/auditLogs/types.tsx
+++ b/frontend/src/hooks/api/auditLogs/types.tsx
@@ -1,5 +1,6 @@
import { CaStatus } from "../ca";
import { IdentityTrustedIp } from "../identities/types";
+import { PkiItemType } from "../pkiCollections/constants";
import { ActorType, EventType, UserAgentType } from "./enums";
interface UserActorMetadata {
@@ -579,6 +580,95 @@ interface GetCertBody {
};
}
+interface CreatePkiAlert {
+ type: EventType.CREATE_PKI_ALERT;
+ metadata: {
+ pkiAlertId: string;
+ pkiCollectionId: string;
+ name: string;
+ alertBeforeDays: number;
+ recipientEmails: string;
+ };
+}
+interface GetPkiAlert {
+ type: EventType.GET_PKI_ALERT;
+ metadata: {
+ pkiAlertId: string;
+ };
+}
+
+interface UpdatePkiAlert {
+ type: EventType.UPDATE_PKI_ALERT;
+ metadata: {
+ pkiAlertId: string;
+ pkiCollectionId?: string;
+ name?: string;
+ alertBeforeDays?: number;
+ recipientEmails?: string;
+ };
+}
+interface DeletePkiAlert {
+ type: EventType.DELETE_PKI_ALERT;
+ metadata: {
+ pkiAlertId: string;
+ };
+}
+
+interface CreatePkiCollection {
+ type: EventType.CREATE_PKI_COLLECTION;
+ metadata: {
+ pkiCollectionId: string;
+ name: string;
+ };
+}
+
+interface GetPkiCollection {
+ type: EventType.GET_PKI_COLLECTION;
+ metadata: {
+ pkiCollectionId: string;
+ };
+}
+
+interface UpdatePkiCollection {
+ type: EventType.UPDATE_PKI_COLLECTION;
+ metadata: {
+ pkiCollectionId: string;
+ name?: string;
+ };
+}
+
+interface DeletePkiCollection {
+ type: EventType.DELETE_PKI_COLLECTION;
+ metadata: {
+ pkiCollectionId: string;
+ };
+}
+
+interface GetPkiCollectionItems {
+ type: EventType.GET_PKI_COLLECTION_ITEMS;
+ metadata: {
+ pkiCollectionId: string;
+ };
+}
+
+interface AddPkiCollectionItem {
+ type: EventType.ADD_PKI_COLLECTION_ITEM;
+ metadata: {
+ pkiCollectionItemId: string;
+ pkiCollectionId: string;
+ type: PkiItemType;
+ itemId: string;
+ };
+}
+
+interface DeletePkiCollectionItem {
+ type: EventType.DELETE_PKI_COLLECTION_ITEM;
+ metadata: {
+ pkiCollectionItemId: string;
+ pkiCollectionId: string;
+ };
+}
+
interface OrgAdminAccessProjectEvent {
type: EventType.ORG_ADMIN_ACCESS_PROJECT;
metadata: {
@@ -646,6 +736,17 @@ export type Event =
| DeleteCert
| RevokeCert
| GetCertBody
+ | CreatePkiAlert
+ | GetPkiAlert
+ | UpdatePkiAlert
+ | DeletePkiAlert
+ | CreatePkiCollection
+ | GetPkiCollection
+ | UpdatePkiCollection
+ | DeletePkiCollection
+ | GetPkiCollectionItems
+ | AddPkiCollectionItem
+ | DeletePkiCollectionItem
| OrgAdminAccessProjectEvent;
export type AuditLog = {
diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx b/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx
index 668b5e5c65..f5e54ab475 100644
--- a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx
+++ b/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx
@@ -323,6 +323,65 @@ export const LogsTableRow = ({ auditLog }: Props) => {
<p>{`Email: ${event.metadata.email}`}</p>
</Td>
);
+ case EventType.CREATE_PKI_ALERT:
+ case EventType.UPDATE_PKI_ALERT:
+ return (
+ <Td>
+ <p>{`Alert ID: ${event.metadata.pkiAlertId}`}</p>
+ <p>{`Name: ${event.metadata.name}`}</p>
+ <p>{`Alert Before Days: ${event.metadata.alertBeforeDays}`}</p>
+ </Td>
+ );
+ case EventType.GET_PKI_ALERT:
+ case EventType.DELETE_PKI_ALERT:
+ return (
+ <Td>
+ <p>{`Alert ID: ${event.metadata.pkiAlertId}`}</p>
+ </Td>
+ );
+ case EventType.CREATE_PKI_COLLECTION:
+ return (
+ <Td>
+ <p>{`Collection ID: ${event.metadata.pkiCollectionId}`}</p>
+ <p>{`Name: ${event.metadata.name}`}</p>
+ </Td>
+ );
+ case EventType.UPDATE_PKI_COLLECTION:
+ return (
+ <Td>
+ <p>{`Collection ID: ${event.metadata.pkiCollectionId}`}</p>
+ <p>{`Name: ${event.metadata.name}`}</p>
+ </Td>
+ );
+ case EventType.GET_PKI_COLLECTION:
+ case EventType.DELETE_PKI_COLLECTION:
+ return (
+ <Td>
+ <p>{`Collection ID: ${event.metadata.pkiCollectionId}`}</p>
+ </Td>
+ );
+ case EventType.GET_PKI_COLLECTION_ITEMS:
+ return (
+ <Td>
+ <p>{`Collection ID: ${event.metadata.pkiCollectionId}`}</p>
+ </Td>
+ );
+ case EventType.ADD_PKI_COLLECTION_ITEM:
+ return (
+ <Td>
+ <p>{`Collection ID: ${event.metadata.pkiCollectionId}`}</p>
+ <p>{`Collection Item ID: ${event.metadata.pkiCollectionItemId}`}</p>
+ <p>{`Type: ${event.metadata.type}`}</p>
+ <p>{`Item ID: ${event.metadata.itemId}`}</p>
+ </Td>
+ );
+ case EventType.DELETE_PKI_COLLECTION_ITEM:
+ return (
+ <Td>
+ <p>{`Collection ID: ${event.metadata.pkiCollectionId}`}</p>
+ <p>{`Collection Item ID: ${event.metadata.pkiCollectionItemId}`}</p>
+ </Td>
+ );
case EventType.CREATE_CA:
case EventType.GET_CA:
case EventType.UPDATE_CA:
diff --git a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/ProjectRoleModifySection.utils.ts b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/ProjectRoleModifySection.utils.ts
index 7e27bde6bd..abab188b8f 100644
--- a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/ProjectRoleModifySection.utils.ts
+++ b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/ProjectRoleModifySection.utils.ts
@@ -51,6 +51,8 @@ export const formSchema = z.object({
"ip-allowlist": generalPermissionSchema,
"certificate-authorities": generalPermissionSchema,
certificates: generalPermissionSchema,
+ "pki-alerts": generalPermissionSchema,
+ "pki-collections": generalPermissionSchema,
// akhilmhdh: refactor all keys like below
[ProjectPermissionSub.SecretApproval]: generalPermissionSchema,
workspace: z
diff --git a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
index e56c3d44e3..40e4c260a8 100644
--- a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
+++ b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
@@ -81,6 +81,14 @@ const SINGLE_PERMISSION_LIST = [
title: "Certificates",
formName: "certificates"
},
+ {
+ title: "PKI Collections",
+ formName: "pki-collections"
+ },
+ {
+ title: "PKI Alerts",
+ formName: "pki-alerts"
+ },
{
title: "Secret Rollback",
formName: "secret-rollback"