Skip to content

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

fix(gateway): require the pool attach permission for a pool proxy

bernie-g07a4cf4bfec4
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
index eb7eca04ed..1f2d8065b3 100644
--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
@@ -15,6 +15,7 @@ import { TKmipServerDALFactory } from "../kmip-server/kmip-server-dal";
import { TLicenseServiceFactory } from "../license/license-service";
import {
OrgPermissionGatewayActions,
+ OrgPermissionGatewayPoolActions,
OrgPermissionKmipServerActions,
OrgPermissionRelayActions,
OrgPermissionSubjects
@@ -232,12 +233,20 @@ export const resourceAuthMethodServiceFactory = ({
actorAuthMethod: actor.authMethod,
actorOrgId: actor.orgId
});
- ForbiddenError.from(permission).throwUnlessCan(
- OrgPermissionGatewayActions.AttachGateways,
- OrgPermissionSubjects.Gateway
- );
+ if (proxy.gatewayV2Id) {
+ ForbiddenError.from(permission).throwUnlessCan(
+ OrgPermissionGatewayActions.AttachGateways,
+ OrgPermissionSubjects.Gateway
+ );
+ }
+ // Pools carry their own attach permission, so holding it for gateways is not sufficient.
if (proxy.gatewayPoolId) {
+ ForbiddenError.from(permission).throwUnlessCan(
+ OrgPermissionGatewayPoolActions.AttachGatewayPools,
+ OrgPermissionSubjects.GatewayPool
+ );
+
const plan = await licenseService.getPlan(actor.orgId);
if (!plan.gatewayPool) {
throw new BadRequestError({