Skip to content

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

feat(api): removed gateway plan restriction for pam and added check in app connection, identity k8s auth

=70236eebbfd2
diff --git a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts b/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
index 22daa1cd13..168b6e173e 100644
--- a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
+++ b/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
@@ -27,7 +27,6 @@ import { NotificationType } from "@app/services/notification/notification-types"
import { TOrgDALFactory } from "@app/services/org/org-dal";
import { TSmtpService } from "@app/services/smtp/smtp-service";
-import { TLicenseServiceFactory } from "../license/license-service";
import { PamResource } from "../pam-resource/pam-resource-enums";
import { OrgPermissionGatewayActions, OrgPermissionSubjects } from "../permission/org-permission";
import { TPermissionServiceFactory } from "../permission/permission-service-types";
@@ -39,7 +38,6 @@ import { TOrgGatewayConfigV2DALFactory } from "./org-gateway-config-v2-dal";
type TGatewayV2ServiceFactoryDep = {
orgGatewayConfigV2DAL: Pick<TOrgGatewayConfigV2DALFactory, "findOne" | "create" | "transaction" | "findById">;
- licenseService: Pick<TLicenseServiceFactory, "onPremFeatures" | "getPlan">;
kmsService: TKmsServiceFactory;
relayService: TRelayServiceFactory;
gatewayV2DAL: TGatewayV2DALFactory;
@@ -54,7 +52,6 @@ export type TGatewayV2ServiceFactory = ReturnType<typeof gatewayV2ServiceFactory
export const gatewayV2ServiceFactory = ({
orgGatewayConfigV2DAL,
- licenseService,
kmsService,
relayService,
gatewayV2DAL,
@@ -64,14 +61,6 @@ export const gatewayV2ServiceFactory = ({
notificationService
}: TGatewayV2ServiceFactoryDep) => {
const $validateIdentityAccessToGateway = async (orgId: string, actorId: string, actorAuthMethod: ActorAuthMethod) => {
- const orgLicensePlan = await licenseService.getPlan(orgId);
- if (!orgLicensePlan.gateway) {
- throw new BadRequestError({
- message:
- "Gateway operation failed due to organization plan restrictions. Please upgrade your instance to Infisical's Enterprise plan."
- });
- }
-
const { permission } = await permissionService.getOrgPermission({
scope: OrganizationActionScope.Any,
actor: ActorType.IDENTITY,
@@ -304,13 +293,6 @@ export const gatewayV2ServiceFactory = ({
});
}
- const orgLicensePlan = await licenseService.getPlan(orgGatewayConfig.orgId);
- if (!orgLicensePlan.gateway) {
- throw new BadRequestError({
- message: "Please upgrade your instance to Infisical's Enterprise plan to use gateways."
- });
- }
-
const { decryptor: orgKmsDecryptor } = await kmsService.createCipherPairWithDataKey({
type: KmsDataKey.Organization,
orgId: orgGatewayConfig.orgId
@@ -461,13 +443,6 @@ export const gatewayV2ServiceFactory = ({
});
}
- const orgLicensePlan = await licenseService.getPlan(orgGatewayConfig.orgId);
- if (!orgLicensePlan.gateway) {
- throw new BadRequestError({
- message: "Please upgrade your instance to Infisical's Enterprise plan to use gateways."
- });
- }
-
const { decryptor: orgKmsDecryptor } = await kmsService.createCipherPairWithDataKey({
type: KmsDataKey.Organization,
orgId: orgGatewayConfig.orgId
diff --git a/backend/src/ee/services/relay/relay-service.ts b/backend/src/ee/services/relay/relay-service.ts
index ae7758e675..62d496ee89 100644
--- a/backend/src/ee/services/relay/relay-service.ts
+++ b/backend/src/ee/services/relay/relay-service.ts
@@ -26,7 +26,6 @@ import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";
import { TUserDALFactory } from "@app/services/user/user-dal";
import { verifyHostInputValidity } from "../dynamic-secret/dynamic-secret-fns";
-import { TLicenseServiceFactory } from "../license/license-service";
import { OrgPermissionRelayActions, OrgPermissionSubjects } from "../permission/org-permission";
import { TPermissionServiceFactory } from "../permission/permission-service-types";
import { createSshCert, createSshKeyPair } from "../ssh/ssh-certificate-authority-fns";
@@ -46,7 +45,6 @@ export const relayServiceFactory = ({
orgRelayConfigDAL,
relayDAL,
kmsService,
- licenseService,
permissionService,
orgDAL,
notificationService,
@@ -57,7 +55,6 @@ export const relayServiceFactory = ({
orgRelayConfigDAL: TOrgRelayConfigDALFactory;
relayDAL: TRelayDALFactory;
kmsService: TKmsServiceFactory;
- licenseService: TLicenseServiceFactory;
permissionService: TPermissionServiceFactory;
orgDAL: Pick<TOrgDALFactory, "findOrgMembersByRole">;
notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;
@@ -964,14 +961,6 @@ export const relayServiceFactory = ({
await verifyHostInputValidity(host);
if (isOrgRelay) {
- const orgLicensePlan = await licenseService.getPlan(orgId);
- if (!orgLicensePlan.gateway) {
- throw new BadRequestError({
- message:
- "Relay registration failed due to organization plan restrictions. Please upgrade your instance to Infisical's Enterprise plan."
- });
- }
-
const { permission } = await permissionService.getOrgPermission({
scope: OrganizationActionScope.Any,
actor: ActorType.IDENTITY,
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index 0b97d0c5d8..028053b4b3 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -394,6 +394,14 @@ export const appConnectionServiceFactory = ({
}
if (gatewayId) {
+ const plan = await licenseService.getPlan(actor.orgId);
+ if (!plan.gateway) {
+ throw new BadRequestError({
+ message:
+ "Your current plan does not support gateway usage with app connections. Please upgrade your plan or contact Infisical Sales for assistance."
+ });
+ }
+
ForbiddenError.from(orgPermission).throwUnlessCan(
OrgPermissionGatewayActions.AttachGateways,
OrgPermissionSubjects.Gateway
diff --git a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
index f619436e7f..b2b06dced2 100644
--- a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
+++ b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
@@ -759,6 +759,13 @@ export const identityKubernetesAuthServiceFactory = ({
let isGatewayV1 = true;
if (gatewayId) {
+ if (!plan.gateway) {
+ throw new BadRequestError({
+ message:
+ "Your current plan does not support gateway usage with identity k8s auth. Please upgrade your plan or contact Infisical Sales for assistance."
+ });
+ }
+
const [gateway] = await gatewayDAL.find({ id: gatewayId, orgId: identityMembershipOrg.scopeOrgId });
const [gatewayV2] = await gatewayV2DAL.find({ id: gatewayId, orgId: identityMembershipOrg.scopeOrgId });
if (!gateway && !gatewayV2) {
@@ -943,6 +950,13 @@ export const identityKubernetesAuthServiceFactory = ({
let isGatewayV1 = true;
if (gatewayId) {
+ if (!plan.gateway) {
+ throw new BadRequestError({
+ message:
+ "Your current plan does not support gateway usage with identity k8s auth. Please upgrade your plan or contact Infisical Sales for assistance."
+ });
+ }
+
const [gateway] = await gatewayDAL.find({ id: gatewayId, orgId: identityMembershipOrg.scopeOrgId });
const [gatewayV2] = await gatewayV2DAL.find({ id: gatewayId, orgId: identityMembershipOrg.scopeOrgId });