Skip to content

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

feat: audit log token metadata

Daniel Hougaard0779f630dd09
diff --git a/backend/src/server/plugins/audit-log.ts b/backend/src/server/plugins/audit-log.ts
index 7bf055e800..9fb14e97cb 100644
--- a/backend/src/server/plugins/audit-log.ts
+++ b/backend/src/server/plugins/audit-log.ts
@@ -1,3 +1,4 @@
+import { requestContext } from "@fastify/request-context";
import fp from "fastify-plugin";
import { UserAgentType } from "@app/ee/services/audit-log/audit-log-types";
@@ -66,11 +67,16 @@ export const injectAuditLogInfo = fp(async (server: FastifyZodProvider) => {
}
};
} else if (req.auth.actor === ActorType.IDENTITY) {
+ const identityAuthInfo = requestContext.get("identityAuthInfo");
+
payload.actor = {
type: ActorType.IDENTITY,
metadata: {
name: req.auth.identityName,
- identityId: req.auth.identityId
+ identityId: req.auth.identityId,
+ ...(identityAuthInfo?.aws ? { aws: identityAuthInfo.aws } : {}),
+ ...(identityAuthInfo?.kubernetes ? { kubernetes: identityAuthInfo.kubernetes } : {}),
+ ...(identityAuthInfo?.oidc ? { oidc: identityAuthInfo.oidc } : {})
}
};
} else if (req.auth.actor === ActorType.SCIM_CLIENT) {