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
move recording config to general in templates + other tweaks
x452bfbb0d315
diff --git a/backend/src/ee/services/pam-project/pam-project-bootstrap.ts b/backend/src/ee/services/pam-project/pam-project-bootstrap.tsindex 28a11b51b6..c41cf06294 100644--- a/backend/src/ee/services/pam-project/pam-project-bootstrap.ts+++ b/backend/src/ee/services/pam-project/pam-project-bootstrap.ts@@ -154,7 +154,7 @@ export const DEFAULT_ACCOUNT_TEMPLATES: TDefaultTemplate[] = [type: PamAccountType.Windows,settings: {recordingEnabled: true,- recordingStorageBackend: PamRecordingStorageBackend.AwsS3,+ recordingStorageBackend: PamRecordingStorageBackend.Postgres,passwordConstraints: {minLength: 14,maxLength: 127,@@ -170,7 +170,7 @@ export const DEFAULT_ACCOUNT_TEMPLATES: TDefaultTemplate[] = [type: PamAccountType.ActiveDirectory,settings: {recordingEnabled: true,- recordingStorageBackend: PamRecordingStorageBackend.AwsS3,+ recordingStorageBackend: PamRecordingStorageBackend.Postgres,passwordConstraints: {minLength: 14,maxLength: 127,diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.mdindex ed84ec0f68..f8c70bd50e 100644--- a/backend/src/ee/services/pam/CLAUDE.md+++ b/backend/src/ee/services/pam/CLAUDE.md@@ -128,6 +128,8 @@ Policies are the governance controls applied to a template (require MFA, require"Access policy" is the category, not a type: MFA, reason, and duration are individual peer policies that each `appliesTo: "all"`. `appliesTo` can also be a list to scope a policy to specific account types. This is distinct from **settings** (recording, password constraints), which are NOT policies, they live in the template's separate `settings` column with their own schema and bespoke UI.+In the template detail sheet (`frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx`), the **"General"** tab is for policies and system settings (gateway, session recording / storage backend, and similar template-level defaults); the **"Configuration"** tab is only for generic template metadata like name and description. When adding a new policy or setting, it belongs on the General tab, not Configuration.+Storage: a template's `policies` jsonb column is a flat map keyed by `PamPolicyType`, e.g. `{ "require-mfa": true, "max-session-duration": 3600 }`. No DB defaults and no per-policy migration: absence resolves to the policy's natural default in the resolver (a missing boolean is `false`, a missing duration falls back to `DEFAULT_SESSION_DURATION_MS`).A registry entry flows automatically to:diff --git a/docs/documentation/platform/pam/product-reference/external-storage.mdx b/docs/documentation/platform/pam/product-reference/external-storage.mdxindex 5a4d5d9add..b15c451666 100644--- a/docs/documentation/platform/pam/product-reference/external-storage.mdx+++ b/docs/documentation/platform/pam/product-reference/external-storage.mdx@@ -27,7 +27,7 @@ If you don't have one yet, follow the [AWS Connection guide](/integrations/app-c</Steps><Warning>-Changing the bucket or key prefix on a project that already has recordings makes those recordings inaccessible unless you manually migrate the objects. When rotating credentials, keep the same bucket and key prefix.+Changing the bucket or key prefix on a project that already has recordings makes those recordings inaccessible unless you manually migrate each object. When rotating credentials, keep the same bucket and key prefix.</Warning>## CORS Configurationdiff --git a/frontend/src/hooks/usePamSheetState.ts b/frontend/src/hooks/usePamSheetState.tsindex a53269ac63..32d620f9da 100644--- a/frontend/src/hooks/usePamSheetState.ts+++ b/frontend/src/hooks/usePamSheetState.ts@@ -5,7 +5,8 @@ export enum PamSheetTab {Launch = "launch",Permissions = "permissions",Configuration = "configuration",- Advanced = "advanced"+ Advanced = "advanced",+ General = "general"}export const pamSheetSearchParams = z.object({diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsxindex b4bf72a0a5..784d2acae7 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx@@ -710,7 +710,7 @@ const SettingsTab = ({<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+ migrate each object. Keep the same bucket and key prefix when rotatingcredentials.</AlertDescription></Alert>diff --git a/frontend/src/pages/pam/PamDataExplorerPage/components/FilterPopover.tsx b/frontend/src/pages/pam/PamDataExplorerPage/components/FilterPopover.tsxindex 47120f9751..e344439183 100644--- a/frontend/src/pages/pam/PamDataExplorerPage/components/FilterPopover.tsx+++ b/frontend/src/pages/pam/PamDataExplorerPage/components/FilterPopover.tsx@@ -193,7 +193,7 @@ export const FilterPopover = ({ columns, filters, onFiltersChange }: FilterPopov><SelectValue /></SelectTrigger>- <SelectContent>+ <SelectContent position="popper">{columns.map((col) => (<SelectItem key={col.name} value={col.name}>{col.name}@@ -211,7 +211,7 @@ export const FilterPopover = ({ columns, filters, onFiltersChange }: FilterPopov<SelectTrigger size="sm" className="w-28 text-xs text-foreground"><SelectValue /></SelectTrigger>- <SelectContent>+ <SelectContent position="popper">{OPERATORS.map((op) => (<SelectItem key={op.value} value={op.value}>{op.label}diff --git a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsxindex 3c5f9bbe26..6350791342 100644--- a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx+++ b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx@@ -48,22 +48,39 @@ import { AccountPlatformIcon } from "../../PamAccessPage/components/AccountPlatfconst configSchema = z.object({name: z.string().min(1, "Name is required").max(64),- description: z.string().max(256).optional(),- recordingStorageBackend: z.enum(["postgres", "aws-s3"]),- recordingConnectionId: z.string().nullable(),- s3Bucket: z.string().optional(),- s3Region: z.string().optional(),- s3KeyPrefix: z.string().optional()+ description: z.string().max(256).optional()});type ConfigForm = z.infer<typeof configSchema>;-const settingsSchema = z.object({- gatewayId: z.string().nullable(),- gatewayPoolId: z.string().nullable(),- recordingConnectionId: z.string().nullable(),- policies: z.record(z.unknown())-});+const settingsSchema = z+ .object({+ gatewayId: z.string().nullable(),+ gatewayPoolId: z.string().nullable(),+ recordingStorageBackend: z.enum(["postgres", "aws-s3"]),+ recordingConnectionId: z.string().nullable(),+ s3Bucket: z.string().optional(),+ s3Region: z.string().optional(),+ s3KeyPrefix: z.string().optional(),+ policies: z.record(z.unknown())+ })+ .superRefine((data, ctx) => {+ if (data.recordingStorageBackend !== "aws-s3") return;+ if (!data.recordingConnectionId) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["recordingConnectionId"],+ message: "Select an AWS connection"+ });+ }+ if (!data.s3Bucket?.trim()) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["s3Bucket"],+ message: "Bucket is required"+ });+ }+ });type SettingsForm = z.infer<typeof settingsSchema>;@@ -82,36 +99,20 @@ const ConfigurationTab = ({}) => {const { data: template, isLoading } = useGetPamAccountTemplate(templateId);const updateTemplate = useUpdatePamAccountTemplate();- const { currentProject } = useProject();- const { data: awsConnections = [] } = useListAvailableAppConnections(- AppConnection.AWS,- currentProject.id- );-- const requiresRecording = template?.type && accountTypeRequiresRecording(template.type);const {control,handleSubmit,reset,- watch,formState: { isDirty }} = useForm<ConfigForm>({resolver: zodResolver(configSchema),defaultValues: {name: "",- description: "",-- recordingStorageBackend: "postgres",- recordingConnectionId: null,- s3Bucket: "",- s3Region: "",- s3KeyPrefix: ""+ description: ""}});- const storageBackend = watch("recordingStorageBackend");-useEffect(() => {onDirtyChange?.(isDirty);return () => onDirtyChange?.(false);@@ -119,80 +120,22 @@ const ConfigurationTab = ({useEffect(() => {if (template) {- const settings = (template.settings ?? {}) as Record<string, unknown>;- const s3Config = (settings.recordingS3Config ?? {}) as Record<string, string>;- const requiresTemplateRecording = accountTypeRequiresRecording(template.type);- const savedBackend = settings.recordingStorageBackend as "postgres" | "aws-s3" | undefined;reset({name: template.name,- description: template.description ?? "",-- recordingStorageBackend: requiresTemplateRecording- ? "aws-s3"- : (savedBackend ?? "postgres"),- recordingConnectionId: (template.recordingConnectionId as string) ?? null,- s3Bucket: s3Config.bucket ?? "",- s3Region: s3Config.region ?? "",- s3KeyPrefix: s3Config.keyPrefix ?? ""+ description: template.description ?? ""});}}, [template, reset]);const onSubmit = (data: ConfigForm) => {- const settings: Record<string, unknown> = {- ...((template?.settings ?? {}) as Record<string, unknown>),-- recordingStorageBackend: data.recordingStorageBackend- };-- if (data.recordingStorageBackend === "aws-s3" && data.s3Bucket) {- settings.recordingS3Config = {- bucket: data.s3Bucket,- region: data.s3Region || "us-east-1",- ...(data.s3KeyPrefix ? { keyPrefix: data.s3KeyPrefix } : {})- };- } else {- delete settings.recordingS3Config;- }-updateTemplate.mutate({templateId,name: data.name,- description: data.description || null,- settings,- recordingConnectionId:- data.recordingStorageBackend === "aws-s3" ? data.recordingConnectionId : null+ description: data.description || null},{- 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.",- callToAction: (- <a- href="https://infisical.com/docs/documentation/platform/pam/recording-storage"- target="_blank"- rel="noopener noreferrer"- className="text-xs underline"- >- CORS setup docs- </a>- )- },- { autoClose: 10000 }- );- }- }- }+ onSuccess: () => createNotification({ type: "success", text: "Template updated" })});};@@ -246,126 +189,6 @@ const ConfigurationTab = ({</CardContent></Card>- <Card>- <CardHeader className="border-b">- <CardTitle className="text-base">Recording</CardTitle>- <CardDescription>Configure how sessions are recorded and stored.</CardDescription>- </CardHeader>- <CardContent className="flex flex-col gap-6">- <Controller- name="recordingStorageBackend"- control={control}- render={({ field }) => (- <Field>- <FieldLabel>Storage backend</FieldLabel>- <FieldContent>- <Select value={field.value} onValueChange={(v) => field.onChange(v)}>- <SelectTrigger>- <SelectValue />- </SelectTrigger>- <SelectContent>- {!requiresRecording && (- <SelectItem value="postgres">Internal Database (default)</SelectItem>- )}- <SelectItem value="aws-s3">AWS S3</SelectItem>- </SelectContent>- </Select>- <FieldDescription>- {requiresRecording- ? "RDP recordings require S3 storage."- : "Stores recordings in the database. S3 is recommended for large or long sessions."}- </FieldDescription>- </FieldContent>- </Field>- )}- />-- {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>-- <Controller- name="recordingConnectionId"- control={control}- render={({ field }) => (- <Field>- <FieldLabel>AWS Connection</FieldLabel>- <FieldContent>- <Select- value={field.value ?? ""}- onValueChange={(v) => field.onChange(v || null)}- >- <SelectTrigger>- <SelectValue placeholder="Select an AWS connection" />- </SelectTrigger>- <SelectContent>- {awsConnections.map((conn) => (- <SelectItem key={conn.id} value={conn.id}>- {conn.name}- </SelectItem>- ))}- </SelectContent>- </Select>- <FieldDescription>- The AWS connection used to authenticate with S3.- </FieldDescription>- </FieldContent>- </Field>- )}- />-- <Controller- name="s3Bucket"- control={control}- render={({ field }) => (- <Field>- <FieldLabel>S3 Bucket</FieldLabel>- <FieldContent>- <Input {...field} placeholder="my-recordings-bucket" />- </FieldContent>- </Field>- )}- />-- <Controller- name="s3Region"- control={control}- render={({ field }) => (- <Field>- <FieldLabel>Region</FieldLabel>- <FieldContent>- <Input {...field} placeholder="us-east-1" />- </FieldContent>- </Field>- )}- />-- <Controller- name="s3KeyPrefix"- control={control}- render={({ field }) => (- <Field>- <FieldLabel>Key prefix (optional)</FieldLabel>- <FieldContent>- <Input {...field} placeholder="pam-recordings/" />- <FieldDescription>Optional prefix for S3 object keys.</FieldDescription>- </FieldContent>- </Field>- )}- />- </>- )}- </CardContent>- </Card>-<div aria-hidden className="h-8 shrink-0" />{isDirty && <SheetSaveBar isPending={updateTemplate.isPending} onDiscard={() => reset()} />}</form>@@ -381,8 +204,15 @@ const SettingsTab = ({}) => {const { data: template, isLoading } = useGetPamAccountTemplate(templateId);const updateTemplate = useUpdatePamAccountTemplate();+ const { currentProject } = useProject();+ const { data: awsConnections = [] } = useListAvailableAppConnections(+ AppConnection.AWS,+ currentProject.id+ );+ const { map: accountTypeMap } = usePamAccountTypeMap();const {+ control,handleSubmit,reset,setValue,@@ -393,13 +223,15 @@ const SettingsTab = ({defaultValues: {gatewayId: null,gatewayPoolId: null,+ recordingStorageBackend: "postgres",recordingConnectionId: null,+ s3Bucket: "",+ s3Region: "",+ s3KeyPrefix: "",policies: {}}});- const { map: accountTypeMap } = usePamAccountTypeMap();-useEffect(() => {onDirtyChange?.(isDirty);return () => onDirtyChange?.(false);@@ -407,10 +239,17 @@ const SettingsTab = ({useEffect(() => {if (template) {+ const settings = (template.settings ?? {}) as Record<string, unknown>;+ const s3Config = (settings.recordingS3Config ?? {}) as Record<string, string>;+ const savedBackend = settings.recordingStorageBackend as "postgres" | "aws-s3" | undefined;reset({gatewayId: template.gatewayId ?? null,gatewayPoolId: template.gatewayPoolId ?? null,+ recordingStorageBackend: savedBackend ?? "postgres",recordingConnectionId: template.recordingConnectionId ?? null,+ s3Bucket: s3Config.bucket ?? "",+ s3Region: s3Config.region ?? "",+ s3KeyPrefix: s3Config.keyPrefix ?? "",policies: (template.policies as Record<string, unknown>) ?? {}});}@@ -431,20 +270,68 @@ const SettingsTab = ({const gatewayId = watch("gatewayId");const gatewayPoolId = watch("gatewayPoolId");const policies = watch("policies");+ const storageBackend = watch("recordingStorageBackend");+ const requiresRecording = accountTypeRequiresRecording(template.type);+ const typeName = accountTypeMap[template.type]?.name ?? template.type;const applicablePolicies = (accountTypeMap[template.type]?.applicablePolicies ?? []).filter((p) => POLICY_EDITORS[p.key]);const onSubmit = (data: SettingsForm) => {+ const settings: Record<string, unknown> = {+ ...((template.settings ?? {}) as Record<string, unknown>),+ recordingStorageBackend: data.recordingStorageBackend+ };++ if (data.recordingStorageBackend === "aws-s3" && data.s3Bucket) {+ settings.recordingS3Config = {+ bucket: data.s3Bucket,+ region: data.s3Region || "us-east-1",+ ...(data.s3KeyPrefix ? { keyPrefix: data.s3KeyPrefix } : {})+ };+ } else {+ delete settings.recordingS3Config;+ }+updateTemplate.mutate({templateId,policies: data.policies,gatewayId: data.gatewayId,- gatewayPoolId: data.gatewayPoolId+ gatewayPoolId: data.gatewayPoolId,+ settings,+ recordingConnectionId:+ 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.",+ callToAction: (+ <a+ href="https://infisical.com/docs/documentation/platform/pam/recording-storage"+ target="_blank"+ rel="noopener noreferrer"+ className="text-xs underline"+ >+ CORS setup docs+ </a>+ )+ },+ { autoClose: 10000 }+ );+ }+ }+ }});};@@ -456,8 +343,7 @@ const SettingsTab = ({<CardHeader className="border-b"><CardTitle className="text-base">Policies</CardTitle><CardDescription>- Policies available for {accountTypeMap[template.type]?.name ?? template.type} accounts- using this template.+ Policies available for {typeName} accounts using this template.</CardDescription></CardHeader><CardContent className="flex flex-col gap-6">@@ -487,7 +373,7 @@ const SettingsTab = ({<CardTitle className="text-base">System Settings</CardTitle><CardDescription>System-level defaults for accounts using this template.</CardDescription></CardHeader>- <CardContent className="flex flex-col gap-4">+ <CardContent className="flex flex-col gap-6"><Field><FieldLabel>Gateway</FieldLabel><FieldContent>@@ -508,6 +394,142 @@ const SettingsTab = ({</CardContent></Card>+ <Card>+ <CardHeader className="border-b">+ <CardTitle className="text-base">Session Recording</CardTitle>+ <CardDescription>+ Where session recordings for accounts using this template are stored.+ </CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-6">+ <Controller+ name="recordingStorageBackend"+ control={control}+ render={({ field }) => (+ <Field>+ <FieldLabel>Storage backend</FieldLabel>+ <FieldContent>+ <Select value={field.value} onValueChange={(v) => field.onChange(v)}>+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value="postgres">Internal Database</SelectItem>+ <SelectItem value="aws-s3">AWS S3</SelectItem>+ </SelectContent>+ </Select>+ </FieldContent>+ </Field>+ )}+ />++ {requiresRecording && storageBackend === "postgres" && (+ <Alert variant="warning">+ <AlertTriangleIcon />+ <AlertTitle>Accounts cannot be launched</AlertTitle>+ <AlertDescription>+ {typeName} accounts require an external recording storage backend. Accounts using+ this template can still be created, but sessions can't be launched until+ external storage is configured.+ </AlertDescription>+ </Alert>+ )}++ {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 each object. Keep the same bucket and key+ prefix when rotating credentials.+ </AlertDescription>+ </Alert>++ <Controller+ name="recordingConnectionId"+ control={control}+ render={({ field, fieldState }) => (+ <Field>+ <FieldLabel>AWS Connection</FieldLabel>+ <FieldContent>+ <Select+ value={field.value ?? ""}+ onValueChange={(v) => field.onChange(v || null)}+ >+ <SelectTrigger className="w-full" isError={!!fieldState.error}>+ <SelectValue placeholder="Select an AWS connection" />+ </SelectTrigger>+ <SelectContent position="popper">+ {awsConnections.map((conn) => (+ <SelectItem key={conn.id} value={conn.id}>+ {conn.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ {fieldState.error ? (+ <FieldError>{fieldState.error.message}</FieldError>+ ) : (+ <FieldDescription>+ The AWS connection used to authenticate with S3.+ </FieldDescription>+ )}+ </FieldContent>+ </Field>+ )}+ />++ <Controller+ name="s3Bucket"+ control={control}+ render={({ field, fieldState }) => (+ <Field>+ <FieldLabel>S3 Bucket</FieldLabel>+ <FieldContent>+ <Input+ {...field}+ placeholder="my-recordings-bucket"+ isError={!!fieldState.error}+ />+ <FieldError>{fieldState.error?.message}</FieldError>+ </FieldContent>+ </Field>+ )}+ />++ <Controller+ name="s3Region"+ control={control}+ render={({ field }) => (+ <Field>+ <FieldLabel>Region</FieldLabel>+ <FieldContent>+ <Input {...field} placeholder="us-east-1" />+ </FieldContent>+ </Field>+ )}+ />++ <Controller+ name="s3KeyPrefix"+ control={control}+ render={({ field }) => (+ <Field>+ <FieldLabel>Key prefix (optional)</FieldLabel>+ <FieldContent>+ <Input {...field} placeholder="pam-recordings/" />+ <FieldDescription>Optional prefix for S3 object keys.</FieldDescription>+ </FieldContent>+ </Field>+ )}+ />+ </>+ )}+ </CardContent>+ </Card>+<div aria-hidden className="h-8 shrink-0" />{isDirty && <SheetSaveBar isPending={updateTemplate.isPending} onDiscard={() => reset()} />}</form>@@ -535,7 +557,7 @@ export const TemplateDetailSheet = ({ isOpen, templateId, onOpenChange }: Props): [];const tabContent: Partial<Record<PamSheetTab, JSX.Element | null>> = {- [PamSheetTab.Advanced]: templateId ? (+ [PamSheetTab.General]: templateId ? (<SettingsTab templateId={templateId} onDirtyChange={setIsFormDirty} />) : null,[PamSheetTab.Configuration]: templateId ? (diff --git a/frontend/src/pages/pam/components/pamResourceTabs.ts b/frontend/src/pages/pam/components/pamResourceTabs.tsindex 1298586af8..e634d4bcb8 100644--- a/frontend/src/pages/pam/components/pamResourceTabs.ts+++ b/frontend/src/pages/pam/components/pamResourceTabs.ts@@ -47,7 +47,7 @@ export const PAM_FOLDER_TABS: PamResourceTab[] = [];export const PAM_TEMPLATE_TABS: PamResourceTab[] = [- { value: PamSheetTab.Advanced, label: "General", icon: Settings2 },+ { value: PamSheetTab.General, label: "General", icon: Settings2 },{ value: PamSheetTab.Configuration, label: "Configuration", icon: Settings }];