Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat(pki): signer names and acme finalize details
bernie-g10c2b8dd1e53
diff --git a/CLAUDE.md b/CLAUDE.mdindex 9169f80aa3..8cdbe744c4 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -68,7 +68,7 @@ Both `backend/` and `frontend/` enforce a minimum release age of 7 days for npm**Read [`backend/CODE_QUALITY.md`](backend/CODE_QUALITY.md) for every backend change, and check the change against it before calling the work done.** This applies to all work under `backend/`: new features, refactors, bug fixes, and reviews alike.-It is a floor, not an exhaustive standard: user-understandable error messages and no pointless 500s, explicit validation on every API input, correct pagination when calling third-party APIs, avoiding deadlock conditions on a small connection pool (thread `tx`, keep transactions short), REST-aligned API interfaces (flag deviations for the author to confirm rather than implementing them silently), and audit log events an admin can actually read (every id paired with a human-readable label).+It is a floor, not an exhaustive standard: user-understandable error messages and no pointless 500s, explicit validation on every API input, correct pagination when calling third-party APIs, avoiding deadlock conditions on a small connection pool (thread `tx`, keep transactions short), REST-aligned API interfaces (flag deviations for the author to confirm rather than implementing them silently), and audit log events an admin can actually read.That list describes what the guide currently covers; it is **not** a test for whether the guide applies. Do not skip it because a change does not look like one of those topics. Read it, then decide which items are relevant.diff --git a/backend/CODE_QUALITY.md b/backend/CODE_QUALITY.mdindex 7c2ab4ce8e..89ccb508ca 100644--- a/backend/CODE_QUALITY.md+++ b/backend/CODE_QUALITY.md@@ -269,21 +269,6 @@ customers are calling it.An audit log event is read by an admin investigating an incident, in a UI that renders the`metadata` body as raw JSON, or in their own SIEM.-**Every identifier in an event's `metadata` must be paired with a human-readable label,-resolved when the event is emitted.** An identifier is any field whose name ends in an-id-like token in any casing (`groupId`, `group_id`, `groupID`), or a lone `id`. An optional-id takes an equally optional label. Resolve the label by loading the parent record; adding-the field to the type and passing `undefined` does not count. This applies to the event body-only, not the surrounding envelope, which already carries the actor and org.--```ts-// Bad: nothing here tells the admin which certificate this was-metadata: { certificateId: cert.id, profileId: profile.id }--// Good-metadata: { certificateId: cert.id, commonName: cert.commonName, profileId: profile.id, profileName: profile.slug }-```-**Name the field after what it identifies.** `requestId` on an event that carries anapproval request's id sends the reader looking for a certificate request that does notmatch. Prefer `approvalRequestId`.diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 046309ed5d..867929ef61 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -4945,6 +4945,7 @@ interface UpdatePkiSignerApprovalPolicyEvent {type: EventType.UPDATE_PKI_SIGNER_APPROVAL_POLICY;metadata: {signerId: string;+ name: string;stepCount: number;};}@@ -4953,6 +4954,7 @@ interface PkiSignerRequestToSignEvent {type: EventType.PKI_SIGNER_REQUEST_TO_SIGN;metadata: {signerId: string;+ name: string;approvalRequestId?: string;};}@@ -4961,6 +4963,7 @@ interface PkiSignerPreApproveSigningEvent {type: EventType.PKI_SIGNER_PRE_APPROVE_SIGNING;metadata: {signerId: string;+ name: string;approvalRequestId?: string;granteeUserId?: string;granteeIdentityId?: string;@@ -4971,6 +4974,7 @@ interface PkiSignerRevokeRequestEvent {type: EventType.PKI_SIGNER_REVOKE_REQUEST;metadata: {signerId: string;+ name: string;approvalRequestId: string;};}@@ -6830,7 +6834,7 @@ interface FinalizeAcmeOrderEvent {type: EventType.FINALIZE_ACME_ORDER;metadata: {orderId: string;- csr: string;+ commonName: string;};}diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.tsindex 0e4f70e03d..8e4c4e50eb 100644--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts@@ -1515,6 +1515,7 @@ export const pkiAcmeServiceFactory = ({await certificateIssuanceQueue.queueCertificateIssuance(certIssuanceJobData);}const updatedOrder = (await acmeOrderDAL.findByAccountAndOrderIdWithAuthorizations(accountId, orderId))!;+ const finalizedCsr = extractCertificateRequestFromCSR(updatedOrder.csr!);order = updatedOrder;await auditLogService.createAuditLog({...auditLogInfo,@@ -1530,7 +1531,7 @@ export const pkiAcmeServiceFactory = ({type: EventType.FINALIZE_ACME_ORDER,metadata: {orderId: updatedOrder.id,- csr: updatedOrder.csr!+ commonName: finalizedCsr.commonName || ""}}});diff --git a/backend/src/server/routes/v1/signer-routers/approval-policy-router.ts b/backend/src/server/routes/v1/signer-routers/approval-policy-router.tsindex 5cf9ca6dba..344f2e2409 100644--- a/backend/src/server/routes/v1/signer-routers/approval-policy-router.ts+++ b/backend/src/server/routes/v1/signer-routers/approval-policy-router.ts@@ -67,12 +67,14 @@ export const registerSignerApprovalPolicyRouter = async (server: FastifyZodProviactorOrgId: req.permission.orgId});+ const signer = await server.services.pkiSigner.getSignerAuditContext(req.params.signerId);+await server.services.auditLog.createAuditLog({...req.auditLogInfo,- projectId: await server.services.pkiSigner.getProjectIdForSigner(req.params.signerId),+ projectId: signer.projectId,event: {type: EventType.UPDATE_PKI_SIGNER_APPROVAL_POLICY,- metadata: { signerId: req.params.signerId, stepCount: req.body.steps.length }+ metadata: { signerId: req.params.signerId, name: signer.name, stepCount: req.body.steps.length }}});diff --git a/backend/src/server/routes/v1/signer-routers/requests-router.ts b/backend/src/server/routes/v1/signer-routers/requests-router.tsindex cc64c44ecc..baeee56acf 100644--- a/backend/src/server/routes/v1/signer-routers/requests-router.ts+++ b/backend/src/server/routes/v1/signer-routers/requests-router.ts@@ -89,12 +89,14 @@ export const registerSignerRequestsRouter = async (server: FastifyZodProvider) =ipAddress: req.realIp});+ const signer = await server.services.pkiSigner.getSignerAuditContext(req.params.signerId);+await server.services.auditLog.createAuditLog({...req.auditLogInfo,- projectId: await server.services.pkiSigner.getProjectIdForSigner(req.params.signerId),+ projectId: signer.projectId,event: {type: EventType.PKI_SIGNER_REQUEST_TO_SIGN,- metadata: { signerId: req.params.signerId, approvalRequestId: request?.id }+ metadata: { signerId: req.params.signerId, name: signer.name, approvalRequestId: request?.id }}});@@ -134,13 +136,16 @@ export const registerSignerRequestsRouter = async (server: FastifyZodProvider) =actorOrgId: req.permission.orgId});+ const signer = await server.services.pkiSigner.getSignerAuditContext(req.params.signerId);+await server.services.auditLog.createAuditLog({...req.auditLogInfo,- projectId: await server.services.pkiSigner.getProjectIdForSigner(req.params.signerId),+ projectId: signer.projectId,event: {type: EventType.PKI_SIGNER_PRE_APPROVE_SIGNING,metadata: {signerId: req.params.signerId,+ name: signer.name,approvalRequestId: result?.request?.id,granteeUserId: req.body.granteeUserId,granteeIdentityId: req.body.granteeIdentityId@@ -174,12 +179,14 @@ export const registerSignerRequestsRouter = async (server: FastifyZodProvider) =actorOrgId: req.permission.orgId});+ const signer = await server.services.pkiSigner.getSignerAuditContext(req.params.signerId);+await server.services.auditLog.createAuditLog({...req.auditLogInfo,- projectId: await server.services.pkiSigner.getProjectIdForSigner(req.params.signerId),+ projectId: signer.projectId,event: {type: EventType.PKI_SIGNER_REVOKE_REQUEST,- metadata: { signerId: req.params.signerId, approvalRequestId: req.params.requestId }+ metadata: { signerId: req.params.signerId, name: signer.name, approvalRequestId: req.params.requestId }}});diff --git a/backend/src/services/signer/signer-service.ts b/backend/src/services/signer/signer-service.tsindex 0472ed15e1..d2e7e035b1 100644--- a/backend/src/services/signer/signer-service.ts+++ b/backend/src/services/signer/signer-service.ts@@ -2136,6 +2136,12 @@ export const signerServiceFactory = ({return signer.projectId;};+ const getSignerAuditContext = async (signerId: string): Promise<{ projectId: string; name: string }> => {+ const signer = await signerDAL.findById(signerId);+ if (!signer) throw new NotFoundError({ message: `Signer '${signerId}' not found.` });+ return { projectId: signer.projectId, name: signer.name };+ };+return {create,list,@@ -2143,6 +2149,7 @@ export const signerServiceFactory = ({checkIssuanceNow,getMyPermissions,getProjectIdForSigner,+ getSignerAuditContext,update,delete: deleteSigner,enable,