Skip to content

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

feat: added org id in audit log injection

=5ea730355493
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.ts
index 8293d3acdb..e053377e56 100644
--- a/backend/src/@types/fastify.d.ts
+++ b/backend/src/@types/fastify.d.ts
@@ -236,7 +236,7 @@ declare module "fastify" {
clientId: string;
name: string;
};
- auditLogInfo: Pick<TCreateAuditLogDTO, "userAgent" | "userAgentType" | "ipAddress" | "actor">;
+ auditLogInfo: Pick<TCreateAuditLogDTO, "userAgent" | "userAgentType" | "ipAddress" | "actor" | "orgId">;
ssoConfig: Awaited<ReturnType<TSamlConfigServiceFactory["getSaml"]>>;
ldapConfig: Awaited<ReturnType<TLdapConfigServiceFactory["getLdapCfg"]>> & {
allowedFields?: TAllowedFields[];
diff --git a/backend/src/server/plugins/audit-log.ts b/backend/src/server/plugins/audit-log.ts
index 3b02b15280..7bf055e800 100644
--- a/backend/src/server/plugins/audit-log.ts
+++ b/backend/src/server/plugins/audit-log.ts
@@ -35,6 +35,7 @@ export const injectAuditLogInfo = fp(async (server: FastifyZodProvider) => {
const userAgent = req.headers["user-agent"] ?? "";
const payload = {
ipAddress: req.realIp,
+ orgId: req?.permission?.orgId,
userAgent,
userAgentType: getUserAgentType(userAgent)
} as typeof req.auditLogInfo;