Skip to content

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

More audit

Fang-Pen Lin4ed0f1d0a774
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 991198a1a5..f865c0cbef 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -49,7 +49,7 @@ import { TWebhookPayloads } from "@app/services/webhook/webhook-types";
import { WorkflowIntegration } from "@app/services/workflow-integration/workflow-integration-types";
import { KmipPermission } from "../kmip/kmip-enum";
-import { AcmeIdentifierType } from "../pki-acme/pki-acme-schemas";
+import { AcmeChallengeType, AcmeIdentifierType } from "../pki-acme/pki-acme-schemas";
import { ApprovalStatus } from "../secret-approval-request/secret-approval-request-types";
export type TListProjectAuditLogDTO = {
@@ -583,7 +583,9 @@ export enum EventType {
CREATE_ACME_ACCOUNT = "create-acme-account",
RETRIEVE_ACME_ACCOUNT = "retrieve-acme-account",
CREATE_ACME_ORDER = "create-acme-order",
- FINALIZE_ACME_ORDER = "finalize-acme-order"
+ FINALIZE_ACME_ORDER = "finalize-acme-order",
+ DOWNLOAD_ACME_CERTIFICATE = "download-acme-certificate",
+ RESPOND_TO_ACME_CHALLENGE = "respond-to-acme-challenge"
}
export const filterableSecretEvents: EventType[] = [
@@ -4439,6 +4441,20 @@ interface FinalizeAcmeOrderEvent {
};
}
+interface DownloadAcmeCertificateEvent {
+ type: EventType.DOWNLOAD_ACME_CERTIFICATE;
+ metadata: {
+ orderId: string;
+ };
+}
+
+interface RespondToAcmeChallengeEvent {
+ type: EventType.RESPOND_TO_ACME_CHALLENGE;
+ metadata: {
+ challengeId: string;
+ type: AcmeChallengeType;
+ };
+}
export type Event =
| CreateSubOrganizationEvent
| UpdateSubOrganizationEvent
@@ -4843,4 +4859,6 @@ export type Event =
| CreateAcmeAccountEvent
| RetrieveAcmeAccountEvent
| CreateAcmeOrderEvent
- | FinalizeAcmeOrderEvent;
+ | FinalizeAcmeOrderEvent
+ | DownloadAcmeCertificateEvent
+ | RespondToAcmeChallengeEvent;
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 b192ac46d7..0278236215 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts
@@ -1005,6 +1005,24 @@ export const pkiAcmeServiceFactory = ({
const certLeaf = certObj.toString("pem").trim().replace("\n", "\r\n");
const certChain = certificateChain.trim().replace("\n", "\r\n");
+
+ await auditLogService.createAuditLog({
+ projectId: profile.projectId,
+ actor: {
+ type: ActorType.ACME_ACCOUNT,
+ metadata: {
+ profileId,
+ accountId
+ }
+ },
+ event: {
+ type: EventType.DOWNLOAD_ACME_CERTIFICATE,
+ metadata: {
+ orderId
+ }
+ }
+ });
+
return {
status: 200,
body:
@@ -1087,6 +1105,7 @@ export const pkiAcmeServiceFactory = ({
authzId: string;
challengeId: string;
}): Promise<TAcmeResponse<TRespondToAcmeChallengeResponse>> => {
+ const profile = await validateAcmeProfile(profileId);
const result = await acmeChallengeDAL.findByAccountAuthAndChallengeId(accountId, authzId, challengeId);
if (!result) {
throw new NotFoundError({ message: "ACME challenge not found" });
@@ -1094,6 +1113,23 @@ export const pkiAcmeServiceFactory = ({
await acmeChallengeService.markChallengeAsReady(challengeId);
await pkiAcmeQueueService.queueChallengeValidation(challengeId);
const challenge = (await acmeChallengeDAL.findByIdForChallengeValidation(challengeId))!;
+ await auditLogService.createAuditLog({
+ projectId: profile.projectId,
+ actor: {
+ type: ActorType.ACME_ACCOUNT,
+ metadata: {
+ profileId,
+ accountId
+ }
+ },
+ event: {
+ type: EventType.RESPOND_TO_ACME_CHALLENGE,
+ metadata: {
+ challengeId,
+ type: challenge.type
+ }
+ }
+ });
return {
status: 200,
body: {