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
Unmerge PAM Active Directory accounts
bernie-g48171d4094d7
diff --git a/backend/src/db/migrations/20260603030053_pam-revamp.ts b/backend/src/db/migrations/20260603030053_pam-revamp.tsindex 7f924c8ad9..95f070ac35 100644--- a/backend/src/db/migrations/20260603030053_pam-revamp.ts+++ b/backend/src/db/migrations/20260603030053_pam-revamp.ts@@ -187,7 +187,6 @@ export async function up(knex: Knex): Promise<void> {for (const t of templates) {templateMap[t.type] = t.id;}- await knex("pam_accounts").where("accountType", "active-directory").update({ accountType: "windows" });const oldPamProjects = await knex(TableName.Project).where({ orgId, type: ProjectType.PAM })diff --git a/backend/src/ee/services/pam-account/pam-account-dal.ts b/backend/src/ee/services/pam-account/pam-account-dal.tsindex 80d478f251..5d800b9b0c 100644--- a/backend/src/ee/services/pam-account/pam-account-dal.ts+++ b/backend/src/ee/services/pam-account/pam-account-dal.ts@@ -8,12 +8,16 @@ import { ormify } from "@app/lib/knex";import { PamAccountType } from "../pam/pam-enums";import { PamRecordingStorageBackend } from "../pam-session-recording/pam-recording-enums";+const recordingRequiredAccountTypes = [PamAccountType.Windows, PamAccountType.ActiveDirectory]+ .map((type) => `'${type}'`)+ .join(", ");+export const accountAccessibilitySql = (accountTable: string, templateTable: string): string =>`(("${accountTable}"."gatewayId" is not null or "${accountTable}"."gatewayPoolId" is not nullor "${templateTable}"."gatewayId" is not null or "${templateTable}"."gatewayPoolId" is not null)and "${accountTable}"."credentialConfigured" = true- and ("${templateTable}"."type" != '${PamAccountType.Windows}'+ and ("${templateTable}"."type" not in (${recordingRequiredAccountTypes})or ("${templateTable}"."settings"->>'recordingStorageBackend' = '${PamRecordingStorageBackend.AwsS3}'and ("${accountTable}"."recordingConnectionId" is not nulldiff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.tsindex bcd5aa0c9d..0985f813cb 100644--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts@@ -21,6 +21,28 @@ enum PamFieldWidget {Password = "password"}+const optionalTrimmedString = z+ .string()+ .trim()+ .transform((v) => v || undefined)+ .optional();++const normalizeDelimitedStringList = (value: unknown): unknown => {+ if (Array.isArray(value)) return value;+ if (typeof value !== "string") return value;+ const items = value+ .split("\n")+ .flatMap((line) => line.split(","))+ .map((item) => item.trim())+ .filter((item) => item.length > 0);+ return items;+};++const delimitedStringList = z.preprocess(+ normalizeDelimitedStringList,+ z.array(z.string().trim().min(1).max(255)).min(1)+);+// Source of truth for account types: per-type schemas + sparse UI hintsexport const ACCOUNT_TYPE_CONFIGS = {[PamAccountType.Postgres]: {@@ -390,6 +412,36 @@ export const ACCOUNT_TYPE_CONFIGS = {host: z.string().trim().min(1).max(255),port: z.coerce.number().int().min(1).max(65535)}),+ credentials: z.object({+ username: z.string().trim().min(1).max(255),+ password: z+ .string()+ .trim()+ .max(255)+ .transform((v) => v || undefined)+ .optional()+ }),+ sanitizedCredentials: z.object({+ username: z.string()+ }),+ ui: {+ password: { widget: PamFieldWidget.Password, secret: true }+ }+ },++ [PamAccountType.ActiveDirectory]: {+ name: "Active Directory",+ icon: "Windows.png",+ connectionDetails: z.object({+ fqdn: z.string().trim().min(1).max(255),+ dcAddress: z.string().trim().min(1).max(255),+ hostnames: delimitedStringList,+ ldapPort: z.coerce.number().int().min(1).max(65535),+ rdpPort: z.coerce.number().int().min(1).max(65535),+ useLdaps: z.boolean(),+ ldapRejectUnauthorized: z.boolean(),+ caCertificate: optionalTrimmedString+ }),credentials: z.object({username: z.string().trim().min(1).max(255),password: z@@ -405,6 +457,18 @@ export const ACCOUNT_TYPE_CONFIGS = {domain: z.string().optional()}),ui: {+ fqdn: { label: "FQDN" },+ dcAddress: { label: "DC Address" },+ hostnames: { label: "Allowed Hosts", widget: PamFieldWidget.Textarea },+ ldapPort: { label: "LDAP Port", defaultValue: 389 },+ rdpPort: { label: "RDP Port", defaultValue: 3389 },+ useLdaps: { label: "Use LDAPS" },+ ldapRejectUnauthorized: { label: "Reject Unauthorized" },+ caCertificate: {+ label: "CA Certificate",+ widget: PamFieldWidget.Textarea,+ showWhen: { field: "useLdaps", equals: true }+ },password: { widget: PamFieldWidget.Password, secret: true }}}@@ -510,6 +574,11 @@ export const extractGatewayTarget = async (}return { host: firstHost, port: 27017 };}+ case PamAccountType.ActiveDirectory:+ return {+ host: (validated as { hostnames: string[]; rdpPort: number }).hostnames[0],+ port: (validated as { hostnames: string[]; rdpPort: number }).rdpPort+ };default:throw new Error(`No gateway target extraction defined for account type '${accountType}'`);}@@ -524,7 +593,7 @@ export enum PamAccountAccessibilityIssue {}export const accountTypeRequiresRecording = (accountType: PamAccountType): boolean =>- accountType === PamAccountType.Windows;+ accountType === PamAccountType.Windows || accountType === PamAccountType.ActiveDirectory;export const getAccountAccessibilityIssues = ({accountType,diff --git a/backend/src/ee/services/pam-project/pam-project-bootstrap.ts b/backend/src/ee/services/pam-project/pam-project-bootstrap.tsindex 82310293e1..049ec7f762 100644--- a/backend/src/ee/services/pam-project/pam-project-bootstrap.ts+++ b/backend/src/ee/services/pam-project/pam-project-bootstrap.ts@@ -149,6 +149,23 @@ export const DEFAULT_ACCOUNT_TEMPLATES: TDefaultTemplate[] = [recordingStorageBackend: PamRecordingStorageBackend.Postgres}},+ {+ name: "active-directory",+ type: PamAccountType.ActiveDirectory,+ accessPolicy: DEFAULT_ACCESS_POLICY,+ settings: {+ recordingEnabled: true,+ recordingStorageBackend: PamRecordingStorageBackend.AwsS3,+ passwordConstraints: {+ minLength: 14,+ maxLength: 127,+ requireUppercase: true,+ requireLowercase: true,+ requireNumbers: true,+ requireSymbols: true+ }+ }+ },{name: "windows",type: PamAccountType.Windows,diff --git a/backend/src/ee/services/pam-web-access/pam-session-handlers.ts b/backend/src/ee/services/pam-web-access/pam-session-handlers.tsindex 4e545e2439..24162e2126 100644--- a/backend/src/ee/services/pam-web-access/pam-session-handlers.ts+++ b/backend/src/ee/services/pam-web-access/pam-session-handlers.ts@@ -27,5 +27,9 @@ export const SESSION_HANDLERS: Partial<Record<PamAccountType, TSessionHandlerEnt[PamAccountType.Windows]: {gatewayAccountType: PamAccountType.Windows,handler: handleRdpSession+ },+ [PamAccountType.ActiveDirectory]: {+ gatewayAccountType: PamAccountType.Windows,+ handler: handleRdpSession}};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 55cd1bf26c..1cb62635d4 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@@ -432,7 +432,8 @@ export const pamWebAccessServiceFactory = ({gateway: certs.gateway};- const isRdp = account.accountType === PamAccountType.Windows;+ const isRdp =+ account.accountType === PamAccountType.Windows || account.accountType === PamAccountType.ActiveDirectory;relayServer = await setupRelayServer({protocol: isRdp ? GatewayProxyProtocol.PamRdpBrowser : GatewayProxyProtocol.Pam,diff --git a/backend/src/ee/services/pam/pam-enums.ts b/backend/src/ee/services/pam/pam-enums.tsindex 8f840141e7..f46dc08249 100644--- a/backend/src/ee/services/pam/pam-enums.ts+++ b/backend/src/ee/services/pam/pam-enums.ts@@ -8,6 +8,7 @@ export enum PamAccountType {Redis = "redis",Kubernetes = "kubernetes",AwsIam = "aws-iam",+ ActiveDirectory = "active-directory",Windows = "windows"}diff --git a/frontend/src/hooks/api/pam/enums.ts b/frontend/src/hooks/api/pam/enums.tsindex ff4270879f..ab4c562dd3 100644--- a/frontend/src/hooks/api/pam/enums.ts+++ b/frontend/src/hooks/api/pam/enums.ts@@ -8,6 +8,7 @@ export enum PamAccountType {Redis = "redis",Kubernetes = "kubernetes",AwsIam = "aws-iam",+ ActiveDirectory = "active-directory",Windows = "windows"}diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.tsindex fca1443b66..60c975014b 100644--- a/frontend/src/hooks/api/pam/types/index.ts+++ b/frontend/src/hooks/api/pam/types/index.ts@@ -61,7 +61,7 @@ export enum PamAccountAccessibilityIssue {}export const accountTypeRequiresRecording = (type: PamAccountType): boolean =>- type === PamAccountType.Windows;+ type === PamAccountType.Windows || type === PamAccountType.ActiveDirectory;export type TPamAccountSettingsOverrides = {recordingS3Config?: { bucket: string; region: string; keyPrefix?: string };diff --git a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsxindex cd6d87db1f..bf05c51696 100644--- a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx+++ b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx@@ -120,7 +120,10 @@ const PageContent = () => {if (account.accountType === PamAccountType.Postgres) {return <PamDataExplorerPage reason={reason} mfaSessionId={mfaSessionId} />;}- if (account.accountType === PamAccountType.Windows) {+ if (+ account.accountType === PamAccountType.Windows ||+ account.accountType === PamAccountType.ActiveDirectory+ ) {return <RdpContent account={account} reason={reason} mfaSessionId={mfaSessionId} />;}return <TerminalContent account={account} reason={reason} mfaSessionId={mfaSessionId} />;diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsxindex 3cfad4b847..cc1239d36a 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsx@@ -34,6 +34,12 @@ type FieldProps = {isError: boolean;};+const fieldValueAsString = (value: unknown): string => {+ if (Array.isArray(value)) return value.join("\n");+ if (value === undefined || value === null) return "";+ return String(value);+};+const FieldWidget = ({ field, descriptor, isError }: FieldProps) => {if (descriptor.secret) {return (@@ -49,7 +55,7 @@ const FieldWidget = ({ field, descriptor, isError }: FieldProps) => {if (descriptor.widget === PamFieldWidget.Textarea) {return (<TextArea- value={(field.value as string) ?? ""}+ value={fieldValueAsString(field.value)}onChange={field.onChange}rows={4}isError={isError}@@ -86,7 +92,7 @@ const FieldWidget = ({ field, descriptor, isError }: FieldProps) => {}return (- <Input value={(field.value as string) ?? ""} onChange={field.onChange} isError={isError} />+ <Input value={fieldValueAsString(field.value)} onChange={field.onChange} isError={isError} />);};diff --git a/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsx b/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsxindex 0e01f1ea0e..f5750df5cd 100644--- a/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsx+++ b/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsx@@ -284,7 +284,9 @@ export const SessionDetailSheet = ({ sessionId, isOpen, onOpenChange, onTerminat);}- const isRdpSession = session.accountType === PamAccountType.Windows;+ const isRdpSession =+ session.accountType === PamAccountType.Windows ||+ session.accountType === PamAccountType.ActiveDirectory;const tabs = isRdpSession? [diff --git a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsxindex eb49e931a1..d3c47a0180 100644--- a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx+++ b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx@@ -33,6 +33,7 @@ import { Skeleton } from "@app/components/v3/generic/Skeleton";import { useProject } from "@app/context";import { AppConnection, useListAvailableAppConnections } from "@app/hooks/api/appConnections";import {+ accountTypeRequiresRecording,PamAccountType,useGetPamAccountTemplate,usePamAccountTypeMap,@@ -88,7 +89,7 @@ const ConfigurationTab = ({currentProject.id);- const isWindows = template?.type && template.type === PamAccountType.Windows;+ const requiresRecording = template?.type && accountTypeRequiresRecording(template.type);const {control,@@ -121,13 +122,15 @@ const ConfigurationTab = ({if (template) {const settings = (template.settings ?? {}) as Record<string, unknown>;const s3Config = (settings.recordingS3Config ?? {}) as Record<string, string>;- const isWin = template.type === PamAccountType.Windows;+ const requiresTemplateRecording = accountTypeRequiresRecording(template.type);const savedBackend = settings.recordingStorageBackend as "postgres" | "aws-s3" | undefined;reset({name: template.name,description: template.description ?? "",- recordingStorageBackend: isWin ? "aws-s3" : (savedBackend ?? "postgres"),+ recordingStorageBackend: requiresTemplateRecording+ ? "aws-s3"+ : (savedBackend ?? "postgres"),recordingConnectionId: (template.recordingConnectionId as string) ?? null,s3Bucket: s3Config.bucket ?? "",s3Region: s3Config.region ?? "",@@ -262,14 +265,14 @@ const ConfigurationTab = ({<SelectValue /></SelectTrigger><SelectContent>- {!isWindows && (+ {!requiresRecording && (<SelectItem value="postgres">Internal Database (default)</SelectItem>)}<SelectItem value="aws-s3">AWS S3</SelectItem></SelectContent></Select><FieldDescription>- {isWindows+ {requiresRecording? "RDP recordings require S3 storage.": "Stores recordings in the database. S3 is recommended for large or long sessions."}</FieldDescription>