Skip to content

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

More audit logs

Fang-Pen Lin8598b276f6f8
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 c961b60050..cd7d860fc0 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -50,6 +50,7 @@ import { WorkflowIntegration } from "@app/services/workflow-integration/workflow
import { KmipPermission } from "../kmip/kmip-enum";
import { ApprovalStatus } from "../secret-approval-request/secret-approval-request-types";
+import { AcmeIdentifierType } from "../pki-acme/pki-acme-schemas";
export type TListProjectAuditLogDTO = {
filter: {
@@ -79,7 +80,8 @@ export type TCreateAuditLogDTO = {
| PlatformActor
| UnknownUserActor
| KmipClientActor
- | AcmeProfileActor;
+ | AcmeProfileActor
+ | AcmeAccountActor;
orgId?: string;
projectId?: string;
} & BaseAuthData;
@@ -579,7 +581,8 @@ export enum EventType {
// PKI ACME
CREATE_ACME_ACCOUNT = "create-acme-account",
- RETRIEVE_ACME_ACCOUNT = "retrieve-acme-account"
+ RETRIEVE_ACME_ACCOUNT = "retrieve-acme-account",
+ CREATE_ACME_ORDER = "create-acme-order"
}
export const filterableSecretEvents: EventType[] = [
@@ -624,6 +627,11 @@ interface AcmeProfileActorMetadata {
profileId: string;
}
+interface AcmeAccountActorMetadata {
+ profileId: string;
+ accountId: string;
+}
+
interface UnknownUserActorMetadata {}
export interface UserActor {
@@ -666,6 +674,11 @@ export interface AcmeProfileActor {
metadata: AcmeProfileActorMetadata;
}
+export interface AcmeAccountActor {
+ type: ActorType.ACME_ACCOUNT;
+ metadata: AcmeAccountActorMetadata;
+}
+
export type Actor =
| UserActor
| ServiceActor
@@ -4406,6 +4419,17 @@ interface RetrieveAcmeAccountEvent {
};
}
+interface CreateAcmeOrderEvent {
+ type: EventType.CREATE_ACME_ORDER;
+ metadata: {
+ orderId: string;
+ identifiers: Array<{
+ type: AcmeIdentifierType;
+ value: string;
+ }>;
+ };
+}
+
export type Event =
| CreateSubOrganizationEvent
| UpdateSubOrganizationEvent
@@ -4808,4 +4832,5 @@ export type Event =
| ApprovalRequestGrantGetEvent
| ApprovalRequestGrantRevokeEvent
| CreateAcmeAccountEvent
- | RetrieveAcmeAccountEvent;
+ | RetrieveAcmeAccountEvent
+ | CreateAcmeOrderEvent;
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 353f5287fb..16ae5e7bf1 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts
@@ -685,7 +685,26 @@ export const pkiAcmeServiceFactory = ({
})),
tx
);
- // TODO: create audit log here
+ await auditLogService.createAuditLog({
+ projectId: account.profileId,
+ actor: {
+ type: ActorType.ACME_ACCOUNT,
+ metadata: {
+ profileId: account.profileId,
+ accountId: account.id
+ }
+ },
+ event: {
+ type: EventType.CREATE_ACME_ORDER,
+ metadata: {
+ orderId: createdOrder.id,
+ identifiers: authorizations.map((auth) => ({
+ type: auth.identifierType as AcmeIdentifierType,
+ value: auth.identifierValue
+ }))
+ }
+ }
+ });
return { ...createdOrder, authorizations, account };
});