Skip to content

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

feat(pam): enable RDP access for AD domain accounts in the UI

bernie-gc2068fa55fcc
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
index 73bb84f14e..ca4be24046 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
@@ -232,18 +232,15 @@ const PageContent = () => {
</div>
</div>
<div className="flex items-center gap-3">
- {/* AD-joined accounts (domain accounts) still disabled; AD/RDP is a later phase. */}
- {!isDomainAccount && (
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Access}
- a={ProjectPermissionSub.PamAccounts}
- >
- <Button variant="neutral" onClick={handleAccess}>
- <LogInIcon />
- Access
- </Button>
- </ProjectPermissionCan>
- )}
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Access}
+ a={ProjectPermissionSub.PamAccounts}
+ >
+ <Button variant="neutral" onClick={handleAccess}>
+ <LogInIcon />
+ Access
+ </Button>
+ </ProjectPermissionCan>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="sm">
@@ -330,6 +327,7 @@ const PageContent = () => {
if (!isOpen) setAccessReason(undefined);
}}
account={popUp.accessAccount.data?.account}
+ resource={popUp.accessAccount.data?.resource}
projectId={projectId!}
reason={accessReason}
/>
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
index 72b0e7c2b4..a9867b64fd 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
@@ -10,11 +10,15 @@ import { FormLabel, IconButton, Input, Modal, ModalContent } from "@app/componen
import { ROUTE_PATHS } from "@app/const/routes";
import { useOrganization } from "@app/context";
import { PamResourceType, TPamAccount } from "@app/hooks/api/pam";
+import { TPamDomainRelatedResource } from "@app/hooks/api/pamDomain";
import { PamAwsIamAccessSection } from "./PamAwsIamAccessSection";
type Props = {
account?: TPamAccount;
+ // For domain accounts (e.g. Active Directory) the user picks a target resource at access
+ // time via PamSelectResourceModal. Local accounts ignore this and fall back to account.resource.
+ resource?: TPamDomainRelatedResource;
isOpen: boolean;
onOpenChange: (isOpen: boolean) => void;
projectId: string;
@@ -25,6 +29,7 @@ export const PamAccessAccountModal = ({
isOpen,
onOpenChange,
account,
+ resource: selectedResource,
projectId,
reason
}: Props) => {
@@ -76,13 +81,16 @@ export const PamAccessAccountModal = ({
return duration;
}, [duration]);
+ // Domain accounts (e.g. AD) carry their target on the explicit `resource` prop;
+ // local accounts read it off account.resource.
+ const targetResource = selectedResource ?? account?.resource;
+
const command = useMemo(() => {
- if (!account?.resource) return "";
- const { resource } = account;
+ if (!account || !targetResource) return "";
const base = (verb: string) =>
- `infisical pam ${verb} access --resource ${resource.name} --account ${account.name} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;
+ `infisical pam ${verb} access --resource ${targetResource.name} --account ${account.name} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;
- switch (resource.resourceType) {
+ switch (targetResource.resourceType) {
case PamResourceType.Postgres:
case PamResourceType.MySQL:
case PamResourceType.MsSQL:
@@ -99,16 +107,16 @@ export const PamAccessAccountModal = ({
default:
return "";
}
- }, [account, projectId, cliDuration, siteURL]);
+ }, [account, targetResource, projectId, cliDuration, siteURL]);
if (!account) return null;
- const isAwsIam = account.resource?.resourceType === PamResourceType.AwsIam;
+ const isAwsIam = targetResource?.resourceType === PamResourceType.AwsIam;
const showWebAccess =
- account.resource?.resourceType === PamResourceType.Postgres ||
- account.resource?.resourceType === PamResourceType.SSH ||
- account.resource?.resourceType === PamResourceType.Redis;
+ targetResource?.resourceType === PamResourceType.Postgres ||
+ targetResource?.resourceType === PamResourceType.SSH ||
+ targetResource?.resourceType === PamResourceType.Redis;
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
@@ -192,8 +200,8 @@ export const PamAccessAccountModal = ({
params={{
orgId: currentOrg.id,
projectId,
- resourceType: account.resource?.resourceType ?? "",
- resourceId: account.resource?.id ?? "",
+ resourceType: targetResource?.resourceType ?? "",
+ resourceId: targetResource?.id ?? "",
accountId: account.id
}}
target="_blank"