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
host target select
x6a66b3e33204
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-session-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-session-router.tsindex 675d549b7e..fe3484cf68 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-session-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-session-router.ts@@ -300,7 +300,13 @@ export const registerPamWebAccessRouter = async (server: FastifyZodProvider) =>.trim().optional().describe("Session duration (e.g. '1h', '30m'). Capped at the account's max session duration."),- mfaSessionId: z.string().max(64).optional().describe("MFA session ID from a completed MFA verification")+ mfaSessionId: z.string().max(64).optional().describe("MFA session ID from a completed MFA verification"),+ targetHost: z+ .string()+ .trim()+ .max(255)+ .optional()+ .describe("Target host to connect to, for accounts that allow multiple hosts")}),response: {200: z.object({@@ -338,7 +344,8 @@ export const registerPamWebAccessRouter = async (server: FastifyZodProvider) =>actorUserAgent: req.headers["user-agent"] ?? "",reason: req.body.reason,duration: req.body.duration,- mfaSessionId: req.body.mfaSessionId+ mfaSessionId: req.body.mfaSessionId,+ targetHost: req.body.targetHost});await server.services.auditLog.createAuditLog({@@ -397,7 +404,13 @@ export const registerPamWebAccessRouter = async (server: FastifyZodProvider) =>}),body: z.object({reason: z.string().trim().max(1000).optional().describe("Optional reason for the session"),- mfaSessionId: z.string().max(64).optional().describe("MFA session ID from a completed MFA verification")+ mfaSessionId: z.string().max(64).optional().describe("MFA session ID from a completed MFA verification"),+ selectedHost: z+ .string()+ .trim()+ .max(255)+ .optional()+ .describe("Target host to connect to, for accounts that allow multiple hosts")}),response: {200: z.object({ ticket: z.string() })@@ -418,7 +431,8 @@ export const registerPamWebAccessRouter = async (server: FastifyZodProvider) =>actorName: `${req.auth.user.firstName ?? ""} ${req.auth.user.lastName ?? ""}`.trim(),auditLogInfo: req.auditLogInfo,reason: req.body.reason,- mfaSessionId: req.body.mfaSessionId+ mfaSessionId: req.body.mfaSessionId,+ selectedHost: req.body.selectedHost});return { ticket };@@ -505,6 +519,7 @@ export const registerPamWebAccessRouter = async (server: FastifyZodProvider) =>actorName: z.string(),reason: z.string().nullable().optional(),maxSessionDurationMs: z.number().optional(),+ selectedHost: z.string().nullable().optional(),auditLogInfo: z.object({ipAddress: z.string().optional(),userAgent: z.string().optional(),@@ -539,6 +554,7 @@ export const registerPamWebAccessRouter = async (server: FastifyZodProvider) =>actorUserAgent: req.headers["user-agent"] ?? "",reason: payload.reason,maxSessionDurationMs: payload.maxSessionDurationMs,+ selectedHost: payload.selectedHost,preAuthMessages,preAuthHandler});diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.tsindex 715e38b2fb..0d2d369de6 100644--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts@@ -422,7 +422,7 @@ export const ACCOUNT_TYPE_CONFIGS = {}),credentials: z.object({username: z.string().trim().min(1).max(255),- password: z.string().trim().min(1).max(255)+ password: optionalTrimmedString}),sanitizedCredentials: z.object({username: z.string()@@ -451,6 +451,9 @@ export const ACCOUNT_TYPE_CONFIGS = {label: "TLS Server Name",showWhen: { field: "useLdaps", equals: true }},+ username: {+ tooltip: "Use the DOMAIN\\username format for domain authentication (e.g. CORP\\Administrator)."+ },password: { widget: PamFieldWidget.Password, secret: true }}}@@ -566,6 +569,52 @@ export const extractGatewayTarget = async (}};+// Hosts the launcher can pick from, or null for single-host account types+export const getSelectableHosts = (+ accountType: PamAccountType,+ rawConnectionDetails: Record<string, unknown>+): string[] | null => {+ if (accountType !== PamAccountType.WindowsAd) return null;+ return (validateConnectionDetails(accountType, rawConnectionDetails) as { hosts: string[] }).hosts;+};++// Validates a requested host against the allow-list; falls back to the first+export const resolveSelectedHost = (+ accountType: PamAccountType,+ rawConnectionDetails: Record<string, unknown>,+ requestedHost?: string | null+): string | null => {+ const hosts = getSelectableHosts(accountType, rawConnectionDetails);+ if (!hosts) return null;+ if (requestedHost && !hosts.includes(requestedHost)) {+ throw new BadRequestError({ message: `Host '${requestedHost}' is not in this account's allowed hosts` });+ }+ return requestedHost || hosts[0];+};++// The account type the gateway sees. Windows AD is brokered through the Windows RDP protocol+export const resolveGatewayAccountType = (accountType: PamAccountType): PamAccountType =>+ accountType === PamAccountType.WindowsAd ? PamAccountType.Windows : accountType;++export const buildSessionGatewayConnectionDetails = (+ accountType: PamAccountType,+ rawConnectionDetails: Record<string, unknown>,+ selectedHost?: string | null+): Record<string, unknown> => {+ const validated = validateConnectionDetails(accountType, rawConnectionDetails) as Record<string, unknown>;++ if (accountType === PamAccountType.WindowsAd) {+ const { hosts, rdpPort } = validated as { hosts: string[]; rdpPort: number };++ return {+ host: selectedHost || hosts[0],+ port: rdpPort+ };+ }++ return validated;+};+// -- Account accessibilityexport enum PamAccountAccessibilityIssue {diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.tsindex 3437e5f47b..34f77ea48b 100644--- a/backend/src/ee/services/pam-session/pam-session-service.ts+++ b/backend/src/ee/services/pam-session/pam-session-service.ts@@ -38,11 +38,13 @@ import {} from "../pam/pam-policies";import { TPamAccountDALFactory } from "../pam-account/pam-account-dal";import {+ buildSessionGatewayConnectionDetails,extractGatewayTarget,getAccountAccessibilityIssues,PamAccountAccessibilityIssue,parseInternalMetadata,- validateConnectionDetails+ resolveGatewayAccountType,+ resolveSelectedHost} from "../pam-account/pam-account-schemas";import { PamTemplateSettingsSchema } from "../pam-account-template/pam-account-template-schemas";import { TPamFolderDALFactory } from "../pam-folder/pam-folder-dal";@@ -273,9 +275,10 @@ export const pamSessionServiceFactory = ({}: null;- const normalizedConnectionDetails = validateConnectionDetails(+ const normalizedConnectionDetails = buildSessionGatewayConnectionDetails(account.accountType as PamAccountType,- connectionDetails+ connectionDetails,+ session.selectedHost);if (sessionStarted) {@@ -356,7 +359,8 @@ export const pamSessionServiceFactory = ({actorUserAgent,reason,duration,- mfaSessionId+ mfaSessionId,+ targetHost}: {path: string;projectId: string;@@ -368,6 +372,7 @@ export const pamSessionServiceFactory = ({reason?: string;duration?: string;mfaSessionId?: string;+ targetHost?: string;}) => {const account = await resolveAccountByPath(projectId, path);@@ -432,6 +437,10 @@ export const pamSessionServiceFactory = ({const rawCredentials = await decrypt(projectId, account.encryptedCredentials);const gatewayTarget = await extractGatewayTarget(account.accountType as PamAccountType, rawConnectionDetails);+ const connectHost =+ resolveSelectedHost(account.accountType as PamAccountType, rawConnectionDetails, targetHost) ??+ gatewayTarget.host;+const user = await userDAL.findById(actor.actorId);const expiresAt = new Date(Date.now() + sessionDurationMs);@@ -451,7 +460,7 @@ export const pamSessionServiceFactory = ({gatewayId: effectiveGatewayId,reason: trimmedReason,folderName: account.folderName,- selectedHost: gatewayTarget.host+ selectedHost: connectHost});await pamSessionDAL.activateSession(session.id);@@ -460,8 +469,8 @@ export const pamSessionServiceFactory = ({const certs = await gatewayV2Service.getPAMConnectionDetails({gatewayId: effectiveGatewayId,sessionId: session.id,- accountType: account.accountType as PamAccountType,- host: gatewayTarget.host,+ accountType: resolveGatewayAccountType(account.accountType as PamAccountType),+ host: connectHost,port: gatewayTarget.port,duration: sessionDurationMs,actorMetadata: {diff --git a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts b/backend/src/ee/services/pam-web-access/pam-web-access-service.tsindex 6a1dcf6615..39887d4b8d 100644--- a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts+++ b/backend/src/ee/services/pam-web-access/pam-web-access-service.ts@@ -29,7 +29,8 @@ import { TPamAccountDALFactory } from "../pam-account/pam-account-dal";import {extractGatewayTarget,getAccountAccessibilityIssues,- PamAccountAccessibilityIssue+ PamAccountAccessibilityIssue,+ resolveSelectedHost} from "../pam-account/pam-account-schemas";import { TPamSessionDALFactory } from "../pam-session/pam-session-dal";import { SESSION_HANDLERS } from "./pam-session-handlers";@@ -84,6 +85,7 @@ type THandleWebSocketConnectionDTO = {actorUserAgent: string;reason: string | null | undefined;maxSessionDurationMs?: number;+ selectedHost?: string | null;preAuthMessages: TEarlyBufferedMsg[];preAuthHandler: (raw: Buffer | ArrayBuffer | Buffer[], isBinary: boolean) => void;};@@ -150,7 +152,8 @@ export const pamWebAccessServiceFactory = ({actorName,auditLogInfo,reason,- mfaSessionId+ mfaSessionId,+ selectedHost}: TIssueWebSocketTicketDTO) => {const account = await pamAccountDAL.findByIdWithDetails(accountId);if (!account || account.projectId !== projectId) {@@ -163,6 +166,9 @@ export const pamWebAccessServiceFactory = ({enforceRecordingConfig(account);+ const connectionDetails = await decrypt(projectId, account.encryptedConnectionDetails);+ const resolvedHost = resolveSelectedHost(account.accountType as PamAccountType, connectionDetails, selectedHost);+await checkAccountAccess(permissionService,accountId,@@ -220,7 +226,8 @@ export const pamWebAccessServiceFactory = ({actorName,auditLogInfo,reason: trimmedReason,- maxSessionDurationMs+ maxSessionDurationMs,+ selectedHost: resolvedHost})});@@ -255,6 +262,7 @@ export const pamWebAccessServiceFactory = ({actorUserAgent,reason: accessReason,maxSessionDurationMs: policyDurationMs,+ selectedHost,preAuthMessages,preAuthHandler}: THandleWebSocketConnectionDTO): Promise<void> => {@@ -395,6 +403,7 @@ export const pamWebAccessServiceFactory = ({const rawConnectionDetails = await decrypt(projectId, account.encryptedConnectionDetails);const gatewayTarget = await extractGatewayTarget(account.accountType as PamAccountType, rawConnectionDetails);+ const targetHost = selectedHost || gatewayTarget.host;const credentials = await decrypt(projectId, account.encryptedCredentials);const user = await userDAL.findById(userId);@@ -417,14 +426,14 @@ export const pamWebAccessServiceFactory = ({gatewayId: effectiveGatewayId,reason: accessReason?.trim() || null,folderName: account.folderName,- selectedHost: gatewayTarget.host+ selectedHost: targetHost});const certs = await gatewayV2Service.getPAMConnectionDetails({gatewayId: effectiveGatewayId,sessionId: session.id,accountType: handlerEntry.gatewayAccountType,- host: gatewayTarget.host,+ host: targetHost,port: gatewayTarget.port,duration: sessionDurationMs,actorMetadata: {@@ -444,8 +453,7 @@ export const pamWebAccessServiceFactory = ({gateway: certs.gateway};- const isRdp =- account.accountType === PamAccountType.Windows || account.accountType === PamAccountType.WindowsAd;+ const isRdp = account.accountType === PamAccountType.Windows || account.accountType === PamAccountType.WindowsAd;relayServer = await setupRelayServer({protocol: isRdp ? GatewayProxyProtocol.PamRdpBrowser : GatewayProxyProtocol.Pam,diff --git a/backend/src/ee/services/pam-web-access/pam-web-access-types.ts b/backend/src/ee/services/pam-web-access/pam-web-access-types.tsindex 9f2958c700..d0a74e59d7 100644--- a/backend/src/ee/services/pam-web-access/pam-web-access-types.ts+++ b/backend/src/ee/services/pam-web-access/pam-web-access-types.ts@@ -67,4 +67,5 @@ export type TIssueWebSocketTicketDTO = {auditLogInfo: AuditLogInfo;reason?: string;mfaSessionId?: string;+ selectedHost?: string;};diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.mdindex 11e3e7241f..a620e00799 100644--- a/backend/src/ee/services/pam/CLAUDE.md+++ b/backend/src/ee/services/pam/CLAUDE.md@@ -105,7 +105,9 @@ How descriptors are derived:### Key Helpers-- **`extractGatewayTarget(accountType, rawConnectionDetails)`** -- validated extraction of `{ host, port }` from decrypted connection details, dispatched by account type. Use this instead of raw type casts.+- **`extractGatewayTarget(accountType, rawConnectionDetails)`** -- validated extraction of `{ host, port }` from decrypted connection details, dispatched by account type. Used to set the cert routing extension (`getPAMConnectionDetails`) and the session's `selectedHost`. Use this instead of raw type casts.+- **`buildSessionGatewayConnectionDetails(accountType, rawConnectionDetails, selectedHost?)`** -- reshapes decrypted connection details into the blob the gateway reads for a live session (returned from `getSessionCredentials`). Most types pass through their validated connection details unchanged. Windows AD is the exception: it is brokered through the **Windows** RDP gateway protocol (`gatewayAccountType: Windows`), so it must be reduced to the Windows shape `{ host, port }` -- `host` is the `selectedHost` (the chosen entry from the account's `hosts` list) and `port` is `rdpPort`. The AD-only fields (FQDN/`domain`, `dcAddress`, the LDAP `port`, ldap settings) are intentionally **not** forwarded: they are not part of the RDP leg, and a stray `domain` alongside a `DOMAIN\username` credential makes the gateway's NLA credential resolution ambiguous and fails the session. Domain login is carried by the `DOMAIN\username` credential format (mirrors how `main`'s domain accounts brokered RDP through the Windows resource's `{ host, port }`). When adding a type that reuses another type's gateway protocol, reshape it here.+- **`getSelectableHosts(accountType, rawConnectionDetails)`** / **`resolveSelectedHost(accountType, rawConnectionDetails, requestedHost?)`** -- host-selection support for account types that hold a host list (Windows AD). `getSelectableHosts` returns the candidate hosts (or `null` for single-host types); `resolveSelectedHost` validates a launcher-requested host against that allow-list and returns the host to connect to (falling back to the first). The web-access ticket (`issueWebSocketTicket`) resolves the host **at issuance** and bakes it into the signed ticket payload, so the WS connection can't target an arbitrary host. The frontend `RdpLauncher` prompts for the host when there's more than one.- **`sanitizeCredentials(accountType, decrypted)`** -- strips secret fields from decrypted credentials using the type's `sanitizedCredentials` allowlist; used by `getById` before returning credentials to the client.- **`buildPamAccountTypeMetadata()`** -- builds the field descriptors served by `GET /pam/accounts/types`.- **`PamAccessMethod`** enum (`Web`, `Cli`) -- use instead of hardcoded `"web"`/`"cli"` strings.@@ -118,7 +120,7 @@ Most types need only backend changes -- the frontend auto-renders from metadata.2. Add a config entry to `ACCOUNT_TYPE_CONFIGS` in `pam-account/pam-account-schemas.ts`: `name`, `icon`, `connectionDetails`, `credentials`, `sanitizedCredentials`, and any `ui` hints (set `widget: "password"`/`"textarea"` and `secret: true` where the schema can't express it).3. Drop the icon image into `frontend/public/images/integrations/` matching the `icon` filename in the config. No component edit -- `AccountPlatformIcon` and the type pickers resolve the name/icon from `GET /pam/accounts/types`.4. Add a case to `extractGatewayTarget` in `pam-account-schemas.ts`.-5. If it supports web access: add a session handler in `pam-web-access/` (export the handler function) and add an entry for it to the `SESSION_HANDLERS` map in `pam-session-handlers.ts`.+5. If it supports web access: add a session handler in `pam-web-access/` (export the handler function) and add an entry for it to the `SESSION_HANDLERS` map in `pam-session-handlers.ts`. If the entry reuses another type's `gatewayAccountType` (e.g. Windows AD → `Windows` for RDP), add a case to `buildSessionGatewayConnectionDetails` so the session credentials blob matches the shape that gateway protocol expects.No changes to the account form components, router schemas, or field renderers are needed. The per-type route bodies use `config.connectionDetails`/`config.credentials` directly, the detail response (`SanitizedAccountDetailSchema`) is a discriminated union auto-derived from `ACCOUNT_TYPE_CONFIGS` (each variant pulls `connectionDetails` and `sanitizedCredentials` from the config), and the frontend forms render from `GET /pam/accounts/types`.diff --git a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsxindex 13c230fbd4..72cbd85e73 100644--- a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx+++ b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx@@ -16,6 +16,13 @@ import {RadioGroup,RadioGroupItem} from "@app/components/v3";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from "@app/components/v3/generic/Select";import { useOrganization } from "@app/context";import {PamAccountType,@@ -45,15 +52,26 @@ const formatFieldValue = (value: unknown): ReactNode => {const LaunchTab = ({account,- supportsWebAccess+ supportsWebAccess,+ hosts}: {account: TAccessiblePamAccount;supportsWebAccess: boolean;+ hosts: string[];}) => {const { currentOrg } = useOrganization();const [method, setMethod] = useState<LaunchMethod>(supportsWebAccess ? "browser" : "cli");- const cliCommand = `infisical pam access ${account.folderName}/${account.name}`;+ const needsHost = hosts.length > 1;+ const [selectedHost, setSelectedHost] = useState<string | undefined>(+ needsHost ? undefined : hosts[0]+ );+ const hostMissing = needsHost && !selectedHost;++ const cliHost = selectedHost ?? (needsHost ? "<host>" : undefined);+ const cliCommand = `infisical pam access ${account.folderName}/${account.name}${+ cliHost ? ` --target ${cliHost}` : ""+ }`;const handleCopyCommand = async () => {await navigator.clipboard.writeText(cliCommand);createNotification({ text: "Command copied to clipboard", type: "success" });@@ -67,6 +85,24 @@ const LaunchTab = ({<CardDescription>Choose how to connect to this account.</CardDescription></CardHeader><CardContent className="flex flex-col gap-5">+ {needsHost && (+ <div>+ <p className="mb-2.5 text-sm font-medium text-foreground">Host</p>+ <Select value={selectedHost ?? ""} onValueChange={setSelectedHost}>+ <SelectTrigger className="w-full">+ <SelectValue placeholder="Select a host" />+ </SelectTrigger>+ <SelectContent position="popper">+ {hosts.map((host) => (+ <SelectItem key={host} value={host}>+ {host}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ )}+{supportsWebAccess && (<div><p className="mb-3 text-sm font-medium text-foreground">Launch method</p>@@ -104,20 +140,28 @@ const LaunchTab = ({{method === "browser" && (<div><p className="mb-2.5 text-sm text-foreground">Launch browser client</p>- <Button variant="pam" className="w-full" asChild>- <Link- to="/organizations/$orgId/pam/accounts/$accountType/$accountId/access"- params={{- orgId: currentOrg.id,- accountType: account.accountType,- accountId: account.id- }}- target="_blank"- >+ {hostMissing ? (+ <Button variant="pam" className="w-full" isDisabled><Rocket className="size-4" />Connect in Browser- </Link>- </Button>+ </Button>+ ) : (+ <Button variant="pam" className="w-full" asChild>+ <Link+ to="/organizations/$orgId/pam/accounts/$accountType/$accountId/access"+ params={{+ orgId: currentOrg.id,+ accountType: account.accountType,+ accountId: account.id+ }}+ search={{ host: selectedHost }}+ target="_blank"+ >+ <Rocket className="size-4" />+ Connect in Browser+ </Link>+ </Button>+ )}</div>)}@@ -165,6 +209,11 @@ export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) =>const conn = (fullAccount?.connectionDetails ?? {}) as Record<string, unknown>;const credentials = (fullAccount?.credentials ?? {}) as Record<string, unknown>;+ const hosts =+ account.accountType === PamAccountType.WindowsAd && Array.isArray(conn.hosts)+ ? (conn.hosts as unknown[]).filter((host): host is string => typeof host === "string")+ : [];+const fieldRows = (fields: TPamFieldDescriptor[] | undefined, source: Record<string, unknown>) =>(fields ?? []).filter((f) => !f.secret)@@ -191,7 +240,9 @@ export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) =>value: PamSheetTab.Launch,label: "Launch",icon: <Rocket className="mr-1.5 size-4" />,- content: <LaunchTab account={account} supportsWebAccess={supportsWebAccess} />+ content: (+ <LaunchTab account={account} supportsWebAccess={supportsWebAccess} hosts={hosts} />+ )}]}/>diff --git a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsxindex 18fc72c3c6..e47be05599 100644--- a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx+++ b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx@@ -1,13 +1,13 @@import { useState } from "react";import { Helmet } from "react-helmet";-import { useParams } from "@tanstack/react-router";+import { useParams, useSearch } from "@tanstack/react-router";import { TriangleAlert } from "lucide-react";import { PamAccountType, TPamAccount, useGetPamAccountById } from "@app/hooks/api/pam";import { PamDataExplorerPage } from "@app/pages/pam/PamDataExplorerPage/PamDataExplorerPage";import { DisconnectedScreen } from "./DisconnectedScreen";-import { RdpContent } from "./RdpContent";+import { RdpLauncher } from "./RdpLauncher";import { SessionAccessGate } from "./ReasonGate";import { useWebAccessSession } from "./useWebAccessSession";import { WebAccessStatusCard } from "./WebAccessStatusCard";@@ -89,6 +89,7 @@ const PageContent = () => {};const { accountId } = params;+ const { host: preselectedHost } = useSearch({ strict: false }) as { host?: string };const { data: account, isPending } = useGetPamAccountById(accountId);if (isPending) {@@ -127,7 +128,14 @@ const PageContent = () => {account.accountType === PamAccountType.Windows ||account.accountType === PamAccountType.WindowsAd) {- return <RdpContent account={account} reason={reason} mfaSessionId={mfaSessionId} />;+ return (+ <RdpLauncher+ account={account}+ reason={reason}+ mfaSessionId={mfaSessionId}+ preselectedHost={preselectedHost}+ />+ );}return <TerminalContent account={account} reason={reason} mfaSessionId={mfaSessionId} />;}}diff --git a/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsx b/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsxindex 582dd5db20..5afefef673 100644--- a/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsx+++ b/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsx@@ -13,9 +13,10 @@ type RdpContentProps = {account: TPamAccount;reason?: string;mfaSessionId?: string;+ selectedHost?: string;};-export const RdpContent = ({ account, reason, mfaSessionId }: RdpContentProps) => {+export const RdpContent = ({ account, reason, mfaSessionId, selectedHost }: RdpContentProps) => {const [sessionEnded, setSessionEnded] = useState(false);const { containerRef, isConnected, error, disconnect, reconnect } = useRdpSession({@@ -23,6 +24,7 @@ export const RdpContent = ({ account, reason, mfaSessionId }: RdpContentProps) =accountName: account.name,reason,mfaSessionId,+ selectedHost,onSessionEnd: () => setSessionEnded(true)});@@ -85,6 +87,12 @@ export const RdpContent = ({ account, reason, mfaSessionId }: RdpContentProps) =)}</span><div className="flex items-center gap-4">+ {selectedHost && (+ <span>+ <span className="text-muted">Host:</span>{" "}+ <span className="text-muted">{selectedHost}</span>+ </span>+ )}<span><span className="text-muted">Account:</span>{" "}<span className="text-muted">{account.name}</span>diff --git a/frontend/src/pages/pam/PamAccountAccessPage/RdpLauncher.tsx b/frontend/src/pages/pam/PamAccountAccessPage/RdpLauncher.tsxnew file mode 100644index 0000000000..765592b60d--- /dev/null+++ b/frontend/src/pages/pam/PamAccountAccessPage/RdpLauncher.tsx@@ -0,0 +1,78 @@+import { useMemo, useState } from "react";+import { MonitorSmartphone } from "lucide-react";++import { Button } from "@app/components/v3";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from "@app/components/v3/generic/Select";+import { PamAccountType, TPamAccount } from "@app/hooks/api/pam";++import { RdpContent } from "./RdpContent";+import { WebAccessStatusCard } from "./WebAccessStatusCard";++type Props = {+ account: TPamAccount;+ reason?: string;+ mfaSessionId?: string;+ preselectedHost?: string;+};++const getSelectableHosts = (account: TPamAccount): string[] => {+ if (account.accountType !== PamAccountType.WindowsAd) return [];+ const raw = (account.connectionDetails as { hosts?: unknown }).hosts;+ return Array.isArray(raw) ? raw.filter((host): host is string => typeof host === "string") : [];+};++export const RdpLauncher = ({ account, reason, mfaSessionId, preselectedHost }: Props) => {+ const hosts = useMemo(() => getSelectableHosts(account), [account]);+ const needsPicker = hosts.length > 1 && !preselectedHost;++ const [selectedHost, setSelectedHost] = useState<string | undefined>(+ preselectedHost ?? (hosts.length > 1 ? undefined : hosts[0])+ );+ const [pendingHost, setPendingHost] = useState<string>(hosts[0] ?? "");++ if (needsPicker && !selectedHost) {+ return (+ <WebAccessStatusCard+ icon={MonitorSmartphone}+ title="Select a host"+ description="Choose which host to connect to for this session."+ >+ <Select value={pendingHost} onValueChange={setPendingHost}>+ <SelectTrigger className="w-full">+ <SelectValue placeholder="Select a host" />+ </SelectTrigger>+ <SelectContent position="popper">+ {hosts.map((host) => (+ <SelectItem key={host} value={host}>+ {host}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <Button+ variant="pam"+ isFullWidth+ isDisabled={!pendingHost}+ onClick={() => setSelectedHost(pendingHost)}+ >+ Connect+ </Button>+ </WebAccessStatusCard>+ );+ }++ return (+ <RdpContent+ account={account}+ reason={reason}+ mfaSessionId={mfaSessionId}+ selectedHost={selectedHost}+ />+ );+};diff --git a/frontend/src/pages/pam/PamAccountAccessPage/route.tsx b/frontend/src/pages/pam/PamAccountAccessPage/route.tsxindex 9f8647bf2a..9bd8b964b9 100644--- a/frontend/src/pages/pam/PamAccountAccessPage/route.tsx+++ b/frontend/src/pages/pam/PamAccountAccessPage/route.tsx@@ -1,9 +1,17 @@import { createFileRoute } from "@tanstack/react-router";+import { zodValidator } from "@tanstack/zod-adapter";+import { z } from "zod";import { PamAccountAccessPage } from "./PamAccountAccessPage";export const Route = createFileRoute("/_authenticate/_inject-org-details/organizations/$orgId/pam/accounts/$accountType/$accountId/access")({- component: PamAccountAccessPage+ component: PamAccountAccessPage,+ validateSearch: zodValidator(+ z.object({+ // Target host chosen at launch, for account types that allow multiple hosts+ host: z.string().optional()+ })+ )});diff --git a/frontend/src/pages/pam/PamAccountAccessPage/useRdpSession.ts b/frontend/src/pages/pam/PamAccountAccessPage/useRdpSession.tsindex 099c554144..cc84d4990e 100644--- a/frontend/src/pages/pam/PamAccountAccessPage/useRdpSession.ts+++ b/frontend/src/pages/pam/PamAccountAccessPage/useRdpSession.ts@@ -114,6 +114,7 @@ type UseRdpSessionOptions = {accountName: string;reason?: string;mfaSessionId?: string;+ selectedHost?: string;onSessionEnd?: () => void;};@@ -122,6 +123,7 @@ export const useRdpSession = ({accountName,reason,mfaSessionId,+ selectedHost,onSessionEnd}: UseRdpSessionOptions) => {const containerRef = useRef<HTMLDivElement | null>(null);@@ -172,7 +174,7 @@ export const useRdpSession = ({const { data } = await apiRequest.post<{ ticket: string }>(`/api/v1/pam/accounts/${accountId}/web-access-ticket`,- { reason, mfaSessionId }+ { reason, mfaSessionId, selectedHost });if (!isCurrent()) return;const proxyAddress = buildProxyAddress(data.ticket);@@ -234,7 +236,7 @@ export const useRdpSession = ({containerRef.current.appendChild(el);elementRef.current = el;- }, [accountId, accountName, reason, mfaSessionId, buildProxyAddress, teardown]);+ }, [accountId, accountName, reason, mfaSessionId, selectedHost, buildProxyAddress, teardown]);const handleConnectError = useCallback((err: unknown) => {let message = "Failed to start RDP session";