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): break-glass for access requests
Andrey0c792c73938c
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-access-request-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-access-request-router.tsindex f7849396f1..c807703467 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-access-request-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-access-request-router.ts@@ -5,7 +5,11 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";import { readLimit, writeLimit } from "@app/server/config/rateLimiter";import { getTelemetryDistinctId } from "@app/server/lib/telemetry";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";-import { ApprovalRequestApprovalDecision, ApproverType } from "@app/services/approval-policy/approval-policy-enums";+import {+ ApprovalPolicyType,+ ApprovalRequestApprovalDecision,+ ApproverType+} from "@app/services/approval-policy/approval-policy-enums";import { AuthMode } from "@app/services/auth/auth-type";import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";@@ -14,7 +18,9 @@ const EnrichedRequestSchema = ApprovalRequestsSchema.extend({accountType: z.string().nullable(),folderName: z.string().nullable(),grantExpiresAt: z.date().nullable(),- grantStatus: z.string().nullable()+ grantStatus: z.string().nullable(),+ isBreakGlass: z.boolean(),+ bypassReason: z.string().nullable()});export const registerPamAccessRequestRouter = async (server: FastifyZodProvider) => {@@ -275,6 +281,81 @@ export const registerPamAccessRequestRouter = async (server: FastifyZodProvider)}});+ server.route({+ method: "POST",+ url: "/:requestId/break-glass",+ config: { rateLimit: writeLimit },+ schema: {+ operationId: "breakGlassPamAccessRequest",+ description: "Self-approve your own pending PAM access request in an emergency",+ params: z.object({+ requestId: z.string().uuid()+ }),+ body: z.object({+ bypassReason: z+ .string()+ .trim()+ .min(10)+ .max(500)+ .describe("Why the approvers are being skipped. Recorded in the audit log and sent to them.")+ }),+ response: {+ 200: z.object({+ request: ApprovalRequestsSchema+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.OAUTH]),+ handler: async (req) => {+ const result = await server.services.pamAccessRequest.breakGlassRequest({+ requestId: req.params.requestId,+ projectId: req.internalPamProjectId,+ bypassReason: req.body.bypassReason,+ actorId: req.permission.id,+ actor: req.permission.type,+ actorOrgId: req.permission.orgId,+ actorAuthMethod: req.permission.authMethod+ });++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ orgId: req.permission.orgId,+ projectId: req.internalPamProjectId,+ event: {+ type: EventType.PAM_ACCESS_POLICY_BYPASSED,+ metadata: {+ policyType: ApprovalPolicyType.PamAccess,+ policyId: result.policyId,+ requestId: req.params.requestId,+ grantId: result.grantId,+ granteeUserId: req.permission.id,+ accountId: result.accountId,+ folderId: result.folderId,+ resourceName: result.folderName ?? undefined,+ accountName: result.accountName,+ accessDuration: result.accessDuration,+ bypassReason: req.body.bypassReason,+ approverCount: result.approverCount+ }+ }+ });++ void server.services.telemetry+ .sendPostHogEvents({+ event: PostHogEventTypes.PamAccessRequestBrokeGlass,+ distinctId: getTelemetryDistinctId(req),+ organizationId: req.permission.orgId,+ properties: {+ accountType: result.accountType,+ orgId: req.permission.orgId+ }+ })+ .catch(() => {});++ return { request: result.request };+ }+ });+server.route({method: "POST",url: "/:requestId/revoke",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 26d3ed7a56..c378f2b5ac 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@@ -60,6 +60,8 @@ const PamAccountListItemSchema = SanitizedAccountListItemSchema.extend({requireReason: z.boolean().describe("Whether the account's template requires a reason for access"),accessStatus: z.nativeEnum(PamAccessStatus).describe("Current approval status for the caller"),grantExpiresAt: z.date().nullable().describe("When the current grant expires, if granted"),+ pendingRequestId: z.string().nullable().describe("The caller's pending access request for this account, if any"),+ canBreakGlass: z.boolean().describe("Whether the caller may self-approve their own pending request for this account"),permissions: z.any().array().describe("The caller's effective (packed) resource permissions on this account")});@@ -418,6 +420,13 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {),accessStatus: z.nativeEnum(PamAccessStatus).describe("Current approval status for the caller"),grantExpiresAt: z.date().nullable().describe("When the current grant expires, if granted"),+ pendingRequestId: z+ .string()+ .nullable()+ .describe("The caller's pending access request for this account, if any"),+ canBreakGlass: z+ .boolean()+ .describe("Whether the caller may self-approve their own pending request for this account"),disabledReason: z.string().nullable().describe("Why this account is disabled, or null if usable")})),diff --git a/backend/src/ee/routes/v1/pam-routers/pam-approval-configuration-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-approval-configuration-router.tsindex 9567a62caa..e7b45b501b 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-approval-configuration-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-approval-configuration-router.ts@@ -54,7 +54,8 @@ export const registerPamApprovalConfigurationRouter = async (server: FastifyZodPapprovers: z.array(ApproverSchema)})),- notificationConfigs: z.array(NotificationConfigResponseSchema)+ notificationConfigs: z.array(NotificationConfigResponseSchema),+ breakGlassApprovers: z.array(ApproverSchema)})}},@@ -82,7 +83,12 @@ export const registerPamApprovalConfigurationRouter = async (server: FastifyZodP}),body: z.object({steps: z.array(StepSchema).max(1),- notificationConfigs: z.array(NotificationConfigSchema).max(10).optional()+ notificationConfigs: z.array(NotificationConfigSchema).max(10).optional(),+ breakGlassApprovers: z+ .array(ApproverSchema)+ .max(20)+ .optional()+ .describe("Users and groups allowed to self-approve their own request. Omitted or empty means nobody.")}),response: {200: z.object({@@ -97,6 +103,7 @@ export const registerPamApprovalConfigurationRouter = async (server: FastifyZodPprojectId: req.internalPamProjectId,steps: req.body.steps,notificationConfigs: req.body.notificationConfigs,+ breakGlassApprovers: req.body.breakGlassApprovers,actorId: req.permission.id,actor: req.permission.type,actorOrgId: req.permission.orgId,@@ -113,7 +120,8 @@ export const registerPamApprovalConfigurationRouter = async (server: FastifyZodPfolderId: req.params.folderId,policyId: result.policyId,stepCount: result.stepCount,- notificationConfigCount: result.notificationConfigCount+ notificationConfigCount: result.notificationConfigCount,+ breakGlassApproverCount: result.breakGlassApproverCount}}});diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 5301ca3c1a..5753862354 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -6163,6 +6163,7 @@ interface PamApprovalConfigUpdateEvent {policyId: string | null;stepCount: number;notificationConfigCount?: number;+ breakGlassApproverCount?: number;};}@@ -6394,6 +6395,8 @@ interface PamAccessPolicyBypassedEvent {requestId: string;grantId: string;granteeUserId: string;+ accountId?: string;+ folderId?: string;resourceName?: string;accountName?: string;accessDuration: string;diff --git a/backend/src/ee/services/pam-access-request/pam-access-request-service.ts b/backend/src/ee/services/pam-access-request/pam-access-request-service.tsindex aaf2a6f83a..ecfb83df98 100644--- a/backend/src/ee/services/pam-access-request/pam-access-request-service.ts+++ b/backend/src/ee/services/pam-access-request/pam-access-request-service.ts@@ -17,6 +17,7 @@ import { logger } from "@app/lib/logger";import { formatDuration, ms } from "@app/lib/ms";import { TNotification, TriggerFeature } from "@app/lib/workflow-integrations/types";import {+ TApprovalPolicyBypassersDALFactory,TApprovalPolicyDALFactory,TApprovalPolicyStepApproversDALFactory,TApprovalPolicyStepsDALFactory@@ -28,7 +29,8 @@ import {ApprovalRequestGrantStatus,ApprovalRequestStatus,ApprovalRequestStepStatus,- ApproverType+ ApproverType,+ EnforcementLevel} from "@app/services/approval-policy/approval-policy-enums";import { TApprovalRequestData } from "@app/services/approval-policy/approval-policy-types";import {@@ -73,6 +75,7 @@ import { terminatePamSessions } from "../pam-session/pam-session-fns";import { getSlackSendTargets, parseNotificationChannels, parseNotificationEvents } from "./pam-access-request-fns";import {TAccessRequestActor,+ TBreakGlassAccessRequestDTO,TCheckGrantDTO,TCreateAccessRequestDTO,TGetAccessRequestCountDTO,@@ -93,15 +96,17 @@ type TPamAccessRequestServiceFactoryDep = {| "find"| "findOne"| "create"- | "updateById"| "deleteById"| "transaction"| "findStepsByPolicyId"| "isProjectApprover"| "findScopeIdsWithApprovers"+ | "findBypassersByPolicyId"+ | "findBypassersByPolicyIds">;approvalPolicyStepsDAL: Pick<TApprovalPolicyStepsDALFactory, "create" | "delete">;approvalPolicyStepApproversDAL: Pick<TApprovalPolicyStepApproversDALFactory, "create" | "delete">;+ approvalPolicyBypassersDAL: Pick<TApprovalPolicyBypassersDALFactory, "create" | "delete">;approvalRequestDAL: Pick<TApprovalRequestDALFactory,| "find"@@ -149,6 +154,7 @@ export const pamAccessRequestServiceFactory = ({approvalPolicyDAL,approvalPolicyStepsDAL,approvalPolicyStepApproversDAL,+ approvalPolicyBypassersDAL,approvalRequestDAL,approvalRequestStepsDAL,approvalRequestStepEligibleApproversDAL,@@ -183,6 +189,18 @@ export const pamAccessRequestServiceFactory = ({return policy ?? null;};+ const isFolderBreakGlassApprover = async (+ policyId: string,+ userId: string,+ userGroupIds: Set<string>+ ): Promise<boolean> => {+ const bypassers = await approvalPolicyDAL.findBypassersByPolicyId(policyId);+ return bypassers.some(+ (b) =>+ (b.type === ApproverType.User && b.id === userId) || (b.type === ApproverType.Group && userGroupIds.has(b.id))+ );+ };+// Requests and grants attribute their actor to exactly one column: a user or a machine identity.// These build the matching filter so every lookup stays scoped to the calling actor's own rows.const actorRequestFilter = ({ actorId, actor }: TAccessRequestActor) =>@@ -386,20 +404,36 @@ export const pamAccessRequestServiceFactory = ({return requests.map((r) => ({...r,grantExpiresAt: null as Date | null,- grantStatus: null as string | null+ grantStatus: null as string | null,+ isBreakGlass: false,+ bypassReason: null as string | null}));const grants = await approvalRequestGrantsDAL.find({ $in: { requestId: requests.map((r) => r.id) } });- const grantByRequestId = new Map<string, { expiresAt: Date | null; status: string }>();+ const grantByRequestId = new Map<+ string,+ { expiresAt: Date | null; status: string; isBreakGlass: boolean; bypassReason: string | null }+ >();grants.filter((g) => g.requestId).forEach((g) =>- grantByRequestId.set(g.requestId as string, { expiresAt: g.expiresAt ?? null, status: g.status })+ grantByRequestId.set(g.requestId as string, {+ expiresAt: g.expiresAt ?? null,+ status: g.status,+ isBreakGlass: Boolean(g.isBreakGlass),+ bypassReason: g.bypassReason ?? null+ }));return requests.map((r) => {const grant = grantByRequestId.get(r.id);- return { ...r, grantExpiresAt: grant?.expiresAt ?? null, grantStatus: grant?.status ?? null };+ return {+ ...r,+ grantExpiresAt: grant?.expiresAt ?? null,+ grantStatus: grant?.status ?? null,+ isBreakGlass: grant?.isBreakGlass ?? false,+ bypassReason: grant?.bypassReason ?? null+ };});};@@ -438,12 +472,19 @@ export const pamAccessRequestServiceFactory = ({const policy = await findFolderPolicy(folderId);if (!policy) {- return { steps: [], notificationConfigs };+ return { steps: [], notificationConfigs, breakGlassApprovers: [] };}// The policy row and step tuning fields are internal; the UI only needs the approver lists.- const steps = await approvalPolicyDAL.findStepsByPolicyId(policy.id);- return { steps: steps.map((s) => ({ approvers: s.approvers })), notificationConfigs };+ const [steps, breakGlassApprovers] = await Promise.all([+ approvalPolicyDAL.findStepsByPolicyId(policy.id),+ approvalPolicyDAL.findBypassersByPolicyId(policy.id)+ ]);+ return {+ steps: steps.map((s) => ({ approvers: s.approvers })),+ notificationConfigs,+ breakGlassApprovers: breakGlassApprovers.map((b) => ({ type: b.type, id: b.id }))+ };};const setApprovalConfiguration = async ({@@ -451,6 +492,7 @@ export const pamAccessRequestServiceFactory = ({projectId,steps,notificationConfigs,+ breakGlassApprovers,...ctx}: TSetApprovalConfigurationDTO) => {await verifyProductMembership(permissionService, projectId, ctx);@@ -460,24 +502,58 @@ export const pamAccessRequestServiceFactory = ({throw new BadRequestError({ message: "Phase 1 only supports a single approval step" });}- // Approvers must be active members of the folder. This keeps the approver list in sync with- // membership so that removing someone from the folder (which strips their approver rows) can't be- // circumvented by designating a non-member or expired member as an approver.+ // Approvers and break-glass approvers must be active members of the folder. This keeps both lists in+ // sync with membership so that removing someone from the folder (which strips their approver rows)+ // can't be circumvented by designating a non-member or expired member.const requestedApprovers = steps.flatMap((s) => s.approvers);- if (requestedApprovers.length > 0) {+ const managesBreakGlass = breakGlassApprovers !== undefined;+ const requestedBreakGlassApprovers = breakGlassApprovers ?? [];+ if (requestedApprovers.length > 0 || requestedBreakGlassApprovers.length > 0) {const memberships = await findActiveFolderMemberships(projectId, folderId);const memberUserIds = new Set(memberships.map((m) => m.actorUserId).filter(Boolean));const memberGroupIds = new Set(memberships.map((m) => m.actorGroupId).filter(Boolean));+ const isFolderMember = (entry: { type: ApproverType; id: string }) =>+ entry.type === ApproverType.User ? memberUserIds.has(entry.id) : memberGroupIds.has(entry.id);for (const approver of requestedApprovers) {- const isMember =- approver.type === ApproverType.User ? memberUserIds.has(approver.id) : memberGroupIds.has(approver.id);- if (!isMember) {+ if (!isFolderMember(approver)) {throw new BadRequestError({ message: "Approvers must be members of the folder" });}}++ for (const bypasser of requestedBreakGlassApprovers) {+ if (!isFolderMember(bypasser)) {+ throw new BadRequestError({ message: "Break-glass approvers must be members of the folder" });+ }+ }+ }++ const dedupedBreakGlassApprovers = [+ ...new Map(requestedBreakGlassApprovers.map((b) => [`${b.type}:${b.id}`, b])).values()+ ];++ if (dedupedBreakGlassApprovers.length > 0 && requestedApprovers.length === 0) {+ throw new BadRequestError({+ message: "Break-glass approvers can only be configured on a folder that has approvers"+ });}+ const replaceBreakGlassApprovers = async (policyId: string, tx: Knex) => {+ if (!managesBreakGlass) return;+ await approvalPolicyBypassersDAL.delete({ policyId }, tx);+ for (const bypasser of dedupedBreakGlassApprovers) {+ // eslint-disable-next-line no-await-in-loop+ await approvalPolicyBypassersDAL.create(+ {+ policyId,+ userId: bypasser.type === ApproverType.User ? bypasser.id : null,+ groupId: bypasser.type === ApproverType.Group ? bypasser.id : null+ },+ tx+ );+ }+ };+// Notification configs live independent of the policy row, so they are persisted before the// policy branches below; several of those branches return early.if (notificationConfigs !== undefined) {@@ -533,11 +609,17 @@ export const pamAccessRequestServiceFactory = ({await approvalPolicyStepsDAL.delete({ policyId: existingPolicy.id }, tx);await approvalPolicyDAL.deleteById(existingPolicy.id, tx);});- return { policyId: existingPolicy.id, folderId, stepCount: steps.length, notificationConfigCount };+ return {+ policyId: existingPolicy.id,+ folderId,+ stepCount: steps.length,+ notificationConfigCount,+ breakGlassApproverCount: 0+ };}if (!hasApprovers) {- return { policyId: null, folderId, stepCount: 0, notificationConfigCount };+ return { policyId: null, folderId, stepCount: 0, notificationConfigCount, breakGlassApproverCount: 0 };}if (existingPolicy) {@@ -568,9 +650,17 @@ export const pamAccessRequestServiceFactory = ({);}}++ await replaceBreakGlassApprovers(existingPolicy.id, tx);});- return { policyId: existingPolicy.id, folderId, stepCount: steps.length, notificationConfigCount };+ return {+ policyId: existingPolicy.id,+ folderId,+ stepCount: steps.length,+ notificationConfigCount,+ breakGlassApproverCount: managesBreakGlass ? dedupedBreakGlassApprovers.length : undefined+ };}const newPolicy = await approvalPolicyDAL.transaction(async (tx) => {@@ -582,7 +672,7 @@ export const pamAccessRequestServiceFactory = ({name: `PAM Folder Approval - ${folder.name}`,scopeType: ApprovalPolicyScope.PamFolder,scopeId: folderId,- enforcementLevel: "hard",+ enforcementLevel: EnforcementLevel.Hard,conditions: { version: 1, conditions: [] },constraints: { version: 1, constraints: { accessDuration: { min: "30s", max: "7d" } } }},@@ -614,10 +704,18 @@ export const pamAccessRequestServiceFactory = ({}}+ await replaceBreakGlassApprovers(policy.id, tx);+return policy;});- return { policyId: newPolicy.id, folderId, stepCount: steps.length, notificationConfigCount };+ return {+ policyId: newPolicy.id,+ folderId,+ stepCount: steps.length,+ notificationConfigCount,+ breakGlassApproverCount: managesBreakGlass ? dedupedBreakGlassApprovers.length : undefined+ };};const createRequest = async ({ accountId, path, projectId, reason, duration, ...ctx }: TCreateAccessRequestDTO) => {@@ -1255,6 +1353,260 @@ export const pamAccessRequestServiceFactory = ({return { request: updatedRequest, accountId: requestData?.requestData?.accountId, folderId };};+ const notifyOfBreakGlass = async ({+ request,+ steps,+ account,+ folderId,+ duration,+ bypassReason,+ actorId,+ orgId+ }: {+ request: { id: string; requesterName?: string | null; requesterEmail?: string | null };+ steps: { approvers: { type: string; id: string }[] }[];+ account: { name: string; folderName: string | null };+ folderId: string;+ duration: string;+ bypassReason: string;+ actorId: string;+ orgId: string;+ }) => {+ try {+ const approverUserIds = new Set<string>();+ const approverGroupIds = new Set<string>();+ for (const step of steps) {+ for (const approver of step.approvers) {+ if (approver.type === ApproverType.User) approverUserIds.add(approver.id);+ else approverGroupIds.add(approver.id);+ }+ }++ const groupMemberLists = await Promise.all(+ [...approverGroupIds].map((groupId) => userGroupMembershipDAL.find({ groupId }))+ );+ groupMemberLists.forEach((members) => members.forEach((m) => approverUserIds.add(m.userId)));+ approverUserIds.delete(actorId);++ if (approverUserIds.size > 0) {+ const approverUsers = await userDAL.find({ $in: { id: [...approverUserIds] } });++ await notificationService.createUserNotifications(+ [...approverUserIds].map((userId) => ({+ userId,+ orgId,+ type: NotificationType.ACCESS_APPROVAL_REQUEST_UPDATED,+ title: "Access approval bypassed",+ body: `**${request.requesterName ?? "A user"}** used break-glass to self-approve access to **${account.name}**. Reason: "${bypassReason}"`+ }))+ );++ const recipients = approverUsers.filter((u) => u.email).map((u) => u.email as string);+ if (recipients.length > 0) {+ await smtpService.sendMail({+ recipients,+ subjectLine: "PAM Access Approval Bypassed",+ template: SmtpTemplates.AccessPamRequestBypassed,+ substitutions: {+ requesterFullName: request.requesterName ?? "A user",+ requesterEmail: request.requesterEmail ?? "",+ resourceName: account.folderName ?? undefined,+ accountName: account.name,+ accessDuration: formatDuration(duration),+ bypassReason+ }+ });+ }+ }+ } catch (err) {+ logger.error(err, `Failed to send PAM break-glass notifications [requestId=${request.id}]`);+ }++ void triggerFolderSlackNotifications({+ folderId,+ event: PamNotificationEvent.AccessRequestBypassed,+ orgId,+ notification: {+ type: TriggerFeature.PAM_ACCESS_REQUEST_BYPASSED,+ payload: {+ requesterFullName: request.requesterName ?? "A user",+ requesterEmail: request.requesterEmail ?? "",+ accountName: account.name,+ folderName: account.folderName ?? "",+ accessDuration: formatDuration(duration),+ bypassReason+ }+ }+ });+ };++ const breakGlassRequest = async ({ requestId, projectId, bypassReason, ...ctx }: TBreakGlassAccessRequestDTO) => {+ await verifyProductMembership(permissionService, projectId, ctx);++ const trimmedReason = bypassReason.trim();+ if (trimmedReason.length < 10) {+ throw new BadRequestError({+ message: "A break-glass reason of at least 10 characters is required. It is recorded in the audit log."+ });+ }++ if (ctx.actor !== ActorType.USER) {+ throw new ForbiddenRequestError({ message: "Only users can break glass on an access request" });+ }++ const request = await approvalRequestDAL.findById(requestId);+ if (!request || request.projectId !== projectId || request.type !== ApprovalPolicyType.PamAccess) {+ throw new NotFoundError({ message: "Request not found" });+ }++ if (request.requesterId !== ctx.actorId) {+ throw new ForbiddenRequestError({ message: "You can only break glass on your own access request" });+ }++ if (request.status !== ApprovalRequestStatus.Pending) {+ throw new BadRequestError({ message: "Request is not pending" });+ }++ if (request.expiresAt && new Date(request.expiresAt) < new Date()) {+ await approvalRequestDAL.updateById(requestId, { status: ApprovalRequestStatus.Expired });+ throw new BadRequestError({ message: "Request has expired" });+ }++ const requestData = request.requestData as { version: number; requestData: TPamAccessRequestData } | null;+ const folderId = requestData?.requestData?.folderId;+ const accountId = requestData?.requestData?.accountId;+ if (!folderId || !accountId) {+ throw new BadRequestError({ message: "This request is missing the account it was raised for" });+ }++ const account = await pamAccountDAL.findByIdWithDetails(accountId);+ if (!account || account.projectId !== projectId || account.folderId !== folderId) {+ throw new BadRequestError({+ message: "This request is no longer valid because the account has moved or been removed"+ });+ }++ const { allowBreakGlass } = resolveAccessControls(account.templatePolicies);+ if (!allowBreakGlass) {+ throw new ForbiddenRequestError({+ message: `Break-glass is not enabled for '${account.name}'. Ask a PAM admin to turn on the Allow Break-Glass policy on its template.`+ });+ }++ const policy = await findFolderPolicy(folderId);+ if (!policy) {+ throw new ForbiddenRequestError({ message: "Approval policy no longer exists for this folder" });+ }++ const userGroupIds = await getUserGroupIds(ctx.actorId, ctx.actorOrgId);+ if (!(await isFolderBreakGlassApprover(policy.id, ctx.actorId, userGroupIds))) {+ throw new ForbiddenRequestError({+ message: "You are not a break-glass approver for this folder"+ });+ }++ const activeMemberships = await findActiveFolderMemberships(projectId, folderId);+ const hasActiveMembership = activeMemberships.some(+ (m) => m.actorUserId === ctx.actorId || (m.actorGroupId && userGroupIds.has(m.actorGroupId))+ );+ if (!hasActiveMembership) {+ throw new ForbiddenRequestError({ message: "You are not a member of this folder" });+ }++ await checkAccountAccess(+ permissionService,+ account.id,+ account.folderId,+ projectId,+ ResourcePermissionPamResourceActions.LaunchSessions,+ ctx+ );++ const steps = await approvalRequestDAL.findStepsByRequestId(requestId);+ const bypassedApproverCount = new Set(steps.flatMap((s) => s.approvers.map((a) => `${a.type}:${a.id}`))).size;+ const durationMs = parseDurationMs(requestData.requestData.duration);++ const { updatedRequest, grant } = await approvalRequestDAL.transaction(async (tx) => {+ const locked = await approvalRequestDAL.findByIdForUpdate(requestId, tx);+ if (!locked || locked.status !== ApprovalRequestStatus.Pending) {+ throw new BadRequestError({ message: "Request is not pending" });+ }++ if (locked.expiresAt && new Date(locked.expiresAt) < new Date()) {+ await approvalRequestDAL.updateById(requestId, { status: ApprovalRequestStatus.Expired }, tx);+ throw new BadRequestError({ message: "Request has expired" });+ }++ await Promise.all(+ steps.map((step) =>+ approvalRequestStepsDAL.updateById(+ step.id,+ { status: ApprovalRequestStepStatus.Completed, completedAt: new Date() },+ tx+ )+ )+ );++ const currentStep = steps.find((s) => s.stepNumber === locked.currentStep);+ if (currentStep) {+ await approvalRequestApprovalsDAL.create(+ {+ stepId: currentStep.id,+ approverUserId: ctx.actorId,+ decision: ApprovalRequestApprovalDecision.Approved,+ comment: `Break-glass: ${trimmedReason}`+ },+ tx+ );+ }++ await approvalRequestDAL.updateById(requestId, { status: ApprovalRequestStatus.Approved }, tx);++ const createdGrant = await approvalRequestGrantsDAL.create(+ {+ projectId: request.projectId,+ requestId: request.id,+ granteeUserId: request.requesterId,+ status: ApprovalRequestGrantStatus.Active,+ type: ApprovalPolicyType.PamAccess,+ attributes: { accountId, folderId },+ expiresAt: new Date(Date.now() + durationMs),+ isBreakGlass: true,+ bypassReason: trimmedReason+ },+ tx+ );++ return { updatedRequest: await approvalRequestDAL.findById(requestId, tx), grant: createdGrant };+ });++ void notifyOfBreakGlass({+ request,+ steps,+ account,+ folderId,+ duration: requestData.requestData.duration,+ bypassReason: trimmedReason,+ actorId: ctx.actorId,+ orgId: ctx.actorOrgId+ }).catch((err) => {+ logger.error(err, `Failed to send PAM break-glass notifications [requestId=${requestId}]`);+ });++ return {+ request: updatedRequest,+ accountId,+ folderId,+ accountType: account.accountType,+ grantId: grant.id,+ policyId: policy.id,+ accountName: account.name,+ folderName: account.folderName,+ accessDuration: requestData.requestData.duration,+ approverCount: bypassedApproverCount+ };+ };+// Marks a grant Revoked and terminates the grantee's live sessions on the granted account.//// Returns the tunnel-cancellation callback rather than firing it, so a caller that revokes inside a@@ -1470,8 +1822,13 @@ export const pamAccessRequestServiceFactory = ({actorCtx: TAccessRequestActor,accountIds: string[],projectId: string- ): Promise<Map<string, { accessStatus: PamAccessStatus; grantExpiresAt: Date | null }>> => {- const result = new Map<string, { accessStatus: PamAccessStatus; grantExpiresAt: Date | null }>();+ ): Promise<+ Map<string, { accessStatus: PamAccessStatus; grantExpiresAt: Date | null; pendingRequestId: string | null }>+ > => {+ const result = new Map<+ string,+ { accessStatus: PamAccessStatus; grantExpiresAt: Date | null; pendingRequestId: string | null }+ >();if (accountIds.length === 0) return result;const now = new Date();@@ -1489,7 +1846,8 @@ export const pamAccessRequestServiceFactory = ({if (!isExpired && attrs?.accountId && accountIds.includes(attrs.accountId)) {result.set(attrs.accountId, {accessStatus: PamAccessStatus.Granted,- grantExpiresAt: grant.expiresAt ? new Date(grant.expiresAt) : null+ grantExpiresAt: grant.expiresAt ? new Date(grant.expiresAt) : null,+ pendingRequestId: null});}}@@ -1505,7 +1863,11 @@ export const pamAccessRequestServiceFactory = ({const data = request.requestData as { version: number; requestData: TPamAccessRequestData } | null;const acctId = data?.requestData?.accountId;if (acctId && accountIds.includes(acctId) && !result.has(acctId)) {- result.set(acctId, { accessStatus: PamAccessStatus.Pending, grantExpiresAt: null });+ result.set(acctId, {+ accessStatus: PamAccessStatus.Pending,+ grantExpiresAt: null,+ pendingRequestId: request.id+ });}}@@ -1524,6 +1886,37 @@ export const pamAccessRequestServiceFactory = ({return new Set(scopeIds);};+ const getBreakGlassApproverFolders = async (+ folderIds: string[],+ actorCtx: TAccessRequestActor,+ orgId: string+ ): Promise<Set<string>> => {+ const result = new Set<string>();+ if (folderIds.length === 0 || actorCtx.actor !== ActorType.USER) return result;++ const policies = await approvalPolicyDAL.find({+ type: ApprovalPolicyType.PamAccess,+ scopeType: ApprovalPolicyScope.PamFolder,+ $in: { scopeId: folderIds }+ });+ if (policies.length === 0) return result;++ const [userGroupIds, bypassersByPolicyId] = await Promise.all([+ getUserGroupIds(actorCtx.actorId, orgId),+ approvalPolicyDAL.findBypassersByPolicyIds(policies.map((p) => p.id))+ ]);++ for (const policy of policies) {+ const isApprover = (bypassersByPolicyId[policy.id] ?? []).some(+ (b) =>+ (b.type === ApproverType.User && b.id === actorCtx.actorId) ||+ (b.type === ApproverType.Group && userGroupIds.has(b.id))+ );+ if (isApprover && policy.scopeId) result.add(policy.scopeId);+ }+ return result;+ };+// Requesters need to know who to ping for approval, so this is gated on LaunchSessions (the// request-access permission) rather than the policy-management check used for the full config.const getAccountApprovers = async ({ accountId, projectId, ...ctx }: TGetAccountApproversDTO) => {@@ -1622,6 +2015,7 @@ export const pamAccessRequestServiceFactory = ({getAccountApprovers,setApprovalConfiguration,createRequest,+ breakGlassRequest,listRequests,listPendingMyApproval,getCount,@@ -1630,6 +2024,7 @@ export const pamAccessRequestServiceFactory = ({checkGrant,getAccessStatusBatch,getFolderPolicyConfigured,+ getBreakGlassApproverFolders,cleanupFolderResources,cleanupAccountResources};diff --git a/backend/src/ee/services/pam-access-request/pam-access-request-types.ts b/backend/src/ee/services/pam-access-request/pam-access-request-types.tsindex ed8ba230cf..6b8bc94380 100644--- a/backend/src/ee/services/pam-access-request/pam-access-request-types.ts+++ b/backend/src/ee/services/pam-access-request/pam-access-request-types.ts@@ -23,6 +23,13 @@ export type TSetApprovalConfigurationDTO = {}[];// undefined leaves existing configs unchanged so older clients that only manage steps can't wipe themnotificationConfigs?: TPamNotificationConfigInput[];+ breakGlassApprovers?: { type: ApproverType; id: string }[];+} & TActorContext;++export type TBreakGlassAccessRequestDTO = {+ requestId: string;+ projectId: string;+ bypassReason: string;} & TActorContext;export type TCreateAccessRequestDTO = {diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex c912c3b550..35412e4f75 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -98,7 +98,7 @@ type TPamAccountServiceFactoryDep = {appConnectionDAL: Pick<TAppConnectionDALFactory, "findOne" | "findById">;pamAccessRequestService: Pick<TPamAccessRequestServiceFactory,- "getAccessStatusBatch" | "getFolderPolicyConfigured" | "cleanupAccountResources"+ "getAccessStatusBatch" | "getFolderPolicyConfigured" | "getBreakGlassApproverFolders" | "cleanupAccountResources">;licenseService: Pick<TLicenseServiceFactory, "getPlan">;};@@ -233,13 +233,18 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>...new Set(accountsRequiringApproval.map((a) => a.folderId).filter(Boolean) as string[])];- const [accessStatusMap, foldersWithApprovalPolicy, permissionsByAccountId] = await Promise.all([+ const [accessStatusMap, foldersWithApprovalPolicy, breakGlassFolders, permissionsByAccountId] = await Promise.all([deps.pamAccessRequestService.getAccessStatusBatch({ actorId: ctx.actorId, actor: ctx.actor },accountIdsRequiringApproval,projectId),deps.pamAccessRequestService.getFolderPolicyConfigured(folderIdsRequiringApproval),+ deps.pamAccessRequestService.getBreakGlassApproverFolders(+ folderIdsRequiringApproval,+ { actorId: ctx.actorId, actor: ctx.actor },+ ctx.actorOrgId+ ),// Resolve every account's effective permissions in one membership fetchgetAccountPermissionRulesMap(membershipDAL,@@ -252,7 +257,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>return accounts.map((a) => {const { accessibilityIssues, isAccessible } = computeAccessibility(a);- const { requiresApproval, requireReason } = resolveAccessControls(a.templatePolicies);+ const { requiresApproval, requireReason, allowBreakGlass } = resolveAccessControls(a.templatePolicies);if (requiresApproval && a.folderId && !foldersWithApprovalPolicy.has(a.folderId)) {accessibilityIssues.push(PamAccountAccessibilityIssue.NoApprovalConfig);}@@ -277,6 +282,8 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>requireReason,accessStatus: requiresApproval ? (statusEntry?.accessStatus ?? PamAccessStatus.None) : PamAccessStatus.None,grantExpiresAt: statusEntry?.grantExpiresAt ?? null,+ pendingRequestId: statusEntry?.pendingRequestId ?? null,+ canBreakGlass: allowBreakGlass && !!a.folderId && breakGlassFolders.has(a.folderId),permissions: permissionsByAccountId.get(a.id) ?? [],createdAt: a.createdAt,updatedAt: a.updatedAt@@ -947,18 +954,25 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>const folderIdsRequiringApproval = [...new Set(accountsRequiringApproval.map((a) => a.folderId).filter(Boolean) as string[])];- const [accessStatusMap, foldersWithApprovalPolicy] = await Promise.all([+ const [accessStatusMap, foldersWithApprovalPolicy, breakGlassFolders] = await Promise.all([deps.pamAccessRequestService.getAccessStatusBatch({ actorId: ctx.actorId, actor: ctx.actor },accountIdsRequiringApproval,projectId),- deps.pamAccessRequestService.getFolderPolicyConfigured(folderIdsRequiringApproval)+ deps.pamAccessRequestService.getFolderPolicyConfigured(folderIdsRequiringApproval),+ deps.pamAccessRequestService.getBreakGlassApproverFolders(+ folderIdsRequiringApproval,+ { actorId: ctx.actorId, actor: ctx.actor },+ ctx.actorOrgId+ )]);return {accounts: accounts.map((a) => {- const { requiresApproval, requireReason, requireMfa } = resolveAccessControls(a.templatePolicies);+ const { requiresApproval, requireReason, requireMfa, allowBreakGlass } = resolveAccessControls(+ a.templatePolicies+ );const statusEntry = accessStatusMap.get(a.id);const hasPolicyConfigured = a.folderId ? foldersWithApprovalPolicy.has(a.folderId) : false;let disabledReason: string | null = null;@@ -984,6 +998,8 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>requireMfa,accessStatus: requiresApproval ? (statusEntry?.accessStatus ?? PamAccessStatus.None) : PamAccessStatus.None,grantExpiresAt: statusEntry?.grantExpiresAt ?? null,+ pendingRequestId: statusEntry?.pendingRequestId ?? null,+ canBreakGlass: allowBreakGlass && !!a.folderId && breakGlassFolders.has(a.folderId),disabledReason,createdAt: a.createdAt,updatedAt: a.updatedAtdiff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.mdindex bda90a1286..bed5886184 100644--- a/backend/src/ee/services/pam/CLAUDE.md+++ b/backend/src/ee/services/pam/CLAUDE.md@@ -129,6 +129,17 @@ policies apply before the session starts; gateway-enforced ones flow to the gate**Settings** (recording, password constraints, log masking) are a separate concept — they live in thetemplate's `settings` column, not `policies`. Both are edited on the template detail sheet's "General" tab.+**Break-glass** lets a requester self-approve their own pending request, and needs **both** gates open:+the account's template carries `allow-break-glass`, *and* the folder's approval policy names the actor in+`approval_policy_bypassers`. Neither alone is sufficient, and an empty bypasser list means **nobody** —+the shared `approval-policy-service` treats an empty list as everybody, which is the opposite rule, so do+not reuse its predicate. `allow-break-glass` resolves to false without `requires-approval`, since there is+then no approval to skip. Saving the folder config keeps the policy's `enforcementLevel` in step with the+list (`soft` when non-empty), and omitting `breakGlassApprovers` entirely leaves the stored list alone so a+steps-only client can't switch break-glass off by accident. The grant records `isBreakGlass` ++`bypassReason`, and `PAM_ACCESS_POLICY_BYPASSED` must carry `accountId`/`folderId` or the event is hidden+from folder and account auditors (see the audit-log gotcha under Permissions).+## Discovery`pam-discovery/`: a **source** (a credential account + gateway) scans and stages **discovered accounts**diff --git a/backend/src/ee/services/pam/pam-enums.ts b/backend/src/ee/services/pam/pam-enums.tsindex 5a8a4898da..27d4fbc6e9 100644--- a/backend/src/ee/services/pam/pam-enums.ts+++ b/backend/src/ee/services/pam/pam-enums.ts@@ -75,5 +75,6 @@ export enum PamMemberKind {export enum PamNotificationEvent {AccessRequested = "access-requested",AccessRequestApproved = "access-request-approved",- AccessRequestDenied = "access-request-denied"+ AccessRequestDenied = "access-request-denied",+ AccessRequestBypassed = "access-request-bypassed"}diff --git a/backend/src/ee/services/pam/pam-policies.test.ts b/backend/src/ee/services/pam/pam-policies.test.tsindex 6ed3e17969..535a441601 100644--- a/backend/src/ee/services/pam/pam-policies.test.ts+++ b/backend/src/ee/services/pam/pam-policies.test.ts@@ -7,6 +7,7 @@ describe("getApplicablePolicies", () => {test("returns the universal policies for any account type", () => {const keys = getApplicablePolicies(PamAccountType.Postgres).map((p) => p.key);expect(keys).toContain(PamPolicyType.RequireMfa);+ expect(keys).toContain(PamPolicyType.AllowBreakGlass);expect(keys).toContain(PamPolicyType.RequireReason);expect(keys).toContain(PamPolicyType.MaxSessionDuration);});@@ -88,6 +89,7 @@ describe("validatePolicyValues", () => {describe("resolveAccessControls", () => {const DEFAULTS = {requiresApproval: false,+ allowBreakGlass: false,requireReason: false,requireMfa: false,maxSessionDurationSeconds: null@@ -111,7 +113,13 @@ describe("resolveAccessControls", () => {[PamPolicyType.RequireMfa]: true,[PamPolicyType.MaxSessionDuration]: 3600})- ).toEqual({ requiresApproval: false, requireReason: true, requireMfa: true, maxSessionDurationSeconds: 3600 });+ ).toEqual({+ requiresApproval: false,+ allowBreakGlass: false,+ requireReason: true,+ requireMfa: true,+ maxSessionDurationSeconds: 3600+ });});test("resolves each policy independently of the others", () => {@@ -125,6 +133,22 @@ describe("resolveAccessControls", () => {});});+ test("break-glass only resolves alongside the approval it exists to skip", () => {+ expect(+ resolveAccessControls({+ [PamPolicyType.RequiresApproval]: true,+ [PamPolicyType.AllowBreakGlass]: true+ }).allowBreakGlass+ ).toBe(true);+ expect(resolveAccessControls({ [PamPolicyType.AllowBreakGlass]: true }).allowBreakGlass).toBe(false);+ expect(+ resolveAccessControls({+ [PamPolicyType.RequiresApproval]: true,+ [PamPolicyType.AllowBreakGlass]: "true"+ }).allowBreakGlass+ ).toBe(false);+ });+test("treats the boolean gates as strict: only literal true enables them", () => {expect(resolveAccessControls({ [PamPolicyType.RequireMfa]: false }).requireMfa).toBe(false);// a non-boolean stored value fails its schema and resolves to the default, never throwsdiff --git a/backend/src/ee/services/pam/pam-policies.ts b/backend/src/ee/services/pam/pam-policies.tsindex a44f2a788c..fa2c740a6c 100644--- a/backend/src/ee/services/pam/pam-policies.ts+++ b/backend/src/ee/services/pam/pam-policies.ts@@ -5,6 +5,7 @@ import { PamAccountType } from "./pam-enums";export enum PamPolicyType {RequiresApproval = "requires-approval",+ AllowBreakGlass = "allow-break-glass",RequireMfa = "require-mfa",RequireReason = "require-reason",MaxSessionDuration = "max-session-duration",@@ -70,6 +71,13 @@ export const PAM_POLICY_DEFINITIONS: Record<PamPolicyType, TPamPolicyDefinition>appliesTo: "all",schema: z.boolean()},+ [PamPolicyType.AllowBreakGlass]: {+ label: "Allow Break-Glass",+ description:+ "Designated break-glass users may self-approve their own request in an emergency. Has no effect until a folder admin names them under the folder's Approvals tab.",+ appliesTo: "all",+ schema: z.boolean()+ },[PamPolicyType.RequireMfa]: {label: "Require MFA",description: "Users must re-authenticate with MFA before accessing.",@@ -171,6 +179,7 @@ export const resolvePolicy = (policyMap: unknown, policy: PamPolicyType): unknowexport type TPamAccessControls = {requiresApproval: boolean;+ allowBreakGlass: boolean;requireReason: boolean;requireMfa: boolean;maxSessionDurationSeconds: number | null;@@ -188,8 +197,10 @@ export const PamPolicyRulesSchema = zexport const resolveAccessControls = (policyMap: unknown): TPamAccessControls => {const duration = resolvePolicy(policyMap, PamPolicyType.MaxSessionDuration);+ const requiresApproval = resolvePolicy(policyMap, PamPolicyType.RequiresApproval) === true;return {- requiresApproval: resolvePolicy(policyMap, PamPolicyType.RequiresApproval) === true,+ requiresApproval,+ allowBreakGlass: requiresApproval && resolvePolicy(policyMap, PamPolicyType.AllowBreakGlass) === true,requireReason: resolvePolicy(policyMap, PamPolicyType.RequireReason) === true,requireMfa: resolvePolicy(policyMap, PamPolicyType.RequireMfa) === true,maxSessionDurationSeconds: typeof duration === "number" ? duration : nulldiff --git a/backend/src/lib/workflow-integrations/types.ts b/backend/src/lib/workflow-integrations/types.tsindex 9932088906..06e98e1fea 100644--- a/backend/src/lib/workflow-integrations/types.ts+++ b/backend/src/lib/workflow-integrations/types.ts@@ -11,7 +11,8 @@ export enum TriggerFeature {SECRET_SYNC_ERROR = "secret-sync-error",PAM_ACCESS_REQUESTED = "pam-access-requested",PAM_ACCESS_REQUEST_APPROVED = "pam-access-request-approved",- PAM_ACCESS_REQUEST_DENIED = "pam-access-request-denied"+ PAM_ACCESS_REQUEST_DENIED = "pam-access-request-denied",+ PAM_ACCESS_REQUEST_BYPASSED = "pam-access-request-bypassed"}export type TNotification =@@ -97,6 +98,17 @@ export type TNotification =comment?: string;approvalUrl: string;};+ }+ | {+ type: TriggerFeature.PAM_ACCESS_REQUEST_BYPASSED;+ payload: {+ requesterFullName: string;+ requesterEmail: string;+ accountName: string;+ folderName: string;+ accessDuration: string;+ bypassReason: string;+ };};export type TTriggerWorkflowNotificationDTO = {diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex e230d1efb5..e8f31ed61f 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -1697,6 +1697,7 @@ export const registerRoutes = async (const approvalRequestStepEligibleApproversDAL = approvalRequestStepEligibleApproversDALFactory(db);const approvalPolicyStepsDAL = approvalPolicyStepsDALFactory(db);const approvalPolicyStepApproversDAL = approvalPolicyStepApproversDALFactory(db);+ const approvalPolicyBypassersDAL = approvalPolicyBypassersDALFactory(db);const approvalRequestApprovalsDAL = approvalRequestApprovalsDALFactory(db);const orgGatewayConfigV2DAL = orgGatewayConfigV2DalFactory(db);@@ -1957,6 +1958,7 @@ export const registerRoutes = async (approvalPolicyDAL,approvalPolicyStepsDAL,approvalPolicyStepApproversDAL,+ approvalPolicyBypassersDAL,approvalRequestDAL,approvalRequestStepsDAL,approvalRequestStepEligibleApproversDAL,@@ -3545,8 +3547,6 @@ export const registerRoutes = async (apiEnrollmentConfigDAL});- const approvalPolicyBypassersDAL = approvalPolicyBypassersDALFactory(db);-const approvalPolicyService = approvalPolicyServiceFactory({approvalPolicyDAL,approvalPolicyStepsDAL,diff --git a/backend/src/services/approval-policy/approval-policy-service.ts b/backend/src/services/approval-policy/approval-policy-service.tsindex 0e195e61c3..f6eb9a5979 100644--- a/backend/src/services/approval-policy/approval-policy-service.ts+++ b/backend/src/services/approval-policy/approval-policy-service.ts@@ -485,14 +485,12 @@ export const approvalPolicyServiceFactory = ({recipients: emailRecipients,subjectLine: "Infisical PAM Access Policy Bypassed",substitutions: {- projectName: project?.name ?? "Unknown project",requesterFullName,requesterEmail,resourceName: inputs.resourceName,accountName: inputs.accountName,accessDuration: inputs.accessDuration,- bypassReason: bypassReason.trim(),- approvalUrl: `${cfg.SITE_URL}${approvalPath}`+ bypassReason: bypassReason.trim()},template: SmtpTemplates.AccessPamRequestBypassed});diff --git a/backend/src/services/slack/slack-fns.ts b/backend/src/services/slack/slack-fns.tsindex 939d409cd4..87e0bd1497 100644--- a/backend/src/services/slack/slack-fns.ts+++ b/backend/src/services/slack/slack-fns.ts@@ -380,6 +380,44 @@ const buildSlackPayload = (notification: TNotification) => {color: isApproved ? COMPANY_BRAND_COLOR : ERROR_COLOR};}+ case TriggerFeature.PAM_ACCESS_REQUEST_BYPASSED: {+ const { payload } = notification;+ const requesterFullName = escapeSlackMrkdwn(payload.requesterFullName);+ const requesterEmail = escapeSlackMrkdwn(payload.requesterEmail);+ const accountName = escapeSlackMrkdwn(payload.accountName);+ const folderName = escapeSlackMrkdwn(payload.folderName);+ const bypassReason = escapeSlackMrkdwn(payload.bypassReason);++ const messageBody = `${requesterFullName} (${requesterEmail}) used break-glass to self-approve access to ${accountName} in the ${folderName} folder, skipping the approvers.\n\nDuration: ${payload.accessDuration}\n\nReason: ${bypassReason}`;++ const headerBlocks = [+ {+ type: "header",+ text: {+ type: "plain_text",+ text: "PAM access approval bypassed",+ emoji: true+ }+ }+ ];++ const payloadBlocks = [+ {+ type: "section",+ text: {+ type: "mrkdwn",+ text: `*${requesterFullName}* (${requesterEmail}) used break-glass to self-approve access to *${accountName}* in the *${folderName}* folder, skipping the approvers.\n\n*Duration:* ${payload.accessDuration}\n\n*Reason:* ${bypassReason}`+ }+ }+ ];++ return {+ headerBlocks,+ payloadMessage: messageBody,+ payloadBlocks,+ color: ERROR_COLOR+ };+ }default: {throw new BadRequestError({message: "Slack notification type not supported."diff --git a/backend/src/services/smtp/emails/AccessPamRequestBypassedTemplate.tsx b/backend/src/services/smtp/emails/AccessPamRequestBypassedTemplate.tsxindex 06a8365a95..59d6ee1a12 100644--- a/backend/src/services/smtp/emails/AccessPamRequestBypassedTemplate.tsx+++ b/backend/src/services/smtp/emails/AccessPamRequestBypassedTemplate.tsx@@ -1,31 +1,26 @@import { Heading, Section, Text } from "@react-email/components";import React from "react";-import { BaseButton } from "./BaseButton";import { BaseEmailWrapper, BaseEmailWrapperProps } from "./BaseEmailWrapper";import { BaseLink } from "./BaseLink";interface AccessPamRequestBypassedTemplateProps extends Omit<BaseEmailWrapperProps, "title" | "preview" | "children"> {- projectName: string;requesterFullName: string;requesterEmail: string;resourceName?: string;accountName?: string;accessDuration: string;bypassReason: string;- approvalUrl: string;}export const AccessPamRequestBypassedTemplate = ({- projectName,siteUrl,requesterFullName,requesterEmail,resourceName,accountName,accessDuration,- bypassReason,- approvalUrl+ bypassReason}: AccessPamRequestBypassedTemplateProps) => {const target = [resourceName, accountName].filter(Boolean).join(" / ") || "PAM resource";@@ -36,7 +31,7 @@ export const AccessPamRequestBypassedTemplate = ({siteUrl={siteUrl}><Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">- A PAM access approval has been bypassed in the project <strong>{projectName}</strong>+ A PAM access approval has been bypassed in <strong>Privileged Access Manager</strong></Heading><Section className="px-[24px] mb-[28px] mt-[36px] pt-[12px] pb-[8px] border border-solid border-gray-200 rounded-md bg-gray-50"><Text className="text-black text-[14px] leading-[24px]">@@ -49,9 +44,6 @@ export const AccessPamRequestBypassedTemplate = ({{bypassReason}"</Text></Section>- <Section className="text-center">- <BaseButton href={approvalUrl}>Review Bypass</BaseButton>- </Section></BaseEmailWrapper>);};@@ -65,6 +57,5 @@ AccessPamRequestBypassedTemplate.PreviewProps = {accountName: "postgres",accessDuration: "1h",siteUrl: "https://infisical.com",- projectName: "Example Project",bypassReason: "Production database failover playbook needed."} as AccessPamRequestBypassedTemplateProps;diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.tsindex 16da13d1af..7c6587a1c6 100644--- a/backend/src/services/telemetry/telemetry-types.ts+++ b/backend/src/services/telemetry/telemetry-types.ts@@ -133,6 +133,7 @@ export enum PostHogEventTypes {PamAccountRotated = "PAM Account Rotated",PamAccessRequestCreated = "PAM Access Request Created",PamAccessRequestReviewed = "PAM Access Request Reviewed",+ PamAccessRequestBrokeGlass = "PAM Access Request Broke Glass",PamAccessGrantRevoked = "PAM Access Grant Revoked",ResourceAuthMethodLogin = "Resource Auth Method Login",@@ -1226,6 +1227,14 @@ export type TPamAccessRequestReviewedEvent = {};};+export type TPamAccessRequestBrokeGlassEvent = {+ event: PostHogEventTypes.PamAccessRequestBrokeGlass;+ properties: {+ orgId: string;+ accountType: string;+ };+};+export type TPamAccessGrantRevokedEvent = {event: PostHogEventTypes.PamAccessGrantRevoked;properties: {@@ -2430,6 +2439,7 @@ export type TPostHogEvent = {| TPamAccountRotatedEvent| TPamAccessRequestCreatedEvent| TPamAccessRequestReviewedEvent+ | TPamAccessRequestBrokeGlassEvent| TPamAccessGrantRevokedEvent| TResourceAuthMethodEvent| THoneyTokenCreatedEventdiff --git a/docs/documentation/platform/pam/access-requests/overview.mdx b/docs/documentation/platform/pam/access-requests/overview.mdxindex 244dbdf2dd..8481ccd394 100644--- a/docs/documentation/platform/pam/access-requests/overview.mdx+++ b/docs/documentation/platform/pam/access-requests/overview.mdx@@ -102,6 +102,68 @@ graph LRRejected, expired, and revoked requests stay in the list so the audit trail stays complete.+## Break-glass access++Break-glass access lets a named responder clear their own pending request without an approver. Every approver who was skipped is notified immediately.++It grants no standing access. The responder still files a request, still gives a reason, and still gets a time-boxed grant. The only thing that changes is who signs it off.++### The two switches++Break-glass needs two switches on, and a different person owns each one:++- The **Product Admin** turns on **Allow Break-Glass** on the [template](/documentation/platform/pam/templates/overview). This sets which accounts can ever be broken into.+- The **Folder Admin** names the break-glass approvers on the folder's **Approvals** tab. This sets who can do it.++An empty break-glass list means nobody, not everybody, so the template policy on its own changes nothing until a Folder Admin names someone.++<Note>+ **Allow Break-Glass** does nothing without **Require Approval** on the same template. Break-glass skips an approval, so an account that never needed one has nothing to skip.+</Note>++```mermaid+graph TD+ T["Product Admin<br/>turns on Allow Break-Glass<br/>on the template"]+ F["Folder Admin<br/>names break-glass approvers<br/>on the Approvals tab"]+ B["Responder can break glass"]++ T --> B+ F --> B+```++### Setting it up++<Steps>+ <Step title="Turn on the template policy (Product Admin)">+ Go to **Privileged Access Management → Account Templates**, open the template, and turn on **Allow Break-Glass** alongside **Require Approval**.+ </Step>+ <Step title="Name the responders (Folder Admin)">+ Open the folder, go to its **Approvals** tab, and add users or groups under **Break-Glass Approvers**.++ Break-glass approvers must be members of the folder, same as ordinary approvers, so the picker only offers people who already belong to it. Keep the list to your on-call responders rather than everyone who might need the account.+ </Step>+</Steps>++### Breaking glass++A break-glass approver files a request the usual way, with a reason and a duration. While it's pending, the request sheet offers **Break glass** below the approval workflow.++Breaking glass takes a second reason, at least 10 characters, for why this can't wait for an approver. Select **Break glass** and the grant opens straight away, for the duration the request asked for.++Nothing else about the grant changes. It expires on the same clock, a Folder Admin can revoke it the same way, and sessions on it are recorded like any other.++### What happens next++Every use of break-glass:++- Emails every approver who was skipped, with the reason given+- Notifies them in the app+- Posts to the folder's Slack channels, if you've configured notifications on the folder+- Writes a **PAM Access Policy Bypassed** entry to the [audit log](/documentation/platform/pam/auditing) with the reason, the account, the folder, and how many approvers were skipped+- Marks the request with a **Break-glass** badge, in the folder's request history and in the approver's own queue++The badge and the audit entry are permanent.+## Requests from AI agentsAn agent requests access on the same terms as a person, but from the [CLI](/cli/commands/pam-agentic) instead of the dashboard. A request from an agent running as a machine identity shows the identity's name in place of a requester's email; one from an agent you started yourself is filed under your own name.@@ -130,6 +192,18 @@ When an agent reaches for a gated account, the request is filed for it automatic<Accordion title="Who can revoke access once it is granted?">A Folder Admin. Revoking ends an active request right away and cuts off access before its duration runs out. Any active session using that access is terminated immediately.</Accordion>+ <Accordion title="Can a machine identity or an AI agent break glass?">+ No. Only users can be named as break-glass approvers, the same rule that keeps a machine identity from being an ordinary approver.+ </Accordion>+ <Accordion title="Can someone break glass on another person's request?">+ No. Break-glass clears your own pending request and nothing else.+ </Accordion>+ <Accordion title="Does break-glass give longer or wider access than an approval?">+ No. The grant is the one the request asked for: same duration, same account, same expiry. A Folder Admin can revoke it early, and sessions on it are recorded like any other. The only difference is that no approver signed it off.+ </Accordion>+ <Accordion title="What happens if the account moves or the folder's policy changes mid-request?">+ Infisical runs the same checks it runs for an approval, and refuses rather than granting access under a folder's old rules. That covers an account that moved to another folder or was removed, and a folder whose approvers were cleared. You'll also lose the ability to break glass if you're dropped from the folder, or from its break-glass list, while your request is pending.+ </Accordion><Accordion title="Do changes to a folder's approvers apply to requests already in flight?">Removing an approver takes effect right away: someone dropped from the folder's approvers can no longer act on a request that is still pending. Adding an approver does not reach back into requests already in flight, so a pending request can only be cleared by the approvers it had when it was created. An approved request is already granted and keeps its access until it expires or is revoked, whatever changes afterward.</Accordion>diff --git a/docs/documentation/platform/pam/auditing.mdx b/docs/documentation/platform/pam/auditing.mdxindex 5bd822e0f5..b278478066 100644--- a/docs/documentation/platform/pam/auditing.mdx+++ b/docs/documentation/platform/pam/auditing.mdx@@ -16,6 +16,7 @@ PAM logs every action — who accessed what, who changed what, and when. This au| **Templates** | Template created, updated, deleted || **Memberships** | Membership added, updated, removed || **Product Access** | Product member added, removed, role changed |+| **[Access requests](/documentation/platform/pam/access-requests/overview)** | Request filed, reviewed, revoked, approval policy bypassed |Each event includes:- **Timestamp** — when it happened@@ -55,6 +56,8 @@ Audit logs are retained according to your organization's policy. Events are immu**Activity reports** — Filter by actor to see everything a specific user or machine identity did.+**Break-glass review**: Filter for **PAM Access Policy Bypassed** to see every grant that skipped an approver, with the reason given. Each entry names the account, the folder, and how many approvers were skipped.+## Next steps<CardGroup cols={2}>diff --git a/docs/documentation/platform/pam/templates/overview.mdx b/docs/documentation/platform/pam/templates/overview.mdxindex b24ba4542b..aee9eeb8d4 100644--- a/docs/documentation/platform/pam/templates/overview.mdx+++ b/docs/documentation/platform/pam/templates/overview.mdx@@ -34,11 +34,17 @@ If you need different rules — say, 4-hour sessions with MFA for production —<Step title="Configure policies">| Option | What it does ||--------|--------------|+ | **Require Approval** | Users must request and be granted [access](/documentation/platform/pam/access-requests/overview) before connecting |+ | **Allow Break-Glass** | Named responders can clear their own request without an approver, for emergencies || **Require MFA** | Users must re-authenticate with MFA before connecting || **Require Reason** | A reason must be provided before connecting || **Max Session Duration** | How long someone can stay connected (in seconds) || **Command Blocking** | Regex patterns for commands to reject (one per line). Currently SSH only. |+ <Note>+ **Allow Break-Glass** needs **Require Approval** on the same template, and it stays off until a Folder Admin names the responders on the folder's **Approvals** tab. See [break-glass access](/documentation/platform/pam/access-requests/overview#break-glass-access).+ </Note>+<Note>**Require MFA** puts an account out of reach of [AI agents](/documentation/platform/pam/ai-agents/overview), which cannot complete the challenge yet, and of [machine identities](/documentation/platform/identities/machine-identities), which never can. For accounts an agent needs, use a template without it and gate access with [approvals](/documentation/platform/pam/access-requests/overview) instead.</Note>diff --git a/frontend/src/hooks/api/auditLogs/types.tsx b/frontend/src/hooks/api/auditLogs/types.tsxindex 43ec9f84e1..85d0d3b38d 100644--- a/frontend/src/hooks/api/auditLogs/types.tsx+++ b/frontend/src/hooks/api/auditLogs/types.tsx@@ -948,6 +948,8 @@ interface PamAccessPolicyBypassedEvent {requestId: string;grantId: string;granteeUserId: string;+ accountId?: string;+ folderId?: string;resourceName?: string;accountName?: string;accessDuration: string;diff --git a/frontend/src/hooks/api/pam/enums.ts b/frontend/src/hooks/api/pam/enums.tsindex 261fe22a7d..e1374d66b2 100644--- a/frontend/src/hooks/api/pam/enums.ts+++ b/frontend/src/hooks/api/pam/enums.ts@@ -64,6 +64,7 @@ export const formatRotationInterval = (seconds: number | null | undefined): striexport enum PamPolicyType {RequiresApproval = "requires-approval",+ AllowBreakGlass = "allow-break-glass",RequireMfa = "require-mfa",RequireReason = "require-reason",MaxSessionDuration = "max-session-duration",diff --git a/frontend/src/hooks/api/pam/mutations.tsx b/frontend/src/hooks/api/pam/mutations.tsxindex d08b5b0649..f0a58aa1b1 100644--- a/frontend/src/hooks/api/pam/mutations.tsx+++ b/frontend/src/hooks/api/pam/mutations.tsx@@ -14,6 +14,7 @@ import {TAddPamProductGroupMemberDTO,TAddPamProductIdentityMemberDTO,TAddPamProductUserMemberDTO,+ TBreakGlassPamAccessRequestDTO,TCreatePamAccessRequestDTO,TCreatePamAccountDTO,TCreatePamAccountTemplateDTO,@@ -825,13 +826,35 @@ export const useRevokePamAccessRequest = () => {});};+export const useBreakGlassPamAccessRequest = () => {+ const queryClient = useQueryClient();+ return useMutation({+ mutationFn: async ({ requestId, bypassReason }: TBreakGlassPamAccessRequestDTO) => {+ const { data } = await apiRequest.post(+ `/api/v1/pam/access-requests/${requestId}/break-glass`,+ { bypassReason }+ );+ return data;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: pamKeys.accessRequest() });+ queryClient.invalidateQueries({ queryKey: pamKeys.account() });+ }+ });+};+export const useSetPamApprovalConfig = () => {const queryClient = useQueryClient();return useMutation({- mutationFn: async ({ folderId, steps, notificationConfigs }: TSetPamApprovalConfigDTO) => {+ mutationFn: async ({+ folderId,+ steps,+ notificationConfigs,+ breakGlassApprovers+ }: TSetPamApprovalConfigDTO) => {const { data } = await apiRequest.put(`/api/v1/pam/folders/${folderId}/approval-configuration`,- { steps, notificationConfigs }+ { steps, notificationConfigs, breakGlassApprovers });return data;},diff --git a/frontend/src/hooks/api/pam/queries.tsx b/frontend/src/hooks/api/pam/queries.tsxindex 48d6018910..5cfd8af87f 100644--- a/frontend/src/hooks/api/pam/queries.tsx+++ b/frontend/src/hooks/api/pam/queries.tsx@@ -213,6 +213,8 @@ export type TPamAccountListItem = {requireReason: boolean;accessStatus: PamAccessStatus;grantExpiresAt: string | null;+ pendingRequestId: string | null;+ canBreakGlass: boolean;permissions: ResourcePermissionResponse<PamFolderPermissionSet>["permissions"];createdAt: string;updatedAt: string;diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.tsindex 2cc4b99c6f..b62625220e 100644--- a/frontend/src/hooks/api/pam/types/index.ts+++ b/frontend/src/hooks/api/pam/types/index.ts@@ -339,6 +339,8 @@ export type TAccessiblePamAccount = {requireReason?: boolean;accessStatus?: PamAccessStatus;grantExpiresAt?: string | null;+ pendingRequestId: string | null;+ canBreakGlass: boolean;disabledReason?: string | null;createdAt: string;updatedAt: string;@@ -700,6 +702,8 @@ export type TPamAccessRequest = {host?: string;grantExpiresAt?: string | null;grantStatus?: string | null;+ isBreakGlass?: boolean;+ bypassReason?: string | null;};export type TPamNotificationConfig = {@@ -717,6 +721,7 @@ export type TPamApprovalConfig = {integration: string;integrationSlug: string;})[];+ breakGlassApprovers: { type: PamApproverType; id: string }[];};export type TPamAccessGrant = {@@ -749,10 +754,16 @@ export type TRevokePamAccessRequestDTO = {requestId: string;};+export type TBreakGlassPamAccessRequestDTO = {+ requestId: string;+ bypassReason: string;+};+export type TSetPamApprovalConfigDTO = {folderId: string;steps: {approvers: { type: PamApproverType; id: string }[];}[];notificationConfigs?: TPamNotificationConfig[];+ breakGlassApprovers?: { type: PamApproverType; id: string }[];};diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsxindex e89d36581a..d21a800a4c 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx@@ -60,6 +60,8 @@ export const FolderAccountRow = ({requireReason: account.requireReason,accessStatus,grantExpiresAt: account.grantExpiresAt,+ pendingRequestId: account.pendingRequestId,+ canBreakGlass: account.canBreakGlass,createdAt: account.createdAt,updatedAt: account.updatedAt};diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsxindex 42a44c4e9a..ea0e6a63b3 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx@@ -1,6 +1,13 @@import { useEffect, useMemo, useState } from "react";import { components, OptionProps } from "react-select";-import { Ban, FilterIcon, Trash2, User as UserIcon, Users as UsersIcon } from "lucide-react";+import {+ Ban,+ FilterIcon,+ ShieldAlert,+ Trash2,+ User as UserIcon,+ Users as UsersIcon+} from "lucide-react";import { twMerge } from "tailwind-merge";import { createNotification } from "@app/components/notifications";@@ -136,6 +143,7 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {};const [approvers, setApprovers] = useState<ApproverEntry[]>([]);+ const [breakGlassApprovers, setBreakGlassApprovers] = useState<ApproverEntry[]>([]);const [isDirty, setIsDirty] = useState(false);const [notificationConfigs, setNotificationConfigs] = useState<TPamNotificationConfig[]>([]);@@ -144,6 +152,11 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {return config.steps[0].approvers.map((a) => ({ type: a.type, id: a.id }));}, [config]);+ const savedBreakGlassApprovers = useMemo(+ () => (config?.breakGlassApprovers ?? []).map((a) => ({ type: a.type, id: a.id })),+ [config]+ );+const savedNotificationConfigs = useMemo<TPamNotificationConfig[]>(() =>(config?.notificationConfigs ?? []).map((c) => ({@@ -167,6 +180,10 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {setIsDirty(false);}, [savedApprovers]);+ useEffect(() => {+ setBreakGlassApprovers(savedBreakGlassApprovers);+ }, [savedBreakGlassApprovers]);+useEffect(() => {setNotificationConfigs(savedNotificationConfigs);}, [savedNotificationConfigs]);@@ -175,7 +192,11 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {() => JSON.stringify(notificationConfigs) !== JSON.stringify(savedNotificationConfigs),[notificationConfigs, savedNotificationConfigs]);- const isAnyDirty = isDirty || isNotifDirty;+ const isBreakGlassDirty = useMemo(+ () => JSON.stringify(breakGlassApprovers) !== JSON.stringify(savedBreakGlassApprovers),+ [breakGlassApprovers, savedBreakGlassApprovers]+ );+ const isAnyDirty = isDirty || isNotifDirty || isBreakGlassDirty;useEffect(() => {onDirtyChange?.(isAnyDirty);@@ -187,6 +208,11 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {[approvers]);+ const selectedBreakGlassIds = useMemo(+ () => new Set(breakGlassApprovers.map((a) => `${a.type}:${a.id}`)),+ [breakGlassApprovers]+ );+const userMap = useMemo(() =>new Map(@@ -240,6 +266,31 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {return [...groups, ...users];}, [orgGroups, orgUsers, selectedIds, memberUserIds, memberGroupIds]);+ const breakGlassOptions = useMemo<ApproverOption[]>(() => {+ const groups: ApproverOption[] = (orgGroups ?? [])+ .filter((g) => memberGroupIds.has(g.id) && !selectedBreakGlassIds.has(`group:${g.id}`))+ .map((g) => ({ value: g.id, label: g.name, kind: PamApproverType.Group, subtitle: "Group" }));++ const users: ApproverOption[] = (orgUsers ?? [])+ .filter(+ (ou) =>+ ou.user.id &&+ memberUserIds.has(ou.user.id) &&+ !selectedBreakGlassIds.has(`user:${ou.user.id}`)+ )+ .map((ou) => {+ const name = [ou.user.firstName, ou.user.lastName].filter(Boolean).join(" ");+ return {+ value: ou.user.id,+ label: name || ou.user.email || ou.inviteEmail || ou.user.username,+ kind: PamApproverType.User,+ subtitle: ou.user.email ?? ou.inviteEmail ?? ""+ };+ });++ return [...groups, ...users];+ }, [orgGroups, orgUsers, selectedBreakGlassIds, memberUserIds, memberGroupIds]);+const addApprover = (opt: ApproverOption | null) => {if (!opt) return;setApprovers((prev) => [...prev, { type: opt.kind, id: opt.value }]);@@ -251,6 +302,15 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {setIsDirty(true);};+ const addBreakGlassApprover = (opt: ApproverOption | null) => {+ if (!opt) return;+ setBreakGlassApprovers((prev) => [...prev, { type: opt.kind, id: opt.value }]);+ };++ const removeBreakGlassApprover = (index: number) => {+ setBreakGlassApprovers((prev) => prev.filter((_, i) => i !== index));+ };+const handleSave = () => {const hasIncompleteConfig =isPamSlackEnabled &&@@ -265,10 +325,19 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {return;}+ if (breakGlassApprovers.length > 0 && approvers.length === 0) {+ createNotification({+ type: "error",+ text: "Break-glass approvers need at least one approver to bypass"+ });+ return;+ }+setConfig.mutate({folderId,steps: [{ approvers }],+ breakGlassApprovers,// undefined leaves server-side configs untouched when the plan doesn't include the featurenotificationConfigs: isPamSlackEnabled ? notificationConfigs : undefined},@@ -286,6 +355,7 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {const handleDiscard = () => {setApprovers(savedApprovers);+ setBreakGlassApprovers(savedBreakGlassApprovers);setNotificationConfigs(savedNotificationConfigs);setIsDirty(false);};@@ -387,6 +457,94 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {</CardContent></Card>+ <Card>+ <CardHeader className="border-b">+ <CardTitle className="text-base">+ Break-Glass Approvers+ <Badge variant="pam">{breakGlassApprovers.length}</Badge>+ </CardTitle>+ <CardDescription>+ Users and groups who may self-approve their own request for accounts in this folder,+ skipping the approvers above. Only applies to accounts whose template has the Allow+ Break-Glass policy on. Every use is recorded in the audit log and emailed to the+ approvers who were skipped.+ </CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-4">+ <FilterableSelect+ value={null}+ options={breakGlassOptions}+ onChange={(opt) => addBreakGlassApprover(opt as ApproverOption | null)}+ getOptionValue={(opt) => `${opt.kind}:${opt.value}`}+ getOptionLabel={(opt) => opt.label}+ components={{ Option: ApproverSelectOption }}+ placeholder="Add a user or group..."+ noOptionsMessage={() =>+ "No eligible folder members left. Add users or groups to this folder under the Permissions tab first."+ }+ />++ {breakGlassApprovers.length === 0 ? (+ <div className="rounded-md border border-border p-8 text-center text-sm text-muted">+ No break-glass approvers configured. Nobody can bypass approval in this folder.+ </div>+ ) : (+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>Approver</TableHead>+ <TableHead>Type</TableHead>+ <TableHead variant="action" />+ </TableRow>+ </TableHeader>+ <TableBody>+ {breakGlassApprovers.map((approver, idx) => {+ const Icon = KIND_ICON[approver.type];+ const displayName =+ approver.type === PamApproverType.User+ ? (userMap.get(approver.id)?.label ?? approver.id)+ : (groupMap.get(approver.id) ?? approver.id);+ const subtitle =+ approver.type === PamApproverType.User+ ? userMap.get(approver.id)?.email+ : undefined;++ return (+ <TableRow key={`bg-${approver.type}-${approver.id}`} className="h-14">+ <TableCell>+ <div className="flex items-center gap-2.5">+ <Icon className="size-4 shrink-0 text-muted" />+ <div className="flex flex-col">+ <span className="text-sm font-medium">{displayName}</span>+ {subtitle && <span className="text-xs text-muted">{subtitle}</span>}+ </div>+ </div>+ </TableCell>+ <TableCell>+ <Badge variant="neutral">+ {approver.type === PamApproverType.User ? "User" : "Group"}+ </Badge>+ </TableCell>+ <TableCell variant="action">+ <IconButton+ variant="ghost"+ size="xs"+ aria-label="Remove break-glass approver"+ className="text-muted hover:text-danger"+ onClick={() => removeBreakGlassApprover(idx)}+ >+ <Trash2 className="size-4" />+ </IconButton>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>+ )}+ </CardContent>+ </Card>+{isPamSlackEnabled && (<FolderNotificationsSectionconfigs={notificationConfigs}@@ -477,7 +635,23 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {</div></TableCell><TableCell>- <Badge variant={status.variant}>{status.label}</Badge>+ <div className="flex items-center gap-1.5">+ <Badge variant={status.variant}>{status.label}</Badge>+ {request.isBreakGlass && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="danger">+ <ShieldAlert className="mr-1 size-3" />+ Break-glass+ </Badge>+ </TooltipTrigger>+ <TooltipContent>+ Self-approved, skipping the approvers.+ {request.bypassReason ? ` Reason: "${request.bypassReason}"` : ""}+ </TooltipContent>+ </Tooltip>+ )}+ </div></TableCell>{canRevoke && (<TableCell variant="action" onClick={(e) => e.stopPropagation()}>diff --git a/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsx b/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsxindex d6552f660e..6584d2288b 100644--- a/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsx+++ b/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsx@@ -3,7 +3,7 @@ import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";import { useNavigate, useSearch } from "@tanstack/react-router";import { format } from "date-fns";-import { FolderOpen, SearchIcon, ShieldCheck } from "lucide-react";+import { FolderOpen, SearchIcon, ShieldAlert, ShieldCheck } from "lucide-react";import { PageHeader } from "@app/components/v2";import {@@ -78,7 +78,15 @@ const RequestRow = ({{format(new Date(request.createdAt), "MMM d, yyyy h:mm a")}</TableCell><TableCell>- <Badge variant={status.variant}>{status.label}</Badge>+ <div className="flex items-center gap-1.5">+ <Badge variant={status.variant}>{status.label}</Badge>+ {request.isBreakGlass && (+ <Badge variant="danger">+ <ShieldAlert className="mr-1 size-3" />+ Break-glass+ </Badge>+ )}+ </div></TableCell></TableRow>);diff --git a/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx b/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsxindex 15874c47e9..3419e8a0fc 100644--- a/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx+++ b/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx@@ -1,6 +1,6 @@import { useEffect, useState } from "react";import { format } from "date-fns";-import { Check, Clock, ShieldCheck, X } from "lucide-react";+import { Check, Clock, ShieldAlert, ShieldCheck, X } from "lucide-react";import { createNotification } from "@app/components/notifications";import { DeleteActionModal } from "@app/components/v2";@@ -130,6 +130,26 @@ export const ApprovalRequestDetailSheet = ({ request, isOpen, onOpenChange }: Pr><div className="flex h-full flex-1 flex-col p-6"><div className="flex flex-1 flex-col gap-6">+ {request?.isBreakGlass && (+ <div className="flex gap-2.5 rounded-md border border-danger/40 bg-danger/5 p-4">+ <ShieldAlert className="mt-0.5 size-4 shrink-0 text-danger" />+ <div className="min-w-0">+ <p className="text-sm font-medium text-foreground">+ Approval bypassed with break-glass+ </p>+ <p className="mt-1 text-xs text-muted">+ {request.requesterName} granted themselves this access without waiting for an+ approver.+ </p>+ {request.bypassReason && (+ <p className="mt-2 text-xs text-foreground">+ <span className="text-muted">Reason:</span> {request.bypassReason}+ </p>+ )}+ </div>+ </div>+ )}+{isPending && (<div><p className="mb-2 text-sm font-medium text-foreground">Approval comment</p>diff --git a/frontend/src/pages/pam/components/RequestAccessSheet.tsx b/frontend/src/pages/pam/components/RequestAccessSheet.tsxindex 4b558d1bb6..e12e93b5aa 100644--- a/frontend/src/pages/pam/components/RequestAccessSheet.tsx+++ b/frontend/src/pages/pam/components/RequestAccessSheet.tsx@@ -1,4 +1,4 @@-import { useMemo } from "react";+import { useMemo, useState } from "react";import { Controller, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import {@@ -6,6 +6,7 @@ import {GitBranch,ListChecks,Send,+ ShieldAlert,User as UserIcon,Users as UsersIcon} from "lucide-react";@@ -15,6 +16,11 @@ import { createNotification } from "@app/components/notifications";import {Badge,Button,+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,Field,FieldContent,FieldDescription,@@ -33,6 +39,7 @@ import {PamApproverType,TAccessiblePamAccount,TPamApprovalWorkflowStep,+ useBreakGlassPamAccessRequest,useCreatePamAccessRequest,useGetPamAccountApprovers} from "@app/hooks/api/pam";@@ -140,7 +147,10 @@ const ApprovalWorkflow = ({ accountId, isPending }: { accountId?: string; isPendexport const RequestAccessSheet = ({ account, isOpen, onOpenChange }: Props) => {const { typeName, subtitle, metadata } = useAccountSheetDetails(account, isOpen);const createRequest = useCreatePamAccessRequest();+ const breakGlass = useBreakGlassPamAccessRequest();+ const [bypassReason, setBypassReason] = useState("");const isPending = account?.accessStatus === PamAccessStatus.Pending;+ const canBreakGlass = Boolean(account?.canBreakGlass && account?.pendingRequestId);const requireReason = Boolean(account?.requireReason);const schema = useMemo(() => makeSchema(requireReason), [requireReason]);@@ -155,10 +165,30 @@ export const RequestAccessSheet = ({ account, isOpen, onOpenChange }: Props) =>});const handleOpenChange = (open: boolean) => {- if (!open) reset();+ if (!open) {+ reset();+ setBypassReason("");+ }onOpenChange(open);};+ const onBreakGlass = () => {+ if (!account?.pendingRequestId) return;+ breakGlass.mutate(+ { requestId: account.pendingRequestId, bypassReason: bypassReason.trim() },+ {+ onSuccess: () => {+ createNotification({+ text: "Access granted. The approvers you skipped have been notified.",+ type: "success"+ });+ setBypassReason("");+ onOpenChange(false);+ }+ }+ );+ };+const onSubmit = (data: FormData) => {if (!account) return;createRequest.mutate(@@ -197,6 +227,46 @@ export const RequestAccessSheet = ({ account, isOpen, onOpenChange }: Props) =><p className="text-sm text-foreground">Your access request is awaiting approval.</p></div><ApprovalWorkflow accountId={account?.id} isPending />+ {canBreakGlass && (+ <Card>+ <CardHeader className="border-b">+ <CardTitle className="text-base">+ <ShieldAlert className="size-4 shrink-0 text-danger" />+ Break glass+ </CardTitle>+ <CardDescription>+ Grant yourself access now without waiting for an approver. Use this only in an+ emergency: the approvers above are notified immediately and the reason you give+ is recorded in the audit log.+ </CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-4">+ <Field>+ <FieldLabel>+ Reason <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <TextArea+ rows={3}+ value={bypassReason}+ onChange={(e) => setBypassReason(e.target.value)}+ placeholder="Why can this not wait for an approver?"+ />+ <FieldDescription>At least 10 characters.</FieldDescription>+ </FieldContent>+ </Field>+ <Button+ variant="danger"+ className="self-end"+ isDisabled={bypassReason.trim().length < 10}+ isPending={breakGlass.isPending}+ onClick={onBreakGlass}+ >+ Break glass+ </Button>+ </CardContent>+ </Card>+ )}</div>) : (<form onSubmit={handleSubmit(onSubmit)} className="flex flex-1 flex-col">diff --git a/frontend/src/pages/pam/components/policyEditors/index.tsx b/frontend/src/pages/pam/components/policyEditors/index.tsxindex 64601d4241..efce9fff87 100644--- a/frontend/src/pages/pam/components/policyEditors/index.tsx+++ b/frontend/src/pages/pam/components/policyEditors/index.tsx@@ -16,6 +16,7 @@ const CommandBlockingEditor = (props: PolicyEditorProps) => (export const POLICY_EDITORS: Partial<Record<PamPolicyType, ComponentType<PolicyEditorProps>>> = {[PamPolicyType.RequiresApproval]: BooleanPolicyEditor,+ [PamPolicyType.AllowBreakGlass]: BooleanPolicyEditor,[PamPolicyType.RequireMfa]: BooleanPolicyEditor,[PamPolicyType.RequireReason]: BooleanPolicyEditor,[PamPolicyType.MaxSessionDuration]: DurationPolicyEditor,