Skip to content

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

chore(pam): trim verbose comments on AD-RDP path

bernie-gb918dcd49801
diff --git a/backend/src/db/migrations/20260428141725_pam-session-selected-resource.ts b/backend/src/db/migrations/20260428141725_pam-session-selected-resource.ts
index 9c2516afcb..47e7a868c5 100644
--- a/backend/src/db/migrations/20260428141725_pam-session-selected-resource.ts
+++ b/backend/src/db/migrations/20260428141725_pam-session-selected-resource.ts
@@ -2,12 +2,8 @@ import { Knex } from "knex";
import { TableName } from "../schemas";
-// Domain accounts (e.g. Active Directory) are not parented to a specific resource — a
-// single domain account can target any of the domain-linked resources. The existing
-// `resourceId` column on pam_sessions is derived from `account.resourceId` and is null
-// for these sessions. `selectedResourceId` records the specific resource the user
-// picked at session-start time so reads can resolve a target via
-// `selectedResourceId ?? resourceId`.
+// Records the user-selected target for domain-account sessions, which have no
+// owning resource. Reads resolve via COALESCE(selectedResourceId, account.resourceId).
export async function up(knex: Knex): Promise<void> {
if (await knex.schema.hasTable(TableName.PamSession)) {
const hasCol = await knex.schema.hasColumn(TableName.PamSession, "selectedResourceId");
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index 79d4043590..61011d7d60 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -733,17 +733,13 @@ export const pamAccountServiceFactory = ({
throw new NotFoundError({ message: `Resource with name '${inputResourceName}' not found` });
}
- // Find account by name within the resource (local-account path).
let account = await pamAccountDAL.findOne({
projectId,
resourceId: resource.id,
name: inputAccountName
});
- // Fallback: when the resource is joined to a domain (e.g. Active Directory),
- // accept a domain account from the linked domain. Domain accounts have
- // domainId set instead of resourceId. The session is recorded against the
- // user-selected resource via selectedResourceId.
+ // Fall back to a domain account when the resource is joined to a domain.
let isDomainAccount = false;
if (!account && resource.domainId) {
account = await pamAccountDAL.findOne({
@@ -760,10 +756,6 @@ export const pamAccountServiceFactory = ({
});
}
- // Domain accounts are only valid against resource types that support a
- // domain join. Today that's Windows-only; reject any other combination
- // defensively so a misconfigured resource (with domainId) on a different
- // type doesn't open an unintended access path.
if (isDomainAccount && resource.resourceType !== PamResource.Windows) {
throw new BadRequestError({
message: `Domain account access is only supported for Windows resources`
@@ -973,9 +965,6 @@ export const pamAccountServiceFactory = ({
};
}
- // For gateway-based resources (Postgres, MySQL, SSH), create session first.
- // Domain accounts: resourceId stays null (account isn't parented to a resource);
- // selectedResourceId records the user's pick at session-start time.
const session = await pamSessionDAL.create({
accountName: account.name,
actorEmail,
@@ -1225,9 +1214,6 @@ export const pamAccountServiceFactory = ({
const account = await pamAccountDAL.findById(session.accountId);
if (!account) throw new NotFoundError({ message: `Account with ID '${session.accountId}' not found` });
- // Resolve the target resource. For local-account sessions this is account.resourceId;
- // for domain-account sessions (e.g. AD) the account isn't attached to a resource and
- // the user-selected target lives on session.selectedResourceId.
const resourceId = session.selectedResourceId ?? account.resourceId;
if (!resourceId) {
throw new NotFoundError({ message: `Session '${sessionId}' has no associated resource` });
@@ -1343,10 +1329,7 @@ export const pamAccountServiceFactory = ({
[key: string]: unknown;
};
- // AD-account sessions: pull the AD domain name from the linked domain
- // and ship it as the `domain` field. The gateway forwards it to the RDP
- // bridge so NTLM CredSSP authenticates against the domain rather than
- // the local SAM database.
+ // The bridge forwards `domain` to IronRDP for NTLM CredSSP against AD.
let domainName: string | undefined;
if (account.domainId) {
const domain = await pamDomainDAL.findById(account.domainId);
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.ts
index 30f2e32367..e2c44f1f49 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
@@ -136,7 +136,6 @@ export const WindowsSessionCredentialsSchema = z
winrmRejectUnauthorized: z.boolean(),
winrmCaCert: z.string().optional(),
winrmTlsServerName: z.string().optional(),
- // Set on AD-account sessions; gateway/bridge use this for NTLM domain-qualified auth.
domain: z.string().optional()
})
.and(WindowsAccountCredentialsSchema);
diff --git a/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts b/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts
index 72dc3d2d92..ed6ca05f0e 100644
--- a/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts
+++ b/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts
@@ -49,8 +49,6 @@ export const pamSessionAiSummaryServiceFactory = ({
const session = await pamSessionDAL.findById(sessionId);
if (!session) return;
- // Domain-account sessions store the user-selected target on
- // selectedResourceId; local-account sessions on resourceId.
const resourceId = session.selectedResourceId ?? session.resourceId;
if (!resourceId) return;
@@ -114,8 +112,6 @@ export const pamSessionAiSummaryServiceFactory = ({
return;
}
- // 2. Skip if no resourceId (resource was deleted). Domain-account
- // sessions store the user-selected target on selectedResourceId.
const resourceId = session.selectedResourceId ?? session.resourceId;
if (!resourceId) {
logger.info(
diff --git a/backend/src/ee/services/pam-session/pam-session-dal.ts b/backend/src/ee/services/pam-session/pam-session-dal.ts
index f70373cbc7..fde72d28c8 100644
--- a/backend/src/ee/services/pam-session/pam-session-dal.ts
+++ b/backend/src/ee/services/pam-session/pam-session-dal.ts
@@ -10,10 +10,7 @@ export type TPamSessionDALFactory = ReturnType<typeof pamSessionDALFactory>;
export const pamSessionDALFactory = (db: TDbClient) => {
const orm = ormify(db, TableName.PamSession);
- // Resolve a session's target resource via COALESCE(selectedResourceId, account.resourceId).
- // Domain-account sessions (e.g. Active Directory) carry their target on
- // PamSession.selectedResourceId because the account has no owning resource;
- // local-account sessions carry it transitively via PamAccount.resourceId.
+ // COALESCE(session.selectedResourceId, account.resourceId) for domain + local sessions.
const sessionResourceJoin = db.raw(
`LEFT JOIN ?? ON COALESCE(??.??, ??.??) = ??.??`,
[
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
index a9867b64fd..8b976be801 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
@@ -16,8 +16,7 @@ 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.
+ // Required for domain accounts; local accounts fall back to account.resource.
resource?: TPamDomainRelatedResource;
isOpen: boolean;
onOpenChange: (isOpen: boolean) => void;
@@ -81,8 +80,6 @@ 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(() => {
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
index 1684b74320..9f7fd1bdda 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
@@ -275,9 +275,6 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
if (account.resource?.resourceType === PamResourceType.AwsIam) {
handlePopUpOpen("awsIamReason", { account });
} else if (account.domainId) {
- // Domain account being accessed from a resource page — the resource is
- // implicitly the one we're viewing. Pass it through so the access modal
- // can build the CLI command without going through PamSelectResourceModal.
handlePopUpOpen("accessAccount", {
account,
resource: { id: resource.id, name: resource.name, resourceType: resource.resourceType, projectId: resource.projectId }