Skip to content

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

fix: audit log sub-org deletion from its own settings page

Devin AI18de19debe4d
diff --git a/backend/src/server/routes/v2/organization-router.ts b/backend/src/server/routes/v2/organization-router.ts
index 2791c2bdef..46e58e0ebc 100644
--- a/backend/src/server/routes/v2/organization-router.ts
+++ b/backend/src/server/routes/v2/organization-router.ts
@@ -529,6 +529,21 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
ipAddress: req.realIp
});
+ if (organization.rootOrgId) {
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: organization.rootOrgId,
+ event: {
+ type: EventType.DELETE_SUB_ORGANIZATION,
+ metadata: {
+ name: organization.name,
+ slug: organization.slug,
+ organizationId: organization.id
+ }
+ }
+ });
+ }
+
void res.setCookie("jid", tokens.refreshToken, {
httpOnly: true,
path: "/api",