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
feat(pam): enable Windows RDP access end-to-end
bernie-g6b0e479e199e
diff --git a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.tsindex 3df62afbb0..9fd593cbb6 100644--- a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts+++ b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts@@ -548,7 +548,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {}),response: {200: z.discriminatedUnion("resourceType", [- // Gateway-based resources (Postgres, MySQL, MsSQL, Redis, SSH)+ // Gateway-based resources (Postgres, MySQL, MsSQL, Redis, SSH, Windows/RDP)GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.Postgres) }),GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.MySQL) }),GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.MsSQL) }),@@ -556,6 +556,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.Redis) }),GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.SSH) }),GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.Kubernetes) }),+ GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.Windows) }),// AWS IAM (no gateway, returns console URL)z.object({sessionId: z.string(),diff --git a/backend/src/ee/routes/v1/pam-session-router.ts b/backend/src/ee/routes/v1/pam-session-router.tsindex d894aa3dac..7aaaa0370d 100644--- a/backend/src/ee/routes/v1/pam-session-router.ts+++ b/backend/src/ee/routes/v1/pam-session-router.ts@@ -9,6 +9,7 @@ import { MySQLSessionCredentialsSchema } from "@app/ee/services/pam-resource/mysimport { PostgresSessionCredentialsSchema } from "@app/ee/services/pam-resource/postgres/postgres-resource-schemas";import { RedisSessionCredentialsSchema } from "@app/ee/services/pam-resource/redis/redis-resource-schemas";import { SSHSessionCredentialsSchema } from "@app/ee/services/pam-resource/ssh/ssh-resource-schemas";+import { WindowsSessionCredentialsSchema } from "@app/ee/services/pam-resource/windows-server/windows-server-resource-schemas";import {HttpEventSchema,PamSessionCommandLogSchema,@@ -29,7 +30,8 @@ const SessionCredentialsSchema = z.union([MySQLSessionCredentialsSchema,MongoDBSessionCredentialsSchema,KubernetesSessionCredentialsSchema,- RedisSessionCredentialsSchema+ RedisSessionCredentialsSchema,+ WindowsSessionCredentialsSchema]);export const registerPamSessionRouter = async (server: FastifyZodProvider) => {diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex 16da4990e4..bba2f63e86 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -849,10 +849,6 @@ export const pamAccountServiceFactory = ({kmsService);- // Temporarily disable access to Windows Server- if (resourceType === PamResource.Windows)- throw new BadRequestError({ message: `Windows resources cannot be accessed at this time` });-const user = await userDAL.findById(actor.id);if (!user) throw new NotFoundError({ message: `User with ID '${actor.id}' not found` });@@ -1186,6 +1182,27 @@ export const pamAccountServiceFactory = ({}}+ // Windows connection details store the target as `hostname`; every other+ // resource type (and the gateway's handler code) reads `host`. Remap+ // before returning so the gateway never has to special-case it.+ if (decryptedResource.resourceType === PamResource.Windows) {+ const { hostname, ...rest } = decryptedResource.connectionDetails as {+ hostname: string;+ [key: string]: unknown;+ };+ return {+ credentials: {+ ...rest,+ host: hostname,+ ...decryptedAccount.credentials+ },+ policyRules,+ projectId: project.id,+ account,+ sessionStarted+ };+ }+return {credentials: {...decryptedResource.connectionDetails,diff --git a/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.ts b/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.tsindex 76da493dc0..0e8fefe9d2 100644--- a/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.ts+++ b/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.ts@@ -121,6 +121,20 @@ export const SanitizedWindowsAccountWithResourceSchema = BasePamAccountSchemaWit});// Sessions-export const WindowsSessionCredentialsSchema = WindowsResourceConnectionDetailsSchema.and(- WindowsAccountCredentialsSchema-);+// Note the `host` field here: resource-facing schemas use `hostname` (matches+// Windows / AD terminology), but the session-credentials endpoint remaps it to+// `host` before responding so the gateway's handler dispatch can share one+// code path across every resource type (all other resource types already+// return `host`). See getSessionCredentials in pam-account-service.+export const WindowsSessionCredentialsSchema = z+ .object({+ protocol: z.literal(WindowsProtocol.RDP),+ host: z.string().trim().min(1).max(255),+ port: z.coerce.number().int().min(1).max(65535),+ winrmPort: z.coerce.number().int().min(1).max(65535),+ useWinrmHttps: z.boolean(),+ winrmRejectUnauthorized: z.boolean(),+ winrmCaCert: z.string().optional(),+ winrmTlsServerName: z.string().optional()+ })+ .and(WindowsAccountCredentialsSchema);diff --git a/frontend/src/hooks/api/pam/types/windows-server-resource.ts b/frontend/src/hooks/api/pam/types/windows-server-resource.tsindex b2ab6c7098..d4df078110 100644--- a/frontend/src/hooks/api/pam/types/windows-server-resource.ts+++ b/frontend/src/hooks/api/pam/types/windows-server-resource.ts@@ -43,3 +43,18 @@ export type TWindowsAccount = TBasePamAccount & {credentials: TWindowsCredentials;internalMetadata: TWindowsAccountMetadata;};++// Sessions+// The session-credentials endpoint remaps `hostname` to `host` so the+// gateway's handler dispatch can share one code path across all resource+// types. See getSessionCredentials in pam-account-service on the backend.+export type TWindowsSessionCredentials = {+ protocol: WindowsProtocol.RDP;+ host: string;+ port: number;+ winrmPort: number;+ useWinrmHttps: boolean;+ winrmRejectUnauthorized: boolean;+ winrmCaCert?: string;+ winrmTlsServerName?: string;+} & TWindowsCredentials;diff --git a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsxindex f19aa1d17c..00d21d96cb 100644--- a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx+++ b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx@@ -231,8 +231,8 @@ const PageContent = () => {</div></div><div className="flex items-center gap-3">- {/* TODO: Disabled for Windows Server and Active Directory accounts until RDP is implemented */}- {!isDomainAccount && account.resource?.resourceType !== PamResourceType.Windows && (+ {/* AD-joined accounts (domain accounts) still disabled; AD/RDP is a later phase. */}+ {!isDomainAccount && (<ProjectPermissionCanI={ProjectPermissionPamAccountActions.Access}a={ProjectPermissionSub.PamAccounts}diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsxindex d9f87b6ba0..d766ea9a08 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx@@ -84,6 +84,8 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account, projectIdreturn `infisical pam ssh access --resource ${account.resource.name} --account ${account.name} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;case PamResourceType.Kubernetes:return `infisical pam kubernetes access --resource ${account.resource.name} --account ${account.name} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;+ case PamResourceType.Windows:+ return `infisical pam rdp access --resource ${account.resource.name} --account ${account.name} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;default:return "";}diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsxindex 2b1c404794..d752d38b56 100644--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx@@ -527,8 +527,8 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {</TableCell><TableCell><div className="flex items-center gap-2">- {/* TODO: Disabled for Windows Server and Active Directory accounts until RDP is implemented */}- {resource.resourceType !== PamResourceType.Windows && !account.domainId && (+ {/* AD-joined accounts (account.domainId) still disabled; AD/RDP is a later phase. */}+ {!account.domainId && (<ProjectPermissionCanI={ProjectPermissionPamAccountActions.Access}a={ProjectPermissionSub.PamAccounts}