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
supported account types
Andreya2b3c6e79237
diff --git a/backend/src/ee/routes/v2/gateway-router.ts b/backend/src/ee/routes/v2/gateway-router.tsindex ac0cb8456a..c333ca02c0 100644--- a/backend/src/ee/routes/v2/gateway-router.ts+++ b/backend/src/ee/routes/v2/gateway-router.ts@@ -136,7 +136,8 @@ export const registerGatewayV2Router = async (server: FastifyZodProvider) => {.object({capabilities: z.object({- pkcs11: z.boolean().optional()+ pkcs11: z.boolean().optional(),+ supported_account_types: z.array(z.string().trim().max(64)).max(64).optional()}).optional()})diff --git a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts b/backend/src/ee/services/gateway-v2/gateway-v2-service.tsindex 227cb3664a..523b733d60 100644--- a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts+++ b/backend/src/ee/services/gateway-v2/gateway-v2-service.ts@@ -1055,7 +1055,7 @@ export const gatewayV2ServiceFactory = ({capabilities}: {orgPermission: OrgServiceActor;- capabilities?: { pkcs11?: boolean };+ capabilities?: { pkcs11?: boolean; supported_account_types?: string[] };}) => {const nextCapabilities = capabilities ?? {};diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.test.ts b/backend/src/ee/services/pam-account/pam-account-schemas.test.tsindex 4ec73d7fae..5d5a91002f 100644--- a/backend/src/ee/services/pam-account/pam-account-schemas.test.ts+++ b/backend/src/ee/services/pam-account/pam-account-schemas.test.ts@@ -6,6 +6,7 @@ import {applyForcedFields,buildPamAccountTypeMetadata,collectCredentialSecrets,+ gatewaySupportsAccountType,getAccountAccessibilityIssues,isCredentialConfigured,PamAccountAccessibilityIssue,@@ -545,3 +546,20 @@ describe("suppliesCredentialSecret", () => {);});});++describe("gatewaySupportsAccountType", () => {+ test("a gateway that reports nothing is not held to anything", () => {+ expect(gatewaySupportsAccountType(PamAccountType.ClickHouse, undefined)).toBe(true);+ expect(gatewaySupportsAccountType(PamAccountType.Postgres, undefined)).toBe(true);+ });++ test("a reported list decides for every type", () => {+ expect(gatewaySupportsAccountType(PamAccountType.ClickHouse, ["postgres", "clickhouse"])).toBe(true);+ expect(gatewaySupportsAccountType(PamAccountType.ClickHouse, ["postgres"])).toBe(false);+ expect(gatewaySupportsAccountType(PamAccountType.Postgres, ["clickhouse"])).toBe(false);+ });++ test("Windows AD is proxied over the Windows protocol, so that is what a gateway reports", () => {+ expect(gatewaySupportsAccountType(PamAccountType.WindowsAd, ["windows"])).toBe(true);+ });+});diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.tsindex 0c71c478fe..b6775b55d0 100644--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts@@ -976,7 +976,7 @@ export const ACCOUNT_TYPE_CONFIGS = {>>;-type TSupportedAccountType = keyof typeof ACCOUNT_TYPE_CONFIGS;+export type TSupportedAccountType = keyof typeof ACCOUNT_TYPE_CONFIGS;export type TWindowsConnectionDetails = z.infer<(typeof ACCOUNT_TYPE_CONFIGS)[PamAccountType.Windows]["connectionDetails"]@@ -1135,6 +1135,11 @@ export const resolveSelectedHost = (export const resolveGatewayAccountType = (accountType: PamAccountType): PamAccountType =>accountType === PamAccountType.WindowsAd ? PamAccountType.Windows : accountType;+export const gatewaySupportsAccountType = (+ accountType: PamAccountType,+ supportedTypes: string[] | undefined+): boolean => !supportedTypes || supportedTypes.includes(resolveGatewayAccountType(accountType));+export const buildSessionGatewayConnectionDetails = (accountType: PamAccountType,rawConnectionDetails: Record<string, unknown>,diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex 711bdf30d1..11f6e96c24 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -72,7 +72,9 @@ import {} from "./pam-account-connection-test";import { TPamAccountDALFactory } from "./pam-account-dal";import {+ ACCOUNT_TYPE_CONFIGS,applyForcedFields,+ gatewaySupportsAccountType,getAccountAccessibilityIssues,hasRevealableCredential,isCredentialConfigured,@@ -84,6 +86,7 @@ import {sanitizeCredentials,suppliesCredentialSecret,type TSshInternalMetadata,+ type TSupportedAccountType,validateConnectionDetails,validateCredentials} from "./pam-account-schemas";@@ -204,6 +207,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>mfaSessionService,permissionService,kmsService,+ gatewayV2DAL,gatewayV2Service,gatewayPoolService,licenseService@@ -543,9 +547,6 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>return true;}- const test = await buildGatewayConnectionTest(accountType, connectionDetails, credentials, orgId);- if (!test) return false;-const effectiveGatewayId = gateway.gatewayId ?? gateway.templateGatewayId;const gatewayId = await gatewayPoolService.resolveEffectiveGatewayId({gatewayId: effectiveGatewayId,@@ -556,6 +557,17 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>throw new BadRequestError({ message: "A gateway must be attached to this account." });}+ const attachedGateway = await gatewayV2DAL.findOne({ id: gatewayId });+ const capabilities = attachedGateway?.capabilities as { supported_account_types?: string[] } | null;+ if (!gatewaySupportsAccountType(accountType, capabilities?.supported_account_types)) {+ throw new BadRequestError({+ message: `Gateway '${attachedGateway?.name ?? gatewayId}' does not support ${ACCOUNT_TYPE_CONFIGS[accountType as TSupportedAccountType].name} accounts. Update the gateway, then try again.`+ });+ }++ const test = await buildGatewayConnectionTest(accountType, connectionDetails, credentials, orgId);+ if (!test) return false;+const result = await testConnectionWithGateway(test.host,test.port,