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
Merge remote-tracking branch 'origin/main' into PAM-279
Carlos Monastyrski589eb184c62d
diff --cc backend/src/@types/fastify.d.tsindex 61949f2dc6,9d3eeeeac3..3adfed76df--- a/backend/src/@types/fastify.d.ts+++ b/backend/src/@types/fastify.d.ts@@@ -36,8 -36,8 +36,9 @@@ import { TLdapConfigServiceFactory } frimport { TLicenseServiceFactory } from "@app/ee/services/license/license-service";import { TLicenseV2ServiceFactory } from "@app/ee/services/license-v2/license-v2-service";import { TOidcConfigServiceFactory } from "@app/ee/services/oidc/oidc-config-service";+ import { TPamAccessRequestServiceFactory } from "@app/ee/services/pam-access-request/pam-access-request-service";import { TPamAccountServiceFactory } from "@app/ee/services/pam-account/pam-account-service";+import { TPamAccountRotationServiceFactory } from "@app/ee/services/pam-account-rotation/pam-account-rotation-service";import { TPamAccountTemplateServiceFactory } from "@app/ee/services/pam-account-template/pam-account-template-service";import { TPamFolderServiceFactory } from "@app/ee/services/pam-folder/pam-folder-service";import { TPamMembershipServiceFactory } from "@app/ee/services/pam-membership/pam-membership-service";diff --cc backend/src/ee/services/audit-log/audit-log-types.tsindex c9be867059,0ea4d27a2a..896c9d03e7--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@@ -743,9 -744,11 +744,13 @@@ export enum EventTypePAM_ACCOUNT_UPDATE = "pam-account-update",PAM_ACCOUNT_DELETE = "pam-account-delete",PAM_ACCOUNT_SSH_CA_CREATE = "pam-account-ssh-ca-create",+ PAM_ACCOUNT_ROTATE_CREDENTIALS = "pam-account-rotate-credentials",+ PAM_ACCOUNT_SET_ROTATION_ACCOUNT = "pam-account-set-rotation-account",PAM_WEB_ACCESS_SESSION_TICKET_CREATED = "pam-web-access-session-ticket-created",+ PAM_ACCESS_REQUEST_CREATE = "pam-access-request-create",+ PAM_ACCESS_REQUEST_REVIEW = "pam-access-request-review",+ PAM_ACCESS_GRANT_REVOKE = "pam-access-grant-revoke",+ PAM_APPROVAL_CONFIG_UPDATE = "pam-approval-config-update",APPROVAL_POLICY_CREATE = "approval-policy-create",APPROVAL_POLICY_UPDATE = "approval-policy-update",APPROVAL_POLICY_DELETE = "approval-policy-delete",@@@ -6127,26 -6140,47 +6142,67 @@@ interface PamAccountSshCaCreateEvent};}+interface PamAccountRotateCredentialsEvent {+ type: EventType.PAM_ACCOUNT_ROTATE_CREDENTIALS;+ metadata: {+ accountId: string;+ accountType: string;+ rotationStatus: string;+ manual: boolean;+ rotationAccountId?: string | null;+ message?: string;+ };+}++interface PamAccountSetRotationAccountEvent {+ type: EventType.PAM_ACCOUNT_SET_ROTATION_ACCOUNT;+ metadata: {+ accountId: string;+ rotationAccountId: string | null;+ };+}++ interface PamAccessRequestCreateEvent {+ type: EventType.PAM_ACCESS_REQUEST_CREATE;+ metadata: {+ requestId: string;+ accountId: string;+ folderId: string;+ duration: string;+ reason?: string;+ };+ }++ interface PamAccessRequestReviewEvent {+ type: EventType.PAM_ACCESS_REQUEST_REVIEW;+ metadata: {+ requestId: string;+ accountId?: string;+ folderId?: string;+ status: string;+ comment?: string;+ };+ }++ interface PamAccessGrantRevokeEvent {+ type: EventType.PAM_ACCESS_GRANT_REVOKE;+ metadata: {+ requestId: string;+ grantId: string;+ accountId?: string;+ folderId?: string;+ };+ }++ interface PamApprovalConfigUpdateEvent {+ type: EventType.PAM_APPROVAL_CONFIG_UPDATE;+ metadata: {+ folderId: string;+ policyId: string | null;+ stepCount: number;+ };+ }+interface UpdateCertificateRenewalConfigEvent {type: EventType.UPDATE_CERTIFICATE_RENEWAL_CONFIG;metadata: {@@@ -7781,8 -7816,10 +7838,12 @@@ export type Event| PamAccountUpdateEvent| PamAccountDeleteEvent| PamAccountSshCaCreateEvent+ | PamAccountRotateCredentialsEvent+ | PamAccountSetRotationAccountEvent+ | PamAccessRequestCreateEvent+ | PamAccessRequestReviewEvent+ | PamAccessGrantRevokeEvent+ | PamApprovalConfigUpdateEvent| UpdateCertificateRenewalConfigEvent| UpdateCertificateMetadataEvent| DisableCertificateRenewalConfigEventdiff --cc backend/src/ee/services/pam-account/pam-account-service.tsindex 71dd5fe859,a16180963a..1307a350c4--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@@ -35,8 -36,8 +36,9 @@@ importvalidateGatewayAttachment,validateRecordingConnection} from "../pam/pam-validators";+ import { TPamAccessRequestServiceFactory } from "../pam-access-request/pam-access-request-service";import { TPamAccountTemplateDALFactory } from "../pam-account-template/pam-account-template-dal";+import { PamTemplateSettingsSchema } from "../pam-account-template/pam-account-template-schemas";import { TPamFolderDALFactory } from "../pam-folder/pam-folder-dal";import { TPamAccountDALFactory } from "./pam-account-dal";import {@@@ -71,48 -73,12 +74,52 @@@ type TPamAccountServiceFactoryDep =gatewayV2DAL: Pick<TGatewayV2DALFactory, "findOne">;gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveAttachableGatewayFromPool">;appConnectionDAL: Pick<TAppConnectionDALFactory, "findOne" | "findById">;+ pamAccessRequestService: Pick<+ TPamAccessRequestServiceFactory,+ "getAccessStatusBatch" | "getFolderPolicyConfigured" | "cleanupAccountResources"+ >;};+const assertPasswordMeetsRequirements = (credentials: unknown, templateSettings: unknown) => {+ const requirements = PamTemplateSettingsSchema.safeParse(templateSettings).data?.passwordRequirements;+ const { password } = credentials as { password?: string };+ if (!requirements || !password) return;++ let upper = 0;+ let lower = 0;+ let digit = 0;+ let symbol = 0;+ const allowed = requirements.allowedSymbols ? new Set(requirements.allowedSymbols.split("")) : null;+ const disallowed = new Set<string>();+ for (const ch of password) {+ if (ch >= "A" && ch <= "Z") upper += 1;+ else if (ch >= "a" && ch <= "z") lower += 1;+ else if (ch >= "0" && ch <= "9") digit += 1;+ else {+ symbol += 1;+ if (allowed && !allowed.has(ch)) disallowed.add(ch);+ }+ }++ const violations: string[] = [];+ if (password.length < requirements.length) violations.push(`be at least ${requirements.length} characters long`);+ if (upper < requirements.required.uppercase)+ violations.push(`include at least ${requirements.required.uppercase} uppercase letter(s)`);+ if (lower < requirements.required.lowercase)+ violations.push(`include at least ${requirements.required.lowercase} lowercase letter(s)`);+ if (digit < requirements.required.digits)+ violations.push(`include at least ${requirements.required.digits} number(s)`);+ if (symbol < requirements.required.symbols)+ violations.push(`include at least ${requirements.required.symbols} symbol(s)`);+ if (allowed && disallowed.size > 0) violations.push(`only use these symbols: ${requirements.allowedSymbols}`);++ if (violations.length > 0) {+ throw new BadRequestError({+ message: `Password does not meet this template's requirements: it must ${violations.join(", ")}.`+ });+ }+};+export type TPamAccountServiceFactory = ReturnType<typeof pamAccountServiceFactory>;export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) => {@@@ -499,65 -488,29 +564,70 @@@ctx);- return pamAccountDAL.transaction(async (tx) => {- const memberships = await membershipDAL.find(- {- scope: RESOURCE_SCOPE,- scopeResourceType: ResourceType.PamAccount,- scopeResourceId: accountId- },- { tx }- );+ try {+ return await pamAccountDAL.transaction(async (tx) => {+ const memberships = await membershipDAL.find(+ {+ scope: RESOURCE_SCOPE,+ scopeResourceType: ResourceType.PamAccount,+ scopeResourceId: accountId+ },+ { tx }+ );- if (memberships.length > 0) {- const ids = memberships.map((m) => m.id);- await membershipRoleDAL.delete({ $in: { membershipId: ids } }, tx);- await membershipDAL.delete({ $in: { id: ids } }, tx);- }+ if (memberships.length > 0) {+ const ids = memberships.map((m) => m.id);+ await membershipRoleDAL.delete({ $in: { membershipId: ids } }, tx);+ await membershipDAL.delete({ $in: { id: ids } }, tx);+ }- await deps.pamAccessRequestService.cleanupAccountResources(- { accountId, folderId: existing.folderId, projectId, actorId: ctx.actorId },- tx- );+ await pamAccountDAL.updateById(accountId, { rotationAccountId: null }, tx);- return pamAccountDAL.deleteById(accountId, tx);- });++ await deps.pamAccessRequestService.cleanupAccountResources(++ { accountId, folderId: existing.folderId, projectId, actorId: ctx.actorId },++ tx++ );+++ return pamAccountDAL.deleteById(accountId, tx);+ });+ } catch (err) {+ // The ON DELETE RESTRICT FK on rotationAccountId is the race-safe guard; on violation, look up the dependents+ // to name them (rather than paying for that lookup on every delete).+ if (+ err instanceof DatabaseError &&+ (err.error as { code?: string })?.code === DatabaseErrorCode.ForeignKeyViolation+ ) {+ const dependents = (await pamAccountDAL.find({ rotationAccountId: accountId })).filter(+ (dependent) => dependent.id !== accountId+ );+ const readChecks = await Promise.all(+ dependents.map(async (dependent) => ({+ name: dependent.name,+ canRead: await checkAccount(+ dependent.id,+ dependent.folderId,+ projectId,+ ResourcePermissionPamResourceActions.ReadAccounts,+ ctx+ )+ .then(() => true)+ .catch(() => false)+ }))+ );+ const readableNames = readChecks.filter((c) => c.canRead).map((c) => c.name);+ const hiddenCount = readChecks.length - readableNames.length;+ const parts = [+ ...(readableNames.length ? [readableNames.join(", ")] : []),+ ...(hiddenCount ? [`${hiddenCount} other account${hiddenCount > 1 ? "s" : ""}`] : [])+ ];+ throw new BadRequestError({+ message: parts.length+ ? `This account is the rotation account for: ${parts.join(", and ")}. Reassign or clear their rotation account before deleting this one.`+ : "This account is used as the rotation account for another account. Reassign it before deleting this one."+ });+ }+ throw err;+ }};const listAccessible = async ({diff --cc backend/src/server/routes/index.tsindex 5e4fde53fb,d3045cdc59..218550ae98--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@@ -105,10 -105,9 +105,11 @@@ import { licenseV2ServiceFactory } froimport { oidcConfigDALFactory } from "@app/ee/services/oidc/oidc-config-dal";import { oidcConfigServiceFactory } from "@app/ee/services/oidc/oidc-config-service";import { pamAuditLogScopeResolverFactory } from "@app/ee/services/pam/pam-audit-log-fns";+ import { pamAccessRequestServiceFactory } from "@app/ee/services/pam-access-request/pam-access-request-service";import { pamAccountDALFactory } from "@app/ee/services/pam-account/pam-account-dal";import { pamAccountServiceFactory } from "@app/ee/services/pam-account/pam-account-service";+import { pamAccountRotationQueueServiceFactory } from "@app/ee/services/pam-account-rotation/pam-account-rotation-queue";+import { pamAccountRotationServiceFactory } from "@app/ee/services/pam-account-rotation/pam-account-rotation-service";import { pamAccountTemplateDALFactory } from "@app/ee/services/pam-account-template/pam-account-template-dal";import { pamAccountTemplateServiceFactory } from "@app/ee/services/pam-account-template/pam-account-template-service";import { pamFolderDALFactory } from "@app/ee/services/pam-folder/pam-folder-dal";@@@ -1820,29 -1855,10 +1858,22 @@@ export const registerRoutes = asynckmsService,gatewayV2DAL,gatewayPoolService,- appConnectionDAL+ appConnectionDAL,+ pamAccessRequestService});+ const pamAccountRotationService = pamAccountRotationServiceFactory({+ pamAccountDAL,+ permissionService,+ membershipDAL,+ membershipRoleDAL,+ kmsService,+ keyStore,+ gatewayService,+ gatewayV2Service,+ gatewayPoolService+ });+- const pamSessionDAL = pamSessionDALFactory(db);- const pamSessionEventChunkDAL = pamSessionEventChunkDALFactory(db);-- const pamSessionExpirationService = pamSessionExpirationServiceFactory({- queueService,- pamSessionDAL- });-const pamSessionService = pamSessionServiceFactory({pamSessionDAL,pamAccountDAL,diff --cc frontend/src/hooks/api/pam/enums.tsindex 93caca5dd1,5524229b3d..3e78fcd586--- a/frontend/src/hooks/api/pam/enums.ts+++ b/frontend/src/hooks/api/pam/enums.ts@@@ -12,36 -12,8 +12,37 @@@ export enum PamAccountTypeWindowsAd = "windows-ad"}+export const ROTATABLE_PAM_ACCOUNT_TYPES = [+ PamAccountType.Postgres,+ PamAccountType.MySQL,+ PamAccountType.MsSQL+];++export const isRotatablePamAccountType = (type: PamAccountType | string) =>+ (ROTATABLE_PAM_ACCOUNT_TYPES as string[]).includes(type);++export const PAM_ROTATION_INTERVAL_OPTIONS: { seconds: number; label: string }[] = [+ { seconds: 3600, label: "1 hour" },+ { seconds: 43200, label: "12 hours" },+ { seconds: 86400, label: "24 hours" },+ { seconds: 604800, label: "7 days" },+ { seconds: 2592000, label: "30 days" }+];++export const formatRotationInterval = (seconds: number | null | undefined): string => {+ if (seconds == null) return "Manual only";+ const preset = PAM_ROTATION_INTERVAL_OPTIONS.find((option) => option.seconds === seconds);+ if (preset) return preset.label;+ const hours = Math.round(seconds / 3600);+ if (hours % 24 === 0) {+ const days = hours / 24;+ return days === 1 ? "1 day" : `${days} days`;+ }+ return hours === 1 ? "1 hour" : `${hours} hours`;+};+export enum PamPolicyType {+ RequiresApproval = "requires-approval",RequireMfa = "require-mfa",RequireReason = "require-reason",MaxSessionDuration = "max-session-duration",diff --cc frontend/src/hooks/api/pam/mutations.tsxindex 4835d15ea2,9ad99da979..c5c77e707d--- a/frontend/src/hooks/api/pam/mutations.tsx+++ b/frontend/src/hooks/api/pam/mutations.tsx@@@ -29,7 -30,9 +30,10 @@@ importTRemoveFolderIdentityMemberDTO,TRemoveFolderMemberDTO,TRemovePamProductIdentityMemberDTO,+ TReviewPamAccessRequestDTO,+ TRevokePamAccessRequestDTO,+ TRotatePamAccountDTO,+ TSetPamApprovalConfigDTO,TUpdateAccountGroupMemberRoleDTO,TUpdateAccountIdentityMemberRoleDTO,TUpdateAccountMemberRoleDTO,@@@ -563,30 -599,66 +601,94 @@@ export const useRemoveFolderIdentityMem});};+export const useUpdatePamAccountRotation = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ accountId, ...params }: TUpdatePamAccountRotationDTO) => {+ const { data } = await apiRequest.patch(`/api/v1/pam/accounts/${accountId}/rotation`, params);+ return data;+ },+ onSuccess: (_, { accountId }) => {+ queryClient.invalidateQueries({ queryKey: pamKeys.accountRotation(accountId) });+ queryClient.invalidateQueries({ queryKey: pamKeys.getAccount(accountId) });+ }+ });+};++ // Access Requests / Approvals++ export const useCreatePamAccessRequest = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async (params: TCreatePamAccessRequestDTO) => {+ const { data } = await apiRequest.post("/api/v1/pam/access-requests", params);+ return data;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: pamKeys.accessRequest() });+ queryClient.invalidateQueries({ queryKey: [...pamKeys.account(), "accessible"] });+ }+ });+ };++export const useRotatePamAccount = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ accountId }: TRotatePamAccountDTO) => {+ const { data } = await apiRequest.post(`/api/v1/pam/accounts/${accountId}/rotation/rotate`);+ return data;+ },+ onSuccess: (_, { accountId }) => {+ queryClient.invalidateQueries({ queryKey: pamKeys.accountRotation(accountId) });+ queryClient.invalidateQueries({ queryKey: pamKeys.getAccount(accountId) });+ }+ });+};+++ export const useReviewPamAccessRequest = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ requestId, status, comment }: TReviewPamAccessRequestDTO) => {+ const { data } = await apiRequest.post(`/api/v1/pam/access-requests/${requestId}/review`, {+ status,+ comment+ });+ return data;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: pamKeys.accessRequest() });+ queryClient.invalidateQueries({ queryKey: [...pamKeys.account(), "accessible"] });+ }+ });+ };++ export const useRevokePamAccessRequest = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ requestId }: TRevokePamAccessRequestDTO) => {+ const { data } = await apiRequest.post(`/api/v1/pam/access-requests/${requestId}/revoke`);+ return data;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: pamKeys.accessRequest() });+ queryClient.invalidateQueries({ queryKey: [...pamKeys.account(), "accessible"] });+ }+ });+ };++ export const useSetPamApprovalConfig = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ folderId, steps }: TSetPamApprovalConfigDTO) => {+ const { data } = await apiRequest.put(+ `/api/v1/pam/folders/${folderId}/approval-configuration`,+ { steps }+ );+ return data;+ },+ onSuccess: (_, { folderId }) => {+ queryClient.invalidateQueries({ queryKey: pamKeys.approvalConfig(folderId) });+ queryClient.invalidateQueries({ queryKey: pamKeys.account() });+ }+ });+ };diff --cc frontend/src/hooks/api/pam/queries.tsxindex b09dde156b,0aba8d8d10..5b7d815315--- a/frontend/src/hooks/api/pam/queries.tsx+++ b/frontend/src/hooks/api/pam/queries.tsx@@@ -19,8 -25,8 +25,9 @@@ importTAccessiblePamAccount,TListAccessiblePamAccountsDTO,TListPamAccountTemplatesDTO,+ TPamAccessRequest,TPamAccount,+ TPamAccountRotation,TPamAccountTemplateDetail,TPamAccountTemplateWithCount,TPamAccountTypeMetadata,@@@ -71,9 -77,19 +79,22 @@@ export const pamKeys =resourceRoles: () => [...pamKeys.all, "resource-roles"] as const,accessCapabilities: () => [...pamKeys.all, "access-capabilities"] as const,accountTypes: () => [...pamKeys.all, "account-types"] as const,+ accountRotation: (accountId: string) => [...pamKeys.account(), "rotation", accountId] as const,+ rotationCandidates: (accountId: string) =>- [...pamKeys.account(), "rotation-candidates", accountId] as const++ [...pamKeys.account(), "rotation-candidates", accountId] as const,+ accessRequest: () => [...pamKeys.all, "access-request"] as const,+ pendingMyApproval: (params?: { folderId?: string }) =>+ [...pamKeys.accessRequest(), "pending-my-approval", params] as const,+ accessRequestCount: () => [...pamKeys.accessRequest(), "count"] as const,+ accountApprovers: (accountId: string) =>+ [...pamKeys.accessRequest(), "account-approvers", accountId] as const,+ listAccessRequests: (params?: {+ folderId?: string;+ status?: string;+ offset?: number;+ limit?: number;+ }) => [...pamKeys.accessRequest(), "list", params] as const,+ approvalConfig: (folderId: string) => [...pamKeys.all, "approval-config", folderId] as const};const fetchFolderPermissions = async (folderId: string) => {diff --cc frontend/src/hooks/api/pam/types/index.tsindex c786e6820f,5f921b290a..29ce7c7edb--- a/frontend/src/hooks/api/pam/types/index.ts+++ b/frontend/src/hooks/api/pam/types/index.ts@@@ -460,37 -466,81 +469,116 @@@ export type TRemovePamProductIdentityMeprojectId: string;};+// Credential rotation++export type TPamPasswordRequirements = {+ length: number;+ required: { lowercase: number; uppercase: number; digits: number; symbols: number };+ allowedSymbols?: string;+};++export type TPamAccountRotation = {+ enabled: boolean;+ intervalSeconds: number | null;+ passwordRequirements: TPamPasswordRequirements | null;+ rotationAccountId: string | null;+ rotationAccountName: string | null;+ lastRotatedAt: string | null;+ rotationStatus: string | null;+ lastRotationError: string | null;+ isReady: boolean;+};++export type TPamRotationCandidateGroup = {+ folderId: string | null;+ folderName: string | null;+ accounts: { id: string; name: string; host: string }[];+};++export type TUpdatePamAccountRotationDTO = {+ accountId: string;+ rotationAccountId: string | null;+};++export type TRotatePamAccountDTO = {+ accountId: string;+};+++ // Access Requests / Approvals++ export type TPamAccessRequest = {+ id: string;+ projectId: string;+ policyId: string;+ requesterId: string | null;+ requesterName: string;+ requesterEmail: string;+ type: string;+ status: string;+ justification: string | null;+ currentStep: number;+ requestData: {+ version: number;+ requestData: {+ accountId: string;+ folderId: string;+ reason?: string;+ duration: string;+ };+ } | null;+ expiresAt: string | null;+ scopeType: string | null;+ scopeId: string | null;+ createdAt: string;+ updatedAt: string;+ // joined fields (populated by backend list endpoints)+ accountName?: string;+ accountType?: PamAccountType;+ folderName?: string;+ host?: string;+ grantExpiresAt?: string | null;+ grantStatus?: string | null;+ };++ export type TPamApprovalConfig = {+ steps: {+ approvers: { type: PamApproverType; id: string }[];+ }[];+ };++ export type TPamAccessGrant = {+ id: string;+ requestId: string;+ granteeUserId: string | null;+ status: string;+ expiresAt: string | null;+ revokedAt: string | null;+ attributes: {+ accountId?: string;+ folderId?: string;+ } | null;+ createdAt: string;+ };++ export type TCreatePamAccessRequestDTO = {+ accountId: string;+ reason?: string;+ duration: string;+ };++ export type TReviewPamAccessRequestDTO = {+ requestId: string;+ status: PamAccessRequestDecision;+ comment?: string;+ };++ export type TRevokePamAccessRequestDTO = {+ requestId: string;+ };++ export type TSetPamApprovalConfigDTO = {+ folderId: string;+ steps: {+ approvers: { type: PamApproverType; id: string }[];+ }[];+ };diff --cc frontend/src/hooks/usePamSheetState.tsindex 1ce32f8d1e,7ed60f1c48..7123021f3a--- a/frontend/src/hooks/usePamSheetState.ts+++ b/frontend/src/hooks/usePamSheetState.ts@@@ -7,7 -7,7 +7,8 @@@ export enum PamSheetTabConfiguration = "configuration",Advanced = "advanced",General = "general",- Rotation = "rotation"++ Rotation = "rotation",+ Approvals = "approvals"}export const pamSheetSearchParams = z.object({diff --cc frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsxindex 6a55f8d927,c318b1fe1a..78e37d7b32--- a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx+++ b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx@@@ -499,196 -380,34 +499,194 @@@ const SettingsTab = (return (<form onSubmit={handleSubmit(onSubmit)} className="flex flex-1 flex-col gap-4 p-4">- {applicablePolicies.length > 0 && (- <Card>- <CardHeader className="border-b">- <CardTitle className="text-base">Policies</CardTitle>- <CardDescription>- Policies available for {typeName} accounts using this template.- </CardDescription>- </CardHeader>- <CardContent className="flex flex-col gap-6">- {applicablePolicies.map((p) => {- const Editor = POLICY_EDITORS[p.key]!;- return (- <Editor- key={p.key}- label={p.label}- description={p.description}- value={policies[p.key]}- onChange={(value) => {- const next = { ...policies };- if (value === null || value === undefined) delete next[p.key];- else next[p.key] = value;- setValue("policies", next, { shouldDirty: true });- }}- />- );- })}- </CardContent>- </Card>- )}+ <Card>+ <CardHeader className="border-b">+ <CardTitle className="text-base">Policies</CardTitle>+ <CardDescription>+ Policies available for {typeName} accounts using this template.+ </CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-6">+ {applicablePolicies.map((p) => {+ const Editor = POLICY_EDITORS[p.key]!;+ return (+ <Editor+ key={p.key}+ label={p.label}+ description={p.description}+ value={policies[p.key]}+ onChange={(value) => {+ const next = { ...policies };+ if (value === null || value === undefined) delete next[p.key];+ else next[p.key] = value;+ setValue("policies", next, { shouldDirty: true });+ }}+ />+ );+ })}+ </CardContent>+ </Card>+ {isRotatableTemplateType && (+ <Card>+ <CardHeader className="border-b">+ <CardTitle className="text-base">Credential settings</CardTitle>+ <CardDescription>+ How credentials for accounts using this template are rotated, and the format of the+ generated passwords.+ </CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-4">+ {/* Requirements are a policy independent of rotation: they apply to onboarded credentials and to the+ passwords generated during rotation, so they show whether or not automatic rotation is on. */}+ <div>+ <p className="text-sm font-medium text-foreground">Requirements</p>+ <p className="text-xs text-muted">+ Every credential must meet these rules, both when an account is onboarded and when a+ password is generated during rotation.+ </p>+ </div>+ <div className="grid grid-cols-2 gap-3">+ {(+ [+ { name: "settings.pwLength", label: "Min length" },+ { name: "settings.pwUppercase", label: "Min uppercase" },+ { name: "settings.pwLowercase", label: "Min lowercase" },+ { name: "settings.pwDigits", label: "Min numbers" },+ { name: "settings.pwSymbols", label: "Min symbols" }+ ] as const+ ).map(({ name, label }) => (+ <Controller+ key={name}+ control={control}+ name={name}+ render={({ field, fieldState }) => (+ <Field>+ <FieldLabel>{label}</FieldLabel>+ <Input+ type="number"+ value={field.value ?? 0}+ onChange={(e) => field.onChange(Number(e.target.value))}+ onWheel={(e) => e.currentTarget.blur()}+ />+ {fieldState.error && <FieldError>{fieldState.error.message}</FieldError>}+ </Field>+ )}+ />+ ))}+ </div>+ <Controller+ control={control}+ name="settings.pwAllowedSymbols"+ render={({ field }) => (+ <Field>+ <FieldLabel>Allowed symbols</FieldLabel>+ <Input value={field.value ?? ""} onChange={field.onChange} placeholder="-_.~!*" />+ <FieldDescription>+ Symbols a credential may use. Quotes, backticks, backslashes, semicolons, and+ question marks are not allowed.+ </FieldDescription>+ </Field>+ )}+ />+ <div className="flex flex-col gap-4 border-t border-border pt-4">+ <Controller+ control={control}+ name="settings.rotationEnabled"+ render={({ field }) => (+ <div className="flex items-center justify-between gap-3">+ <div>+ <p className="text-sm font-medium text-foreground">+ Automatically rotate credentials+ </p>+ <p className="text-xs text-muted">+ Infisical rotates credentials on a fixed schedule. When off, credentials+ rotate only when triggered manually.+ </p>+ </div>+ <Switch+ variant="pam"+ checked={field.value ?? false}+ onCheckedChange={field.onChange}+ />+ </div>+ )}+ />+ {rotationEnabled &&+ template.rotationImpact &&+ (template.rotationImpact.needsRotationAccount > 0 ? (+ <Alert variant="warning">+ <AlertTriangleIcon />+ <AlertTitle>+ {template.rotationImpact.needsRotationAccount}{" "}+ {template.rotationImpact.needsRotationAccount === 1 ? "account" : "accounts"}{" "}+ won't rotate yet+ </AlertTitle>+ <AlertDescription>+ Set a rotation account on{" "}+ {template.rotationImpact.needsRotationAccount === 1 ? "it" : "them"} to enable+ rotation.+ {template.rotationImpact.willRotate > 0 &&+ ` ${template.rotationImpact.willRotate} ${+ template.rotationImpact.willRotate === 1 ? "account is" : "accounts are"+ } ready to rotate.`}+ </AlertDescription>+ </Alert>+ ) : (+ // Nothing misconfigured: only surface while editing; the warning above always shows (actionable gap).+ isDirty && (+ <Alert variant="info">+ <InfoIcon />+ <AlertTitle>+ {template.rotationImpact.willRotate === 0+ ? "No accounts to rotate yet"+ : `${template.rotationImpact.willRotate} ${+ template.rotationImpact.willRotate === 1 ? "account" : "accounts"+ } will rotate`}+ </AlertTitle>+ <AlertDescription>+ {template.rotationImpact.willRotate === 0+ ? "Accounts using this template will rotate once they have a rotation account."+ : "Every account using this template has a rotation account."}+ </AlertDescription>+ </Alert>+ )+ ))}+ {rotationEnabled && (+ <Controller+ control={control}+ name="settings.rotationIntervalSeconds"+ render={({ field }) => (+ <Field>+ <FieldLabel>Rotate every</FieldLabel>+ <Select+ value={String(field.value ?? 86400)}+ onValueChange={(value) => field.onChange(Number(value))}+ >+ <SelectTrigger>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ {PAM_ROTATION_INTERVAL_OPTIONS.map((option) => (+ <SelectItem key={option.seconds} value={String(option.seconds)}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <FieldDescription>+ How often credentials are rotated automatically for accounts using this+ template.+ </FieldDescription>+ </Field>+ )}+ />+ )}+ </div>+ </CardContent>+ </Card>+ )}+{showGatewaySettings && (<Card><CardHeader className="border-b">diff --cc frontend/src/pages/pam/components/pamResourceTabs.tsindex a656bc71e3,0ae6286cde..41a6092c8a--- a/frontend/src/pages/pam/components/pamResourceTabs.ts+++ b/frontend/src/pages/pam/components/pamResourceTabs.ts@@@ -1,4 -1,4 +1,4 @@@- import { type LucideIcon, RotateCcw, Settings, Settings2, Users } from "lucide-react";-import { type LucideIcon, Settings, Settings2, ShieldCheck, Users } from "lucide-react";++import { type LucideIcon, RotateCcw, Settings, Settings2, ShieldCheck, Users } from "lucide-react";import { PamResourcePermissionActions } from "@app/hooks/api/pam";import { PamSheetTab } from "@app/hooks/usePamSheetState";