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
Only allow gateway for supported connections
x032205b7d7b555b2e4
diff --git a/backend/src/ee/services/app-connections/oracledb/oracledb-connection-schemas.ts b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-schemas.tsindex f93abae834..38e0fc8282 100644--- a/backend/src/ee/services/app-connections/oracledb/oracledb-connection-schemas.ts+++ b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-schemas.ts@@ -45,7 +45,10 @@ export const ValidateOracleDBConnectionCredentialsSchema = z.discriminatedUnion(]);export const CreateOracleDBConnectionSchema = ValidateOracleDBConnectionCredentialsSchema.and(- GenericCreateAppConnectionFieldsSchema(AppConnection.OracleDB, { supportsPlatformManagedCredentials: true })+ GenericCreateAppConnectionFieldsSchema(AppConnection.OracleDB, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ }));export const UpdateOracleDBConnectionSchema = z@@ -54,7 +57,12 @@ export const UpdateOracleDBConnectionSchema = zAppConnections.UPDATE(AppConnection.OracleDB).credentials)})- .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.OracleDB, { supportsPlatformManagedCredentials: true }));+ .and(+ GenericUpdateAppConnectionFieldsSchema(AppConnection.OracleDB, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ })+ );export const OracleDBConnectionListItemSchema = z.object({name: z.literal("OracleDB"),diff --git a/backend/src/services/app-connection/app-connection-schemas.ts b/backend/src/services/app-connection/app-connection-schemas.tsindex a2839d2bac..de9b4f5468 100644--- a/backend/src/services/app-connection/app-connection-schemas.ts+++ b/backend/src/services/app-connection/app-connection-schemas.ts@@ -18,7 +18,7 @@ export const BaseAppConnectionSchema = AppConnectionsSchema.omit({export const GenericCreateAppConnectionFieldsSchema = (app: AppConnection,- { supportsPlatformManagedCredentials = false }: TAppConnectionBaseConfig = {}+ { supportsPlatformManagedCredentials = false, supportsGateways = false }: TAppConnectionBaseConfig = {}) =>z.object({name: slugSchema({ field: "name" }).describe(AppConnections.CREATE(app).name),@@ -31,12 +31,19 @@ export const GenericCreateAppConnectionFieldsSchema = (isPlatformManagedCredentials: supportsPlatformManagedCredentials? z.boolean().optional().default(false).describe(AppConnections.CREATE(app).isPlatformManagedCredentials): z.literal(false).optional().describe(`Not supported for ${APP_CONNECTION_NAME_MAP[app]} Connections.`),- gatewayId: z.string().uuid().nullish().describe("The Gateway ID to use for this connection.")+ gatewayId: supportsGateways+ ? z+ .preprocess((val) => (val === "" ? null : val), z.string().uuid().nullish())+ .describe("The Gateway ID to use for this connection.")+ : z+ .union([z.literal(undefined), z.literal("")])+ .transform((v) => (v === "" ? undefined : v))+ .describe(`Not supported for ${APP_CONNECTION_NAME_MAP[app]} Connections.`)});export const GenericUpdateAppConnectionFieldsSchema = (app: AppConnection,- { supportsPlatformManagedCredentials = false }: TAppConnectionBaseConfig = {}+ { supportsPlatformManagedCredentials = false, supportsGateways = false }: TAppConnectionBaseConfig = {}) =>z.object({name: slugSchema({ field: "name" }).describe(AppConnections.UPDATE(app).name).optional(),@@ -49,5 +56,12 @@ export const GenericUpdateAppConnectionFieldsSchema = (isPlatformManagedCredentials: supportsPlatformManagedCredentials? z.boolean().optional().describe(AppConnections.UPDATE(app).isPlatformManagedCredentials): z.literal(false).optional().describe(`Not supported for ${APP_CONNECTION_NAME_MAP[app]} Connections.`),- gatewayId: z.string().uuid().nullish().describe("The Gateway ID to use for this connection.")+ gatewayId: supportsGateways+ ? z+ .preprocess((val) => (val === "" ? null : val), z.string().uuid().nullish())+ .describe("The Gateway ID to use for this connection.")+ : z+ .union([z.literal(undefined), z.literal("")])+ .transform((v) => (v === "" ? undefined : v))+ .describe(`Not supported for ${APP_CONNECTION_NAME_MAP[app]} Connections.`)});diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex 519431ce8e..077909730d 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -382,4 +382,5 @@ export type TAppConnectionTransitionCredentialsToPlatform = (export type TAppConnectionBaseConfig = {supportsPlatformManagedCredentials?: boolean;+ supportsGateways?: boolean;};diff --git a/backend/src/services/app-connection/mssql/mssql-connection-schemas.ts b/backend/src/services/app-connection/mssql/mssql-connection-schemas.tsindex 994f9a40d8..f8d3809491 100644--- a/backend/src/services/app-connection/mssql/mssql-connection-schemas.ts+++ b/backend/src/services/app-connection/mssql/mssql-connection-schemas.ts@@ -49,7 +49,10 @@ export const ValidateMsSqlConnectionCredentialsSchema = z.discriminatedUnion("me]);export const CreateMsSqlConnectionSchema = ValidateMsSqlConnectionCredentialsSchema.and(- GenericCreateAppConnectionFieldsSchema(AppConnection.MsSql, { supportsPlatformManagedCredentials: true })+ GenericCreateAppConnectionFieldsSchema(AppConnection.MsSql, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ }));export const UpdateMsSqlConnectionSchema = z@@ -58,7 +61,12 @@ export const UpdateMsSqlConnectionSchema = zAppConnections.UPDATE(AppConnection.MsSql).credentials)})- .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.MsSql, { supportsPlatformManagedCredentials: true }));+ .and(+ GenericUpdateAppConnectionFieldsSchema(AppConnection.MsSql, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ })+ );export const MsSqlConnectionListItemSchema = z.object({name: z.literal("Microsoft SQL Server"),diff --git a/backend/src/services/app-connection/mysql/mysql-connection-schemas.ts b/backend/src/services/app-connection/mysql/mysql-connection-schemas.tsindex 082bac5570..51a5333959 100644--- a/backend/src/services/app-connection/mysql/mysql-connection-schemas.ts+++ b/backend/src/services/app-connection/mysql/mysql-connection-schemas.ts@@ -47,7 +47,10 @@ export const ValidateMySqlConnectionCredentialsSchema = z.discriminatedUnion("me]);export const CreateMySqlConnectionSchema = ValidateMySqlConnectionCredentialsSchema.and(- GenericCreateAppConnectionFieldsSchema(AppConnection.MySql, { supportsPlatformManagedCredentials: true })+ GenericCreateAppConnectionFieldsSchema(AppConnection.MySql, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ }));export const UpdateMySqlConnectionSchema = z@@ -56,7 +59,12 @@ export const UpdateMySqlConnectionSchema = zAppConnections.UPDATE(AppConnection.MySql).credentials)})- .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.MySql, { supportsPlatformManagedCredentials: true }));+ .and(+ GenericUpdateAppConnectionFieldsSchema(AppConnection.MySql, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ })+ );export const MySqlConnectionListItemSchema = z.object({name: z.literal("MySQL"),diff --git a/backend/src/services/app-connection/postgres/postgres-connection-schemas.ts b/backend/src/services/app-connection/postgres/postgres-connection-schemas.tsindex 1ddf1e2da5..da74bd669c 100644--- a/backend/src/services/app-connection/postgres/postgres-connection-schemas.ts+++ b/backend/src/services/app-connection/postgres/postgres-connection-schemas.ts@@ -47,7 +47,10 @@ export const ValidatePostgresConnectionCredentialsSchema = z.discriminatedUnion(]);export const CreatePostgresConnectionSchema = ValidatePostgresConnectionCredentialsSchema.and(- GenericCreateAppConnectionFieldsSchema(AppConnection.Postgres, { supportsPlatformManagedCredentials: true })+ GenericCreateAppConnectionFieldsSchema(AppConnection.Postgres, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ }));export const UpdatePostgresConnectionSchema = z@@ -56,7 +59,12 @@ export const UpdatePostgresConnectionSchema = zAppConnections.UPDATE(AppConnection.Postgres).credentials)})- .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Postgres, { supportsPlatformManagedCredentials: true }));+ .and(+ GenericUpdateAppConnectionFieldsSchema(AppConnection.Postgres, {+ supportsPlatformManagedCredentials: true,+ supportsGateways: true+ })+ );export const PostgresConnectionListItemSchema = z.object({name: z.literal("PostgreSQL"),diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GenericAppConnectionFields.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GenericAppConnectionFields.tsxindex 4c1e3b4aa8..6508b28d03 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GenericAppConnectionFields.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GenericAppConnectionFields.tsx@@ -7,7 +7,7 @@ import { slugSchema } from "@app/lib/schemas";export const genericAppConnectionFieldsSchema = z.object({name: slugSchema({ min: 1, max: 64, field: "Name" }),description: z.string().trim().max(256, "Description cannot exceed 256 characters").nullish(),- gatewayId: z.string().uuid().nullish()+ gatewayId: z.string().nullish()});export const GenericAppConnectionsFields = () => {