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): add S3 recording overrides, CORS probe, and CLI session activation
bernie-g2c883a466898
diff --git a/backend/src/db/migrations/20260619144500_pam-account-recording-settings.ts b/backend/src/db/migrations/20260619144500_pam-account-recording-settings.tsnew file mode 100644index 0000000000..98a16e475d--- /dev/null+++ b/backend/src/db/migrations/20260619144500_pam-account-recording-settings.ts@@ -0,0 +1,21 @@+import { Knex } from "knex";++import { TableName } from "../schemas";++export async function up(knex: Knex): Promise<void> {+ const hasColumn = await knex.schema.hasColumn(TableName.PamAccount, "recordingSettings");+ if (!hasColumn) {+ await knex.schema.alterTable(TableName.PamAccount, (t) => {+ t.jsonb("recordingSettings").nullable();+ });+ }+}++export async function down(knex: Knex): Promise<void> {+ const hasColumn = await knex.schema.hasColumn(TableName.PamAccount, "recordingSettings");+ if (hasColumn) {+ await knex.schema.alterTable(TableName.PamAccount, (t) => {+ t.dropColumn("recordingSettings");+ });+ }+}diff --git a/backend/src/db/schemas/pam-accounts.ts b/backend/src/db/schemas/pam-accounts.tsindex 3a32b9f59b..a9954527b1 100644--- a/backend/src/db/schemas/pam-accounts.ts+++ b/backend/src/db/schemas/pam-accounts.ts@@ -33,6 +33,7 @@ export const PamAccountsSchema = z.object({gatewayId: z.string().uuid().nullable().optional(),gatewayPoolId: z.string().uuid().nullable().optional(),recordingConnectionId: z.string().uuid().nullable().optional(),+ recordingSettings: z.unknown().nullable().optional(),credentialConfigured: z.boolean().default(false)});diff --git a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-account-router.tsindex 13bfea9ee5..a4eece20e9 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts@@ -9,7 +9,11 @@ import {PamAccountAccessibilityIssue,PamAccountTypeMetadataSchema} from "@app/ee/services/pam-account/pam-account-schemas";-import { PamTemplateSettingsSchema } from "@app/ee/services/pam-account-template/pam-account-template-schemas";+import {+ PamAccountRecordingSettingsSchema,+ PamTemplateAccessPolicySchema,+ PamTemplateSettingsSchema+} from "@app/ee/services/pam-account-template/pam-account-template-schemas";import { SESSION_HANDLERS } from "@app/ee/services/pam-web-access/pam-session-handlers";import { ApiDocsTags } from "@app/lib/api-docs/constants";import { readLimit, writeLimit } from "@app/server/config/rateLimiter";@@ -33,6 +37,7 @@ const BaseAccountFields = PamAccountsSchema.pick({gatewayId: true,gatewayPoolId: true,recordingConnectionId: true,+ recordingSettings: true,createdAt: true,updatedAt: true});@@ -99,7 +104,8 @@ const registerPerTypeEndpoints = (credentials: config.credentials,gatewayId: z.string().uuid().optional().describe("The ID of the gateway to use"),gatewayPoolId: z.string().uuid().optional().describe("The ID of the gateway pool to use"),- recordingConnectionId: z.string().uuid().optional().describe("The ID of the recording connection to use")+ recordingConnectionId: z.string().uuid().optional().describe("The ID of the recording connection to use"),+ recordingSettings: PamAccountRecordingSettingsSchema.nullable().optional().describe("Account-level recording S3 config override")}),response: {200: z.object({@@ -108,14 +114,15 @@ const registerPerTypeEndpoints = (folderName: z.string(),templateName: z.string(),connectionDetails: z.record(z.unknown())- })+ }),+ corsProbeUrl: z.string().nullable().optional()})}},config: { rateLimit: writeLimit },onRequest: verifyAuth([AuthMode.JWT]),handler: async (req) => {- const account = await server.services.pamAccount.create({+ const { corsProbeUrl, ...account } = await server.services.pamAccount.create({accountType,...req.body,projectId: req.internalPamProjectId,@@ -154,7 +161,7 @@ const registerPerTypeEndpoints = (}).catch(() => {});- return { account };+ return { account, corsProbeUrl };}});@@ -180,16 +187,20 @@ const registerPerTypeEndpoints = (.uuid().nullable().optional()- .describe("The ID of the recording connection to use")+ .describe("The ID of the recording connection to use"),+ recordingSettings: PamAccountRecordingSettingsSchema.nullable().optional().describe("Account-level recording S3 config override")}),response: {- 200: z.object({ account: BaseAccountFields })+ 200: z.object({+ account: BaseAccountFields,+ corsProbeUrl: z.string().nullable().optional()+ })}},config: { rateLimit: writeLimit },onRequest: verifyAuth([AuthMode.JWT]),handler: async (req) => {- const account = await server.services.pamAccount.update({+ const { corsProbeUrl, ...account } = await server.services.pamAccount.update({accountId: req.params.accountId,accountType,...req.body,@@ -233,7 +244,7 @@ const registerPerTypeEndpoints = (}).catch(() => {});- return { account };+ return { account, corsProbeUrl };}});diff --git a/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.tsindex 56bf2484f1..3e8938b75b 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-account-template-router.ts@@ -111,13 +111,16 @@ export const registerPamAccountTemplateRouter = async (server: FastifyZodProviderecordingConnectionId: z.string().uuid().optional().describe("Recording storage connection ID")}),response: {- 200: z.object({ template: SanitizedTemplateSchema })+ 200: z.object({+ template: SanitizedTemplateSchema,+ corsProbeUrl: z.string().nullable().optional()+ })}},config: { rateLimit: writeLimit },onRequest: verifyAuth([AuthMode.JWT]),handler: async (req) => {- const template = await server.services.pamAccountTemplate.create({+ const { corsProbeUrl, ...template } = await server.services.pamAccountTemplate.create({...req.body,projectId: req.internalPamProjectId,actorId: req.permission.id,@@ -152,7 +155,7 @@ export const registerPamAccountTemplateRouter = async (server: FastifyZodProvide}).catch(() => {});- return { template };+ return { template, corsProbeUrl };}});@@ -176,13 +179,16 @@ export const registerPamAccountTemplateRouter = async (server: FastifyZodProviderecordingConnectionId: z.string().uuid().nullable().optional().describe("New recording connection ID")}),response: {- 200: z.object({ template: SanitizedTemplateSchema })+ 200: z.object({+ template: SanitizedTemplateSchema,+ corsProbeUrl: z.string().nullable().optional()+ })}},config: { rateLimit: writeLimit },onRequest: verifyAuth([AuthMode.JWT]),handler: async (req) => {- const template = await server.services.pamAccountTemplate.update({+ const { corsProbeUrl, ...template } = await server.services.pamAccountTemplate.update({templateId: req.params.templateId,...req.body,projectId: req.internalPamProjectId,@@ -217,7 +223,7 @@ export const registerPamAccountTemplateRouter = async (server: FastifyZodProvide}).catch(() => {});- return { template };+ return { template, corsProbeUrl };}});diff --git a/backend/src/ee/services/pam-account-template/pam-account-template-schemas.ts b/backend/src/ee/services/pam-account-template/pam-account-template-schemas.tsindex 158aac0e1a..858bf50786 100644--- a/backend/src/ee/services/pam-account-template/pam-account-template-schemas.ts+++ b/backend/src/ee/services/pam-account-template/pam-account-template-schemas.ts@@ -12,9 +12,13 @@ export const PamPasswordConstraintsSchema = z.object({});export const PamRecordingS3ConfigSchema = z.object({- bucket: z.string().min(1),- region: z.string().min(1),- keyPrefix: z.string().optional()+ bucket: z.string().trim().min(1),+ region: z.string().trim().min(1),+ keyPrefix: z.string().trim().optional()+});++export const PamAccountRecordingSettingsSchema = z.object({+ s3Config: PamRecordingS3ConfigSchema.optional()});export const PamTemplateSettingsSchema = z.object({diff --git a/backend/src/ee/services/pam-account-template/pam-account-template-service.ts b/backend/src/ee/services/pam-account-template/pam-account-template-service.tsindex 432cf91a6e..373e8d7741 100644--- a/backend/src/ee/services/pam-account-template/pam-account-template-service.ts+++ b/backend/src/ee/services/pam-account-template/pam-account-template-service.ts@@ -5,7 +5,14 @@ import { BadRequestError, DatabaseError, ForbiddenRequestError, NotFoundError }import { PamAccountType, PamProductRole } from "../pam/pam-enums";import { TActorContext, verifyProductMembership } from "../pam/pam-permission";import { validatePolicyValues } from "../pam/pam-policies";-import { TPamValidatorDeps, validateGatewayAttachment, validateRecordingConnection } from "../pam/pam-validators";+import {+ mintCorsProbeUrl,+ TPamValidatorDeps,+ validateGatewayAttachment,+ validateRecordingConnection,+ validateRecordingS3Config+} from "../pam/pam-validators";+import { PamRecordingS3ConfigSchema } from "./pam-account-template-schemas";import { ACCOUNT_TYPE_CONFIGS } from "../pam-account/pam-account-schemas";import { TPamAccountTemplateDALFactory } from "./pam-account-template-dal";import {@@ -80,8 +87,18 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicawait validateRecordingConnection(deps, recordingConnectionId, ctx);const validatedPolicies = validateTemplatePolicies(type, policies);+ let resolvedS3Config = null;+ if (recordingConnectionId && settings) {+ const s3Parsed = PamRecordingS3ConfigSchema.safeParse(+ (settings as Record<string, unknown>).recordingS3Config+ );+ if (s3Parsed.success) {+ resolvedS3Config = await validateRecordingS3Config(deps, recordingConnectionId, s3Parsed.data);+ }+ }+try {- return await pamAccountTemplateDAL.create({+ const template = await pamAccountTemplateDAL.create({projectId,name,description,@@ -92,6 +109,8 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicgatewayPoolId,recordingConnectionId});+ const corsProbeUrl = resolvedS3Config ? await mintCorsProbeUrl(resolvedS3Config) : null;+ return { ...template, corsProbeUrl };} catch (err) {if (err instanceof DatabaseError &&@@ -126,6 +145,18 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicconst validatedPolicies = validateTemplatePolicies(existing.type, policies);+ const resolvedConnId = recordingConnectionId !== undefined ? recordingConnectionId : existing.recordingConnectionId;+ const resolvedSettings = settings !== undefined ? settings : existing.settings;+ let resolvedS3Config = null;+ if (resolvedConnId && resolvedSettings) {+ const s3Parsed = PamRecordingS3ConfigSchema.safeParse(+ (resolvedSettings as Record<string, unknown>).recordingS3Config+ );+ if (s3Parsed.success) {+ resolvedS3Config = await validateRecordingS3Config(deps, resolvedConnId, s3Parsed.data);+ }+ }+const updateData: Record<string, unknown> = {};if (name !== undefined) updateData.name = name;if (description !== undefined) updateData.description = description;@@ -136,7 +167,9 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicif (recordingConnectionId !== undefined) updateData.recordingConnectionId = recordingConnectionId;try {- return await pamAccountTemplateDAL.updateById(templateId, updateData);+ const template = await pamAccountTemplateDAL.updateById(templateId, updateData);+ const corsProbeUrl = resolvedS3Config ? await mintCorsProbeUrl(resolvedS3Config) : null;+ return { ...template, corsProbeUrl };} catch (err) {if (err instanceof DatabaseError &&diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex 5031b54b8f..d706317938 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -21,7 +21,7 @@ import { KmsDataKey } from "@app/services/kms/kms-types";import { TMembershipDALFactory } from "@app/services/membership/membership-dal";import { TMembershipRoleDALFactory } from "@app/services/membership/membership-role-dal";-import { PamAccountType } from "../pam/pam-enums";+import { PamAccountType, resolveAccountType } from "../pam/pam-enums";import {checkAccountAccess,checkFolderPermission,@@ -29,7 +29,7 @@ import {TActorContext,verifyProductMembership} from "../pam/pam-permission";-import { validateGatewayAttachment, validateRecordingConnection } from "../pam/pam-validators";+import { mintCorsProbeUrl, validateGatewayAttachment, validateRecordingConnection, validateRecordingS3Config } from "../pam/pam-validators";import { TPamAccountTemplateDALFactory } from "../pam-account-template/pam-account-template-dal";import { TPamFolderDALFactory } from "../pam-folder/pam-folder-dal";import { TPamAccountDALFactory } from "./pam-account-dal";@@ -64,7 +64,7 @@ type TPamAccountServiceFactoryDep = {kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;gatewayV2DAL: Pick<TGatewayV2DALFactory, "findOne">;gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveAttachableGatewayFromPool">;- appConnectionDAL: Pick<TAppConnectionDALFactory, "findOne">;+ appConnectionDAL: Pick<TAppConnectionDALFactory, "findOne" | "findById">;};export type TPamAccountServiceFactory = ReturnType<typeof pamAccountServiceFactory>;@@ -192,6 +192,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>gatewayId: account.gatewayId,gatewayPoolId: account.gatewayPoolId,recordingConnectionId: account.recordingConnectionId,+ recordingSettings: account.recordingSettings ?? null,connectionDetails,credentials,...computeAccessibility(account),@@ -212,6 +213,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>gatewayId,gatewayPoolId,recordingConnectionId,+ recordingSettings,...ctx}: TCreatePamAccountDTO & TActorContext) => {const { permission } = await checkFolder(folderId, projectId, ctx);@@ -235,9 +237,31 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>});}+ const resolved = resolveAccountType(accountType);+ if (resolved === PamAccountType.Windows) {+ const settings = (template.settings ?? {}) as Record<string, unknown>;+ if (+ settings.recordingStorageBackend !== "aws-s3" ||+ !template.recordingConnectionId+ ) {+ throw new BadRequestError({+ message:+ "Cannot create a Windows account until the account template has S3 recording fully configured (storage backend, AWS connection, and S3 bucket)"+ });+ }+ }+await validateGatewayAttachment(deps, gatewayId, gatewayPoolId, ctx);await validateRecordingConnection(deps, recordingConnectionId, ctx);+ let resolvedS3Config = null;+ if (recordingSettings?.s3Config) {+ const connId = recordingConnectionId ?? template.recordingConnectionId;+ if (connId) {+ resolvedS3Config = await validateRecordingS3Config(deps, connId, recordingSettings.s3Config);+ }+ }+const validatedConnectionDetails = validateConnectionDetails(accountType, connectionDetails);const validatedCredentials = validateCredentials(accountType, credentials);@@ -256,9 +280,12 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>credentialConfigured: isCredentialConfigured(accountType, validatedCredentials),gatewayId,gatewayPoolId,- recordingConnectionId+ recordingConnectionId,+ recordingSettings: recordingSettings ?? null});+ const corsProbeUrl = resolvedS3Config ? await mintCorsProbeUrl(resolvedS3Config) : null;+return {id: account.id,name: account.name,@@ -274,7 +301,8 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>accountType,folderName: folder.name,templateName: template.name,- connectionDetails: validatedConnectionDetails+ connectionDetails: validatedConnectionDetails,+ corsProbeUrl};} catch (err) {if (err instanceof DatabaseError) {@@ -305,6 +333,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>gatewayId,gatewayPoolId,recordingConnectionId,+ recordingSettings,...ctx}: TUpdatePamAccountDTO & TActorContext) => {const existing = await pamAccountDAL.findByIdWithDetails(accountId);@@ -342,6 +371,16 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>await validateGatewayAttachment(deps, gatewayId, gatewayPoolId, ctx);await validateRecordingConnection(deps, recordingConnectionId, ctx);+ let resolvedS3Config = null;+ if (recordingSettings?.s3Config) {+ const connId =+ (recordingConnectionId !== undefined ? recordingConnectionId : existing.recordingConnectionId)+ ?? existing.templateRecordingConnectionId;+ if (connId) {+ resolvedS3Config = await validateRecordingS3Config(deps, connId, recordingSettings.s3Config);+ }+ }+const updateData: Record<string, unknown> = {};if (name !== undefined) updateData.name = name;if (description !== undefined) updateData.description = description;@@ -350,6 +389,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>if (gatewayId !== undefined) updateData.gatewayId = gatewayId;if (gatewayPoolId !== undefined) updateData.gatewayPoolId = gatewayPoolId;if (recordingConnectionId !== undefined) updateData.recordingConnectionId = recordingConnectionId;+ if (recordingSettings !== undefined) updateData.recordingSettings = recordingSettings;if (connectionDetails) {const validated = validateConnectionDetails(accountType, connectionDetails);@@ -364,7 +404,9 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>}try {- return await pamAccountDAL.updateById(accountId, updateData);+ const account = await pamAccountDAL.updateById(accountId, updateData);+ const corsProbeUrl = resolvedS3Config ? await mintCorsProbeUrl(resolvedS3Config) : null;+ return { ...account, corsProbeUrl };} catch (err) {if (err instanceof DatabaseError) {const code = (err.error as { code?: string })?.code;diff --git a/backend/src/ee/services/pam-account/pam-account-types.ts b/backend/src/ee/services/pam-account/pam-account-types.tsindex 051def6577..1bdf819de0 100644--- a/backend/src/ee/services/pam-account/pam-account-types.ts+++ b/backend/src/ee/services/pam-account/pam-account-types.ts@@ -12,6 +12,7 @@ export type TCreatePamAccountDTO = {gatewayId?: string;gatewayPoolId?: string;recordingConnectionId?: string;+ recordingSettings?: { s3Config?: { bucket: string; region: string; keyPrefix?: string } } | null;};export type TUpdatePamAccountDTO = {@@ -27,6 +28,7 @@ export type TUpdatePamAccountDTO = {gatewayId?: string | null;gatewayPoolId?: string | null;recordingConnectionId?: string | null;+ recordingSettings?: { s3Config?: { bucket: string; region: string; keyPrefix?: string } } | null;};export type TDeletePamAccountDTO = {diff --git a/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts b/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.tsindex 1e1fe90c39..61eae7d9a0 100644--- a/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts+++ b/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts@@ -15,7 +15,7 @@ import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { PamSessionStatus } from "../pam/pam-enums";import { checkAccountAccess, TActorContext } from "../pam/pam-permission";import { TPamAccountDALFactory } from "../pam-account/pam-account-dal";-import { PamTemplateSettingsSchema } from "../pam-account-template/pam-account-template-schemas";+import { PamRecordingS3ConfigSchema, PamTemplateSettingsSchema } from "../pam-account-template/pam-account-template-schemas";import { TPamSessionDALFactory } from "../pam-session/pam-session-dal";import { ResourcePermissionPamResourceActions } from "../permission/resource-permission";import { TPamSessionEventChunkDALFactory } from "./pam-recording-chunk-dal";@@ -54,13 +54,21 @@ export const pamSessionChunkServiceFactory = ({const account = await pamAccountDAL.findByIdWithDetails(accountId);if (!account) return null;- const parsed = account.templateSettings ? PamTemplateSettingsSchema.safeParse(account.templateSettings) : null;- const settings = parsed?.success ? parsed.data : null;- if (!settings) return null;+ const templateParsed = account.templateSettings ? PamTemplateSettingsSchema.safeParse(account.templateSettings) : null;+ const templateSettings = templateParsed?.success ? templateParsed.data : null;+ if (!templateSettings) return null;- if (settings.recordingStorageBackend === PamRecordingStorageBackend.AwsS3) {+ const accountS3Parsed = account.recordingSettings+ ? PamRecordingS3ConfigSchema.safeParse(+ (account.recordingSettings as Record<string, unknown>).s3Config+ )+ : null;+ const accountS3 = accountS3Parsed?.success ? accountS3Parsed.data : null;++ if (templateSettings.recordingStorageBackend === PamRecordingStorageBackend.AwsS3) {const connectionId = account.recordingConnectionId;- if (!connectionId || !settings.recordingS3Config) return null;+ const s3Config = accountS3 ?? templateSettings.recordingS3Config;+ if (!connectionId || !s3Config) return null;const raw = await appConnectionDAL.findById(connectionId);if (!raw) {@@ -71,14 +79,14 @@ export const pamSessionChunkServiceFactory = ({const appConnection = await decryptAppConnection(raw, kmsService);const awsConfig = await getAwsConnectionConfig(appConnection as unknown as TAwsConnectionConfig,- (settings.recordingS3Config.region as AWSRegion) ?? AWSRegion.US_EAST_1+ (s3Config.region as AWSRegion) ?? AWSRegion.US_EAST_1);return {backend: PamRecordingStorageBackend.AwsS3,- bucket: settings.recordingS3Config.bucket,- region: settings.recordingS3Config.region as AWSRegion,- keyPrefix: settings.recordingS3Config.keyPrefix ?? null,+ bucket: s3Config.bucket,+ region: s3Config.region as AWSRegion,+ keyPrefix: s3Config.keyPrefix ?? null,awsCredentials: awsConfig.credentials};}diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.tsindex 2c9c263efb..0634c971ab 100644--- a/backend/src/ee/services/pam-session/pam-session-service.ts+++ b/backend/src/ee/services/pam-session/pam-session-service.ts@@ -404,6 +404,7 @@ export const pamSessionServiceFactory = ({selectedHost: gatewayTarget.host});+ await pamSessionDAL.activateSession(session.id);await pamSessionExpirationService.scheduleSessionExpiration(session.id, expiresAt);const certs = await gatewayV2Service.getPAMConnectionDetails({diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.mdindex 072706f08d..ed84ec0f68 100644--- a/backend/src/ee/services/pam/CLAUDE.md+++ b/backend/src/ee/services/pam/CLAUDE.md@@ -16,7 +16,7 @@ All PAM services live under `backend/src/ee/services/pam-*/`:| `pam-session-recording/` | Recording chunk storage, retrieval, secrets, and storage providers (`aws-s3/`, `postgres/`) || `pam-membership/` | Product + resource membership management || `pam-project/` | PAM project bootstrap and resolver (formerly `pam-instance/`) |-| `pam-web-access/` | WebSocket session handlers (Postgres, SSH), ticket-based auth |+| `pam-web-access/` | WebSocket session handlers (Postgres, SSH, RDP), ticket-based auth |Routes live in `backend/src/ee/routes/v1/pam-routers/`.diff --git a/backend/src/ee/services/pam/pam-validators.ts b/backend/src/ee/services/pam/pam-validators.tsindex bd74df124b..4a052f32b7 100644--- a/backend/src/ee/services/pam/pam-validators.ts+++ b/backend/src/ee/services/pam/pam-validators.ts@@ -7,14 +7,23 @@ import { OrgPermissionGatewayActions, OrgPermissionSubjects } from "@app/ee/servimport { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";import { NotFoundError } from "@app/lib/errors";import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";+import { AWSRegion } from "@app/services/app-connection/app-connection-enums";+import { decryptAppConnection } from "@app/services/app-connection/app-connection-fns";+import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-fns";+import { TAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-types";+import { TKmsServiceFactory } from "@app/services/kms/kms-service";+import { PamRecordingStorageBackend } from "../pam-session-recording/pam-recording-enums";+import { PAM_RECORDING_STORAGE_FACTORY_MAP } from "../pam-session-recording/pam-recording-storage-factory";+import { normalizeKeyPrefix, TPamRecordingResolvedConfig } from "../pam-session-recording/pam-recording-storage-types";import { TActorContext } from "./pam-permission";export type TPamValidatorDeps = {permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;gatewayV2DAL: Pick<TGatewayV2DALFactory, "findOne">;gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveAttachableGatewayFromPool">;- appConnectionDAL: Pick<TAppConnectionDALFactory, "findOne">;+ appConnectionDAL: Pick<TAppConnectionDALFactory, "findOne" | "findById">;+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;};export const validateGatewayAttachment = async (@@ -67,3 +76,46 @@ export const validateRecordingConnection = async (}}};++export const validateRecordingS3Config = async (+ { appConnectionDAL, kmsService }: Pick<TPamValidatorDeps, "appConnectionDAL" | "kmsService">,+ connectionId: string,+ s3Config: { bucket: string; region: string; keyPrefix?: string }+): Promise<TPamRecordingResolvedConfig> => {+ const raw = await appConnectionDAL.findById(connectionId);+ if (!raw) {+ throw new NotFoundError({ message: `Recording connection ${connectionId} not found` });+ }++ const appConnection = await decryptAppConnection(raw, kmsService);+ const awsConfig = await getAwsConnectionConfig(+ appConnection as unknown as TAwsConnectionConfig,+ (s3Config.region as AWSRegion) ?? AWSRegion.US_EAST_1+ );++ const resolvedConfig: TPamRecordingResolvedConfig = {+ backend: PamRecordingStorageBackend.AwsS3,+ bucket: s3Config.bucket,+ region: s3Config.region as AWSRegion,+ keyPrefix: s3Config.keyPrefix ?? null,+ awsCredentials: awsConfig.credentials+ };++ const provider = PAM_RECORDING_STORAGE_FACTORY_MAP[PamRecordingStorageBackend.AwsS3]();+ await provider.validateConfig({ config: resolvedConfig });++ return resolvedConfig;+};++export const mintCorsProbeUrl = async (+ resolvedConfig: TPamRecordingResolvedConfig+): Promise<string | null> => {+ try {+ const probeKey = `${normalizeKeyPrefix(resolvedConfig.keyPrefix)}.cors-probe`;+ const provider = PAM_RECORDING_STORAGE_FACTORY_MAP[PamRecordingStorageBackend.AwsS3]();+ const { url } = await provider.mintPresignedGet({ config: resolvedConfig, objectKey: probeKey });+ return url;+ } catch {+ return null;+ }+};diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 3f53f621ab..e682fdf8aa 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -1765,7 +1765,8 @@ export const registerRoutes = async (permissionService,gatewayV2DAL,gatewayPoolService,- appConnectionDAL+ appConnectionDAL,+ kmsService});const pamAccountService = pamAccountServiceFactory({diff --git a/frontend/src/hooks/api/pam/mutations.tsx b/frontend/src/hooks/api/pam/mutations.tsxindex dda9bad535..48b8dcb7de 100644--- a/frontend/src/hooks/api/pam/mutations.tsx+++ b/frontend/src/hooks/api/pam/mutations.tsx@@ -106,7 +106,7 @@ export const useCreatePamAccount = () => {meta: { skipValidationToast: true },mutationFn: async ({ accountType, ...params }: TCreatePamAccountDTO) => {const { data } = await apiRequest.post(`/api/v1/pam/accounts/${accountType}`, params);- return data.account;+ return { ...data.account, corsProbeUrl: data.corsProbeUrl as string | null | undefined };},onSuccess: () => {queryClient.invalidateQueries({ queryKey: pamKeys.account() });@@ -118,14 +118,12 @@ export const useCreatePamAccount = () => {export const useUpdatePamAccount = () => {const queryClient = useQueryClient();return useMutation({- // Validation errors are mapped onto the form fields- meta: { skipValidationToast: true },mutationFn: async ({ accountId, accountType, ...params }: TUpdatePamAccountDTO) => {const { data } = await apiRequest.patch(`/api/v1/pam/accounts/${accountType}/${accountId}`,params);- return data.account;+ return { ...data.account, corsProbeUrl: data.corsProbeUrl as string | null | undefined };},onSuccess: () => {queryClient.invalidateQueries({ queryKey: pamKeys.account() });@@ -153,11 +151,11 @@ export const useCreatePamAccountTemplate = () => {const queryClient = useQueryClient();return useMutation({mutationFn: async (params: TCreatePamAccountTemplateDTO) => {- const { data } = await apiRequest.post<{ template: TPamAccountTemplate }>(+ const { data } = await apiRequest.post<{ template: TPamAccountTemplate; corsProbeUrl?: string | null }>("/api/v1/pam/account-templates",params);- return data.template;+ return { ...data.template, corsProbeUrl: data.corsProbeUrl };},onSuccess: () => {queryClient.invalidateQueries({ queryKey: pamKeys.template() });@@ -169,11 +167,11 @@ export const useUpdatePamAccountTemplate = () => {const queryClient = useQueryClient();return useMutation({mutationFn: async ({ templateId, ...params }: TUpdatePamAccountTemplateDTO) => {- const { data } = await apiRequest.patch<{ template: TPamAccountTemplate }>(+ const { data } = await apiRequest.patch<{ template: TPamAccountTemplate; corsProbeUrl?: string | null }>(`/api/v1/pam/account-templates/${templateId}`,params);- return data.template;+ return { ...data.template, corsProbeUrl: data.corsProbeUrl };},onSuccess: () => {queryClient.invalidateQueries({ queryKey: pamKeys.template() });diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.tsindex e66d708de2..a3f95d0c79 100644--- a/frontend/src/hooks/api/pam/types/index.ts+++ b/frontend/src/hooks/api/pam/types/index.ts@@ -63,6 +63,10 @@ export enum PamAccountAccessibilityIssue {export const accountTypeRequiresRecording = (type: PamAccountType): boolean =>type === PamAccountType.Windows;+export type TPamAccountRecordingSettings = {+ s3Config?: { bucket: string; region: string; keyPrefix?: string };+};+export type TPamAccount = {id: string;name: string;@@ -77,6 +81,7 @@ export type TPamAccount = {gatewayId: string | null;gatewayPoolId: string | null;recordingConnectionId: string | null;+ recordingSettings: TPamAccountRecordingSettings | null;connectionDetails: Record<string, unknown>;// Non-secret credential fields onlycredentials: Record<string, unknown>;@@ -256,6 +261,7 @@ export type TUpdatePamAccountDTO = {gatewayId?: string | null;gatewayPoolId?: string | null;recordingConnectionId?: string | null;+ recordingSettings?: TPamAccountRecordingSettings | null;};export type TDeletePamAccountDTO = {diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsxindex e5fd14a2dc..f7c98268d4 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx@@ -3,6 +3,8 @@ import { useForm } from "react-hook-form";import { useQuery } from "@tanstack/react-query";import { Link, useNavigate } from "@tanstack/react-router";import {+ AlertTriangleIcon,+ DatabaseIcon,FolderOpen,MoreHorizontal,Network,@@ -14,6 +16,9 @@ import {import { createNotification } from "@app/components/notifications";import {+ Alert,+ AlertDescription,+ AlertTitle,Badge,Button,Card,@@ -29,6 +34,7 @@ import {DropdownMenuTrigger,GatewayPicker,IconButton,+ Input,Table,TableBody,TableCell,@@ -38,10 +44,12 @@ import {} from "@app/components/v3";import { Skeleton } from "@app/components/v3/generic/Skeleton";import { useOrganization, useUser } from "@app/context";+import { useListAppConnections } from "@app/hooks/api/appConnections";import { gatewayPoolsQueryKeys } from "@app/hooks/api/gateway-pools/queries";import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";import { useGetOrganizationGroups } from "@app/hooks/api/organization/queries";import {+ accountTypeRequiresRecording,PamAccountAccessibilityIssue,PamAccountType,TPamMember,@@ -73,6 +81,7 @@ import { TabWarningPing } from "../../components/TabWarningPing";import { AccountPlatformIcon } from "../../PamAccessPage/components/AccountPlatformIcon";import { AssignAccessModal, EditMemberTarget } from "./AssignAccessModal";import { EditAccountForm } from "./EditAccountForm";+import { RecordingConnectionPicker } from "./RecordingConnectionPicker";type Props = {isOpen: boolean;@@ -413,7 +422,14 @@ const PermissionsTab = ({);};-type OverridesForm = { gatewayId: string | null; gatewayPoolId: string | null };+type OverridesForm = {+ gatewayId: string | null;+ gatewayPoolId: string | null;+ recordingConnectionId: string | null;+ recordingBucket: string;+ recordingRegion: string;+ recordingKeyPrefix: string;+};const SettingsTab = ({accountId,@@ -426,17 +442,29 @@ const SettingsTab = ({const { data: template } = useGetPamAccountTemplate(account?.templateId);const { data: gateways } = useQuery(gatewaysQueryKeys.list());const { data: gatewayPools } = useQuery(gatewayPoolsQueryKeys.list());+ const { data: appConnections = [] } = useListAppConnections();const updateAccount = useUpdatePamAccount();const [showGatewayPicker, setShowGatewayPicker] = useState(false);+ const [showRecordingPicker, setShowRecordingPicker] = useState(false);++ const showRecordingOverride = account && accountTypeRequiresRecording(account.accountType);const {handleSubmit,reset,setValue,watch,+ register,formState: { isDirty }} = useForm<OverridesForm>({- defaultValues: { gatewayId: null, gatewayPoolId: null }+ defaultValues: {+ gatewayId: null,+ gatewayPoolId: null,+ recordingConnectionId: null,+ recordingBucket: "",+ recordingRegion: "",+ recordingKeyPrefix: ""+ }});useEffect(() => {@@ -446,8 +474,17 @@ const SettingsTab = ({useEffect(() => {if (account) {- reset({ gatewayId: account.gatewayId, gatewayPoolId: account.gatewayPoolId });+ const s3 = account.recordingSettings?.s3Config;+ reset({+ gatewayId: account.gatewayId,+ gatewayPoolId: account.gatewayPoolId,+ recordingConnectionId: account.recordingConnectionId,+ recordingBucket: s3?.bucket ?? "",+ recordingRegion: s3?.region ?? "",+ recordingKeyPrefix: s3?.keyPrefix ?? ""+ });setShowGatewayPicker(false);+ setShowRecordingPicker(false);}}, [account, reset]);@@ -464,7 +501,13 @@ const SettingsTab = ({const gatewayId = watch("gatewayId");const gatewayPoolId = watch("gatewayPoolId");- const isOverriding = Boolean(gatewayId || gatewayPoolId) || showGatewayPicker;+ const recordingConnId = watch("recordingConnectionId");+ const recordingBucket = watch("recordingBucket");+ const recordingRegion = watch("recordingRegion");+ const isGatewayOverriding = Boolean(gatewayId || gatewayPoolId) || showGatewayPicker;+ const hasRecordingOverride =+ Boolean(recordingConnId) || Boolean(recordingBucket) || Boolean(recordingRegion);+ const isRecordingOverriding = hasRecordingOverride || showRecordingPicker;const resolveGatewayLabel = (gwId?: string | null, poolId?: string | null) => {if (poolId) return gatewayPools?.find((p) => p.id === poolId)?.name ?? "Gateway pool";@@ -473,31 +516,79 @@ const SettingsTab = ({};const inheritedGatewayLabel = resolveGatewayLabel(template?.gatewayId, template?.gatewayPoolId);- const setGateway = (value: OverridesForm) => {+ const resolveConnectionName = (connId?: string | null) => {+ if (!connId) return "None";+ return appConnections.find((c) => c.id === connId)?.name ?? "AWS connection";+ };+ const inheritedRecordingLabel = resolveConnectionName(template?.recordingConnectionId);++ const setGateway = (value: { gatewayId: string | null; gatewayPoolId: string | null }) => {setValue("gatewayId", value.gatewayId, { shouldDirty: true });setValue("gatewayPoolId", value.gatewayPoolId, { shouldDirty: true });};- const removeOverride = () => {+ const removeGatewayOverride = () => {setGateway({ gatewayId: null, gatewayPoolId: null });setShowGatewayPicker(false);};+ const removeRecordingOverride = () => {+ setValue("recordingConnectionId", null, { shouldDirty: true });+ setValue("recordingBucket", "", { shouldDirty: true });+ setValue("recordingRegion", "", { shouldDirty: true });+ setValue("recordingKeyPrefix", "", { shouldDirty: true });+ setShowRecordingPicker(false);+ };+const discard = () => {reset();setShowGatewayPicker(false);+ setShowRecordingPicker(false);};const onSubmit = (values: OverridesForm) => {+ const bucket = values.recordingBucket.trim();+ const region = values.recordingRegion.trim();+ const keyPrefix = values.recordingKeyPrefix.trim();+ const hasS3Override = Boolean(bucket) || Boolean(region);+ const recordingSettings = hasS3Override+ ? {+ s3Config: {+ bucket,+ region,+ ...(keyPrefix ? { keyPrefix } : {})+ }+ }+ : null;+updateAccount.mutate({accountId,accountType: account.accountType,gatewayId: values.gatewayId,- gatewayPoolId: values.gatewayPoolId+ gatewayPoolId: values.gatewayPoolId,+ recordingConnectionId: values.recordingConnectionId,+ recordingSettings},{- onSuccess: () => createNotification({ type: "success", text: "Overrides updated" })+ onSuccess: async (result) => {+ createNotification({ type: "success", text: "Overrides updated" });+ const { corsProbeUrl } = result as { corsProbeUrl?: string | null };+ if (corsProbeUrl) {+ try {+ await fetch(corsProbeUrl, { mode: "cors" });+ } catch {+ createNotification(+ {+ title: "Bucket CORS not configured",+ type: "warning",+ text: "Session playback requires the bucket to allow GET requests from this origin. See the docs for CORS setup."+ },+ { autoClose: 10000 }+ );+ }+ }+ }});};@@ -509,9 +600,9 @@ const SettingsTab = ({<CardTitle className="text-base">Settings</CardTitle><CardDescription>System configuration overrides.</CardDescription></CardHeader>- <CardContent>+ <CardContent className="flex flex-col gap-4"><div- className={`rounded-md border p-4 ${isOverriding ? "border-product-pam/50" : "border-border"}`}+ className={`rounded-md border p-4 ${isGatewayOverriding ? "border-product-pam/50" : "border-border"}`}><div className="flex items-start justify-between gap-4"><div className="flex items-start gap-3">@@ -521,19 +612,19 @@ const SettingsTab = ({<div><p className="font-medium text-foreground">Gateway- {isOverriding && (+ {isGatewayOverriding && (<span className="ml-2 text-xs font-normal text-product-pam">(override)</span>)}</p><p className="text-sm text-muted">- {isOverriding+ {isGatewayOverriding? `Overriding the template default (${inheritedGatewayLabel}) for this account.`: `Inherited from ${account.templateName}: ${inheritedGatewayLabel}`}</p></div></div>- {isOverriding ? (- <Button type="button" size="sm" variant="ghost" onClick={removeOverride}>+ {isGatewayOverriding ? (+ <Button type="button" size="sm" variant="ghost" onClick={removeGatewayOverride}>Remove Override</Button>) : (@@ -549,7 +640,7 @@ const SettingsTab = ({)}</div>- {isOverriding && (+ {isGatewayOverriding && (<div className="mt-4"><GatewayPickervalue={{ gatewayId, gatewayPoolId }}@@ -559,6 +650,88 @@ const SettingsTab = ({</div>)}</div>++ {showRecordingOverride && (+ <div+ className={`rounded-md border p-4 ${isRecordingOverriding ? "border-product-pam/50" : "border-border"}`}+ >+ <div className="flex items-start justify-between gap-4">+ <div className="flex items-start gap-3">+ <div className="flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-container">+ <DatabaseIcon className="size-4 text-muted" />+ </div>+ <div>+ <p className="font-medium text-foreground">+ Recording Settings+ {isRecordingOverriding && (+ <span className="ml-2 text-xs font-normal text-product-pam">+ (override)+ </span>+ )}+ </p>+ <p className="text-sm text-muted">+ {isRecordingOverriding+ ? "Overriding the template recording config for this account."+ : `Inherited from ${account.templateName}: ${inheritedRecordingLabel}`}+ </p>+ </div>+ </div>+ {isRecordingOverriding ? (+ <Button type="button" size="sm" variant="ghost" onClick={removeRecordingOverride}>+ Remove Override+ </Button>+ ) : (+ <Button+ type="button"+ size="sm"+ variant="outline"+ onClick={() => setShowRecordingPicker(true)}+ >+ <SquarePen className="mr-1.5 size-3.5" />+ Override+ </Button>+ )}+ </div>++ {isRecordingOverriding && (+ <div className="mt-4 flex flex-col gap-3">+ <Alert variant="warning">+ <AlertTriangleIcon />+ <AlertTitle>Changing bucket affects existing recordings</AlertTitle>+ <AlertDescription>+ Changing the bucket makes existing recordings inaccessible unless you manually+ migrate the objects. Keep the same bucket and key prefix when rotating+ credentials.+ </AlertDescription>+ </Alert>+ <div>+ <p className="mb-1 text-sm text-muted">AWS Connection</p>+ <RecordingConnectionPicker+ value={recordingConnId}+ onChange={(v) => setValue("recordingConnectionId", v, { shouldDirty: true })}+ includeNone+ />+ </div>+ <div className="grid grid-cols-2 gap-3">+ <div>+ <p className="mb-1 text-sm text-muted">S3 Bucket</p>+ <Input placeholder="my-recordings-bucket" {...register("recordingBucket")} />+ </div>+ <div>+ <p className="mb-1 text-sm text-muted">Region</p>+ <Input placeholder="us-east-1" {...register("recordingRegion")} />+ </div>+ </div>+ <div>+ <p className="mb-1 text-sm text-muted">+ Key Prefix <span className="text-xs text-muted">(optional)</span>+ </p>+ <Input placeholder="recordings/" {...register("recordingKeyPrefix")} />+ </div>+ </div>+ )}+ </div>+ )}</CardContent></Card>diff --git a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsxindex 7233266f28..8283299255 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx@@ -62,7 +62,6 @@ import {import { ConnectionDetailsForm } from "./ConnectionDetailsForm";import { CreateFolderModal } from "./CreateFolderModal";import { CredentialsForm } from "./CredentialsForm";-import { RecordingConnectionPicker } from "./RecordingConnectionPicker";const CREATE_FOLDER_VALUE = "__create_folder__";@@ -85,9 +84,7 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: PrgatewayId: string | null;gatewayPoolId: string | null;}>({ gatewayId: null, gatewayPoolId: null });- const [recordingConnectionId, setRecordingConnectionId] = useState<string | null>(null);const [gatewayError, setGatewayError] = useState(false);- const [recordingError, setRecordingError] = useState(false);const {control,@@ -155,9 +152,7 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: PrsetStep(1);setTemplateSearch("");setGateway({ gatewayId: null, gatewayPoolId: null });- setRecordingConnectionId(null);setGatewayError(false);- setRecordingError(false);}}, [isOpen, defaultFolderId, reset]);@@ -168,9 +163,7 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: PrsetValue("connectionDetails", buildDefaultFieldValues(selectedMetadata.connectionFields));setValue("credentials", buildDefaultFieldValues(selectedMetadata.credentialFields));setGateway({ gatewayId: null, gatewayPoolId: null });- setRecordingConnectionId(null);setGatewayError(false);- setRecordingError(false);}, [selectedMetadata?.type, selectedTemplateId, setValue]);const canProceed = Boolean(selectedFolderId && selectedTemplateId);@@ -188,16 +181,9 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: Prvalues.credentials);const gatewayMissing = needsGateway && !gateway.gatewayId && !gateway.gatewayPoolId;- const recordingMissing = needsRecording && !recordingConnectionId;setGatewayError(gatewayMissing);- setRecordingError(recordingMissing);-- if (- missingConnection.length ||- missingCredentials.length ||- gatewayMissing ||- recordingMissing- ) {++ if (missingConnection.length || missingCredentials.length || gatewayMissing) {missingConnection.forEach((key) =>setError(`connectionDetails.${key}`, {type: "required",@@ -229,8 +215,7 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: PrconnectionDetails: values.connectionDetails,credentials: values.credentials,...(gateway.gatewayId ? { gatewayId: gateway.gatewayId } : {}),- ...(gateway.gatewayPoolId ? { gatewayPoolId: gateway.gatewayPoolId } : {}),- ...(recordingConnectionId ? { recordingConnectionId } : {})+ ...(gateway.gatewayPoolId ? { gatewayPoolId: gateway.gatewayPoolId } : {})},{onSuccess: () => {@@ -466,24 +451,18 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: Pr</Field>)}{needsRecording && (- <Field>- <FieldLabel>- Recording Bucket<span className="text-product-pam">*</span>- </FieldLabel>- <FieldContent>- <RecordingConnectionPicker- value={recordingConnectionId}- onChange={(value) => {- setRecordingConnectionId(value);- setRecordingError(false);- }}- isError={recordingError}- />- {recordingError && (- <FieldError>A recording bucket is required</FieldError>- )}- </FieldContent>- </Field>+ <div className="rounded-md border border-warning/40 bg-warning/5 p-3">+ <div className="flex items-start gap-2">+ <AlertTriangle className="mt-0.5 size-4 shrink-0 text-warning" />+ <div className="text-sm">+ <p className="font-medium text-warning">S3 recording not configured</p>+ <p className="mt-1 text-muted">+ This account type requires S3 recording. Configure it in the account+ template settings before creating an account.+ </p>+ </div>+ </div>+ </div>)}</div></div>@@ -500,7 +479,12 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: Pr<Button type="button" variant="ghost" onClick={() => setStep(1)}>Back</Button>- <Button type="submit" variant="pam" isPending={createAccount.isPending}>+ <Button+ type="submit"+ variant="pam"+ isPending={createAccount.isPending}+ isDisabled={needsRecording}+ >Create</Button></SheetFooter>diff --git a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsxindex f5cfa6ed60..16536723ec 100644--- a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx+++ b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx@@ -1,11 +1,14 @@import { useEffect, useState } from "react";import { Controller, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";-import { Ban } from "lucide-react";+import { AlertTriangleIcon, Ban } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {+ Alert,+ AlertDescription,+ AlertTitle,Card,CardContent,CardDescription,@@ -123,8 +126,7 @@ const ConfigurationTab = ({if (template) {const settings = (template.settings ?? {}) as Record<string, unknown>;const s3Config = (settings.recordingS3Config ?? {}) as Record<string, string>;- const isWin =- resolvePamAccountType(template.type) === PamAccountType.Windows;+ const isWin = resolvePamAccountType(template.type) === PamAccountType.Windows;const savedBackend = settings.recordingStorageBackend as "postgres" | "aws-s3" | undefined;reset({name: template.name,@@ -166,7 +168,24 @@ const ConfigurationTab = ({data.recordingStorageBackend === "aws-s3" ? data.recordingConnectionId : null},{- onSuccess: () => createNotification({ type: "success", text: "Template updated" })+ onSuccess: async (result) => {+ createNotification({ type: "success", text: "Template updated" });+ const { corsProbeUrl } = result as { corsProbeUrl?: string | null };+ if (corsProbeUrl) {+ try {+ await fetch(corsProbeUrl, { mode: "cors" });+ } catch {+ createNotification(+ {+ title: "Bucket CORS not configured",+ type: "warning",+ text: "Session playback requires the bucket to allow GET requests from this origin. See the docs for CORS setup."+ },+ { autoClose: 10000 }+ );+ }+ }+ }});};@@ -268,6 +287,16 @@ const ConfigurationTab = ({{storageBackend === "aws-s3" && (<>+ <Alert variant="warning">+ <AlertTriangleIcon />+ <AlertTitle>Changing bucket affects existing recordings</AlertTitle>+ <AlertDescription>+ Changing the bucket on a template with existing recordings makes those recordings+ inaccessible unless you manually migrate the objects. Keep the same bucket and key+ prefix when rotating credentials.+ </AlertDescription>+ </Alert>+<Controllername="recordingConnectionId"control={control}