Skip to content

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

Update external-migration-service.ts

syedmazharaliraza3305b024a45e
diff --git a/backend/src/services/external-migration/external-migration-service.ts b/backend/src/services/external-migration/external-migration-service.ts
index c1cd901ac6..d9c13f4f2e 100644
--- a/backend/src/services/external-migration/external-migration-service.ts
+++ b/backend/src/services/external-migration/external-migration-service.ts
@@ -423,12 +423,10 @@ export const externalMigrationServiceFactory = ({
}
const existingConfig = await vaultExternalMigrationConfigDAL.findById(id);
+ const configDoesNotExist = !existingConfig;
+ const configBelongsToDifferentOrg = existingConfig?.orgId !== actor.orgId;
- if (!existingConfig) {
- throw new NotFoundError({ message: "Vault migration config not found" });
- }
-
- if (existingConfig.orgId !== actor.orgId) {
+ if (configDoesNotExist || configBelongsToDifferentOrg) {
throw new NotFoundError({ message: "Vault migration config not found" });
}