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
fix: edge case in vault import
Matheus Nogueira9393214fcf2a
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 6b4476f555..0c6304ffe9 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -3292,7 +3292,9 @@ export const registerRoutes = async (externalMigrationQueue,userDAL,permissionService,+ gatewayDAL,gatewayService,+ gatewayV2DAL,kmsService,appConnectionService,externalMigrationConfigDAL,diff --git a/backend/src/services/external-migration/external-migration-service.ts b/backend/src/services/external-migration/external-migration-service.tsindex 426a91befe..7c754df97e 100644--- a/backend/src/services/external-migration/external-migration-service.ts+++ b/backend/src/services/external-migration/external-migration-service.ts@@ -6,8 +6,10 @@ import {TAuditLogServiceFactory} from "@app/ee/services/audit-log/audit-log-types";import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";+import { TGatewayDALFactory } from "@app/ee/services/gateway/gateway-dal";import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";+import { TGatewayV2DALFactory } from "@app/ee/services/gateway-v2/gateway-v2-dal";import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";import { crypto } from "@app/lib/crypto/cryptography";@@ -80,6 +82,8 @@ type TExternalMigrationServiceFactoryDep = {userDAL: Pick<TUserDALFactory, "findById">;gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">;gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;+ gatewayDAL: Pick<TGatewayDALFactory, "find">;+ gatewayV2DAL: Pick<TGatewayV2DALFactory, "find">;gatewayPoolService: Pick<TGatewayPoolServiceFactory,"resolveEffectiveGatewayId" | "resolveAttachableGatewayFromPool" | "pickRandomHealthyGateway"@@ -95,6 +99,8 @@ export const externalMigrationServiceFactory = ({userDAL,gatewayService,gatewayV2Service,+ gatewayDAL,+ gatewayV2DAL,gatewayPoolService,secretService,auditLogService,@@ -304,6 +310,18 @@ export const externalMigrationServiceFactory = ({}let effectiveGatewayId: string | null = gatewayId ?? null;+ if (gatewayId) {+ const [gateway, gatewayV2] = await Promise.all([+ gatewayDAL.find({ id: gatewayId, orgId: actorOrgId }, { limit: 1 }),+ gatewayV2DAL.find({ id: gatewayId, orgId: actorOrgId }, { limit: 1 })+ ]);++ // Ensure gatewayId is part of the actor's org+ if (!gateway.length && !gatewayV2.length) {+ throw new NotFoundError({ message: `Gateway with ID ${gatewayId} not found` });+ }+ }+if (gatewayPoolId) {await gatewayPoolService.resolveAttachableGatewayFromPool({poolId: gatewayPoolId,