Skip to content

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

fix: fire-and-forget audit log on enroll, remove unused imports

bernie-g32d5b8d4f474
diff --git a/backend/src/ee/routes/v2/gateway-router.ts b/backend/src/ee/routes/v2/gateway-router.ts
index cfef612459..2f18e29d7c 100644
--- a/backend/src/ee/routes/v2/gateway-router.ts
+++ b/backend/src/ee/routes/v2/gateway-router.ts
@@ -5,7 +5,7 @@ import { zodBuffer } from "@app/lib/zod";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
-import { ActorType, AuthMode } from "@app/services/auth/auth-type";
+import { AuthMode } from "@app/services/auth/auth-type";
const SanitizedGatewayV2Schema = GatewaysV2Schema.pick({
id: true,
@@ -274,4 +274,3 @@ export const registerGatewayV2Router = async (server: FastifyZodProvider) => {
// Enrollment endpoints have moved to V3: /api/v3/gateways
};
-
diff --git a/backend/src/ee/routes/v3/gateway-router.ts b/backend/src/ee/routes/v3/gateway-router.ts
index bb0dc8c2b4..3efe490868 100644
--- a/backend/src/ee/routes/v3/gateway-router.ts
+++ b/backend/src/ee/routes/v3/gateway-router.ts
@@ -2,7 +2,7 @@ import z from "zod";
import { GatewaysV2Schema } from "@app/db/schemas";
import { EventType, UserAgentType } from "@app/ee/services/audit-log/audit-log-types";
-import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
@@ -135,23 +135,25 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
relayName: req.body.relayName
});
- await server.services.auditLog.createAuditLog({
- orgId: result.orgId,
- actor: {
- type: ActorType.GATEWAY,
- metadata: { gatewayId: result.gatewayId }
- },
- event: {
- type: EventType.GATEWAY_ENROLL,
- metadata: {
- gatewayId: result.gatewayId,
- name: result.gatewayName
- }
- },
- ipAddress: req.ip,
- userAgent: req.headers["user-agent"] ?? "",
- userAgentType: UserAgentType.CLI
- });
+ await server.services.auditLog
+ .createAuditLog({
+ orgId: result.orgId,
+ actor: {
+ type: ActorType.GATEWAY,
+ metadata: { gatewayId: result.gatewayId }
+ },
+ event: {
+ type: EventType.GATEWAY_ENROLL,
+ metadata: {
+ gatewayId: result.gatewayId,
+ name: result.gatewayName
+ }
+ },
+ ipAddress: req.ip,
+ userAgent: req.headers["user-agent"] ?? "",
+ userAgentType: UserAgentType.CLI
+ })
+ .catch(() => {});
return result;
}