Skip to content

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

fix(vault-migration): enforce org ownership pre-check before updating namespace config

syedmazharalirazac2f552a28a44
diff --git a/backend/src/services/external-migration/external-migration-service.ts b/backend/src/services/external-migration/external-migration-service.ts
index 0a3d4766f1..bde6cf26c9 100644
--- a/backend/src/services/external-migration/external-migration-service.ts
+++ b/backend/src/services/external-migration/external-migration-service.ts
@@ -422,6 +422,16 @@ export const externalMigrationServiceFactory = ({
throw new ForbiddenRequestError({ message: "Only admins can update vault external migration" });
}
+ const existingConfig = await vaultExternalMigrationConfigDAL.findById(id);
+
+ if (!existingConfig) {
+ throw new NotFoundError({ message: "Vault migration config not found" });
+ }
+
+ if (existingConfig.orgId !== actor.orgId) {
+ throw new ForbiddenRequestError({ message: "Config does not belong to this organization" });
+ }
+
if (connectionId) {
const connection = await appConnectionService.connectAppConnectionById<THCVaultConnection>(
AppConnection.HCVault,