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
address audit log names review
Andrey4a53e19bd77b
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-account-router.tsindex 687c1d46c9..32b383f37a 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts@@ -653,7 +653,12 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {projectId: req.internalPamProjectId,event: {type: EventType.PAM_ACCOUNT_SET_ROTATION_ACCOUNT,- metadata: { accountId: req.params.accountId, rotationAccountId: result.rotationAccountId }+ metadata: {+ accountId: req.params.accountId,+ accountName: result.accountName,+ rotationAccountId: result.rotationAccountId,+ rotationAccountName: result.rotationAccountName+ }}});@@ -793,10 +798,12 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {type: EventType.PAM_ACCOUNT_ROTATE_CREDENTIALS,metadata: {accountId: req.params.accountId,+ accountName: result.accountName,accountType: result.accountType,rotationStatus: result.rotationStatus,manual: true,rotationAccountId: result.rotationAccountId,+ rotationAccountName: result.rotationAccountName,...(result.message ? { message: result.message } : {})}}diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 5b7389729c..7344d489a3 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -6945,10 +6945,12 @@ interface PamAccountRotateCredentialsEvent {type: EventType.PAM_ACCOUNT_ROTATE_CREDENTIALS;metadata: {accountId: string;+ accountName: string;accountType: string;rotationStatus: string;manual: boolean;rotationAccountId?: string | null;+ rotationAccountName?: string | null;message?: string;};}@@ -6957,7 +6959,9 @@ interface PamAccountSetRotationAccountEvent {type: EventType.PAM_ACCOUNT_SET_ROTATION_ACCOUNT;metadata: {accountId: string;+ accountName: string;rotationAccountId: string | null;+ rotationAccountName: string | null;};}diff --git a/backend/src/ee/services/pam-account-rotation/pam-account-rotation-queue.ts b/backend/src/ee/services/pam-account-rotation/pam-account-rotation-queue.tsindex 0f6fcdc0b7..8d9dc6a204 100644--- a/backend/src/ee/services/pam-account-rotation/pam-account-rotation-queue.ts+++ b/backend/src/ee/services/pam-account-rotation/pam-account-rotation-queue.ts@@ -54,10 +54,12 @@ export const pamAccountRotationQueueServiceFactory = async ({type: EventType.PAM_ACCOUNT_ROTATE_CREDENTIALS,metadata: {accountId: job.data.accountId,+ accountName: result.accountName,accountType: result.accountType,rotationStatus: result.rotationStatus,manual: false,rotationAccountId: result.rotationAccountId,+ rotationAccountName: result.rotationAccountName,...(result.message ? { message: result.message } : {})}}diff --git a/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.ts b/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.tsindex 9fe232ec82..411720eae3 100644--- a/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.ts+++ b/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.ts@@ -833,6 +833,12 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicconst loadAccountFromPrimary = (accountId: string, projectId: string) =>loadAccount(accountId, projectId, pamAccountDAL.primaryNode());+ const getRotationAccountName = async (account: TPamAccountDetail) => {+ if (!account.rotationAccountId) return null;+ if (account.rotationAccountId === account.id) return account.name;+ return (await pamAccountDAL.findById(account.rotationAccountId))?.name ?? null;+ };+const getRotation = async ({accountId,projectId,@@ -915,6 +921,7 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicthrow new BadRequestError({ message: "Credential rotation is not supported for this account type" });}+ let rotationAccountName = rotationAccountId === accountId ? account.name : null;if (rotationAccountId) {const targetCredentials = await decryptSqlCredentials(projectId,@@ -973,6 +980,7 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicResourcePermissionPamResourceActions.ViewCredentials,ctx);+ rotationAccountName = rotator.name;}}@@ -984,6 +992,8 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServic});return {rotationAccountId,+ rotationAccountName,+ accountName: account.name,accountType: account.accountType,scheduledRotationEnabled: getRotationConfig(account.templateSettings)?.enabled ?? false};@@ -1005,8 +1015,10 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicprojectId,...ctx}: TRotatePamAccountDTO & TActorContext): Promise<{+ accountName: string;accountType: string;rotationAccountId: string | null;+ rotationAccountName: string | null;rotationStatus: string;message?: string;}> => {@@ -1028,8 +1040,10 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicthrow new BadRequestError({ message: ROTATION_NOT_READY_MESSAGE[readiness.issue] });}return {+ accountName: account.name,accountType: account.accountType,rotationAccountId: account.rotationAccountId ?? null,+ rotationAccountName: await getRotationAccountName(account),...(await runRotation(account))};};@@ -1094,9 +1108,11 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicconst rotateScheduledAccount = async (accountId: string): Promise<{+ accountName: string;accountType: string;projectId: string;rotationAccountId: string | null;+ rotationAccountName: string | null;rotationStatus: string;message?: string;} | null> => {@@ -1111,9 +1127,11 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicreturn null;}return {+ accountName: account.name,accountType: account.accountType,projectId: account.projectId as string,rotationAccountId: account.rotationAccountId ?? null,+ rotationAccountName: await getRotationAccountName(account),...result};};diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.tsindex 82c4966e36..acd0863b8b 100644--- a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts+++ b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts@@ -770,19 +770,24 @@ export const pamDiscoverySourceServiceFactory = (deps: TPamDiscoverySourceServicconst rotationLimit = pLimit(IMPORT_ROTATION_CONCURRENCY);const rotateImported = async (accountId: string, accountType: string, rotationAccountId: string) => {+ let names: { accountName: string; rotationAccountName: string | null };try {- await pamAccountRotationService.setRotationAccount({ accountId, rotationAccountId, projectId, ...ctx });+ names = await pamAccountRotationService.setRotationAccount({ accountId, rotationAccountId, projectId, ...ctx });} catch (err) {return {rotationStatus: ROTATION_STATUS.Failed,rotationMessage: toResultMessage(err, "Failed to set the rotation account")};}+ const { accountName, rotationAccountName } = names;await auditLogService.createAuditLog({...auditLogInfo,orgId: ctx.actorOrgId,projectId,- event: { type: EventType.PAM_ACCOUNT_SET_ROTATION_ACCOUNT, metadata: { accountId, rotationAccountId } }+ event: {+ type: EventType.PAM_ACCOUNT_SET_ROTATION_ACCOUNT,+ metadata: { accountId, accountName, rotationAccountId, rotationAccountName }+ }});const { rotationStatus, message } = await pamAccountRotationService@@ -799,10 +804,12 @@ export const pamDiscoverySourceServiceFactory = (deps: TPamDiscoverySourceServictype: EventType.PAM_ACCOUNT_ROTATE_CREDENTIALS,metadata: {accountId,+ accountName,accountType,rotationStatus,manual: true,rotationAccountId,+ rotationAccountName,...(message ? { message } : {})}}