Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge remote-tracking branch 'origin/main' into PAM-437

Andrey724a96c34725
diff --cc backend/src/ee/routes/v1/pam-routers/pam-access-request-router.ts
index d23352cfd9,3cf70be19e..302880a884
--- 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
@@@ -17,10 -14,9 +18,11 @@@ const EnrichedRequestSchema = ApprovalR
accountName: z.string().nullable(),
accountType: z.string().nullable(),
folderName: z.string().nullable(),
+ accessType: z.nativeEnum(PamAccessType),
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) => {
diff --cc backend/src/ee/routes/v1/pam-routers/pam-account-router.ts
index c378f2b5ac,5cd1b27646..eb449b8005
--- 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,8 -62,8 +62,14 @@@ const PamAccountListItemSchema = Saniti
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"),
+ supportsCredentialReveal: z.boolean().describe("Whether this account type stores a credential that can be revealed"),
+ credentialAccessStatus: z.nativeEnum(PamAccessStatus).describe("Current credential-approval status for the caller"),
++ credentialPendingRequestId: z
++ .string()
++ .nullable()
++ .describe("The caller's pending credential access request for this account, if any"),
permissions: z.any().array().describe("The caller's effective (packed) resource permissions on this account")
});
diff --cc backend/src/ee/services/pam-access-request/pam-access-request-service.ts
index 53f8b854e1,62e3a5a189..e4110ee62d
--- 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
@@@ -714,16 -631,19 +728,25 @@@ export const pamAccessRequestServiceFac
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) => {
+ const createRequest = async ({
+ accountId,
+ path,
+ projectId,
+ reason,
+ duration,
+ accessType = PamAccessType.Session,
+ ...ctx
+ }: TCreateAccessRequestDTO) => {
+ const isCredentialRequest = accessType === PamAccessType.Credential;
const trimmedReason = reason?.trim() || undefined;
await verifyProductMembership(permissionService, projectId, ctx);
@@@ -1358,263 -1321,6 +1424,267 @@@
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: `**${escapeMarkdown(request.requesterName ?? "A user")}** used break-glass to self-approve access to **${escapeMarkdown(account.name)}**. Reason: "${escapeMarkdown(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" });
+ }
+
++ // Break-glass skips the approver, not the permission the request itself needed.
++ const accessType = requestData.requestData.accessType ?? PamAccessType.Session;
+ await checkAccountAccess(
+ permissionService,
+ account.id,
+ account.folderId,
+ projectId,
- ResourcePermissionPamResourceActions.LaunchSessions,
++ accessType === PamAccessType.Credential
++ ? ResourcePermissionPamResourceActions.ViewCredentials
++ : 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 },
++ attributes: { accountId, folderId, accessType },
+ 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,
+ policyName: policy.name,
+ accountName: account.name,
+ folderName: account.folderName,
+ granteeName: request.requesterName,
+ granteeEmail: request.requesterEmail,
+ 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
@@@ -1829,14 -1546,10 +1910,15 @@@
const getAccessStatusBatch = async (
actorCtx: TAccessRequestActor,
accountIds: string[],
- projectId: string
+ projectId: string,
+ accessType: PamAccessType = PamAccessType.Session
- ): 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();
@@@ -1850,12 -1563,12 +1932,13 @@@
for (const grant of activeGrants) {
const isExpired = Boolean(grant.expiresAt && new Date(grant.expiresAt) <= now);
- const attrs = grant.attributes as { accountId?: string } | null;
- if (!isExpired && attrs?.accountId && accountIds.includes(attrs.accountId)) {
+ const attrs = grant.attributes as { accountId?: string; accessType?: PamAccessType } | null;
+ const grantAccessType = attrs?.accessType ?? PamAccessType.Session;
+ if (!isExpired && grantAccessType === accessType && 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
});
}
}
@@@ -1870,12 -1583,9 +1953,13 @@@
for (const request of pendingRequests) {
const data = request.requestData as { version: number; requestData: TPamAccessRequestData } | null;
const acctId = data?.requestData?.accountId;
- if (acctId && accountIds.includes(acctId) && !result.has(acctId)) {
+ const requestAccessType = data?.requestData?.accessType ?? PamAccessType.Session;
+ if (requestAccessType === accessType && 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
+ });
}
}
@@@ -1894,40 -1604,14 +1978,47 @@@
return new Set(scopeIds);
};
++ // Of the given folders, the ones where this actor is a named break-glass approver. Drives whether the
++ // account list offers the break-glass action at all.
+ 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) => {
+ // Requesters need to know who to ping for approval, so this is gated on the permission the
+ // request itself needs rather than the policy-management check used for the full config.
+ const getAccountApprovers = async ({
+ accountId,
+ projectId,
+ accessType = PamAccessType.Session,
+ ...ctx
+ }: TGetAccountApproversDTO) => {
await verifyProductMembership(permissionService, projectId, ctx);
const account = await pamAccountDAL.findByIdWithDetails(accountId);
diff --cc backend/src/ee/services/pam-account/pam-account-service.ts
index 35412e4f75,4ed63888ed..e063b44b9b
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@@ -98,7 -110,7 +110,11 @@@ type TPamAccountServiceFactoryDep =
appConnectionDAL: Pick<TAppConnectionDALFactory, "findOne" | "findById">;
pamAccessRequestService: Pick<
TPamAccessRequestServiceFactory,
- "getAccessStatusBatch" | "getFolderPolicyConfigured" | "getBreakGlassApproverFolders" | "cleanupAccountResources"
- "getAccessStatusBatch" | "getFolderPolicyConfigured" | "cleanupAccountResources" | "checkGrant"
++ | "getAccessStatusBatch"
++ | "getFolderPolicyConfigured"
++ | "getBreakGlassApproverFolders"
++ | "cleanupAccountResources"
++ | "checkGrant"
>;
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
};
@@@ -233,27 -248,40 +252,50 @@@ export const pamAccountServiceFactory
...new Set(accountsRequiringApproval.map((a) => a.folderId).filter(Boolean) as string[])
];
- const [accessStatusMap, foldersWithApprovalPolicy, breakGlassFolders, permissionsByAccountId] = await Promise.all([
+ const { decryptor } = await getProjectCipher(projectId);
+ const revealableById = new Map(
+ accounts.map((a) => [
+ a.id,
+ hasRevealableCredential(
+ a.accountType as PamAccountType,
+ JSON.parse(decryptor({ cipherTextBlob: a.encryptedCredentials }).toString("utf-8")) as Record<string, unknown>
+ )
+ ])
+ );
+
- const [accessStatusMap, credentialAccessStatusMap, foldersWithApprovalPolicy, permissionsByAccountId] =
- await Promise.all([
- deps.pamAccessRequestService.getAccessStatusBatch(
- { actorId: ctx.actorId, actor: ctx.actor },
- accountIdsRequiringApproval,
- projectId
- ),
- deps.pamAccessRequestService.getAccessStatusBatch(
- { actorId: ctx.actorId, actor: ctx.actor },
- accountIdsRequiringApproval,
- projectId,
- PamAccessType.Credential
- ),
- deps.pamAccessRequestService.getFolderPolicyConfigured(folderIdsRequiringApproval),
- // Resolve every account's effective permissions in one membership fetch
- getAccountPermissionRulesMap(
- membershipDAL,
- membershipRoleDAL,
- projectId,
- accounts.map((a) => ({ id: a.id, folderId: a.folderId })),
- ctx
- )
- ]);
++ const [
++ accessStatusMap,
++ credentialAccessStatusMap,
++ foldersWithApprovalPolicy,
++ breakGlassFolders,
++ permissionsByAccountId
++ ] = await Promise.all([
+ deps.pamAccessRequestService.getAccessStatusBatch(
+ { actorId: ctx.actorId, actor: ctx.actor },
+ accountIdsRequiringApproval,
+ projectId
+ ),
++ deps.pamAccessRequestService.getAccessStatusBatch(
++ { actorId: ctx.actorId, actor: ctx.actor },
++ accountIdsRequiringApproval,
++ projectId,
++ PamAccessType.Credential
++ ),
+ 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 fetch
+ getAccountPermissionRulesMap(
+ membershipDAL,
+ membershipRoleDAL,
+ projectId,
+ accounts.map((a) => ({ id: a.id, folderId: a.folderId })),
+ ctx
+ )
+ ]);
return accounts.map((a) => {
const { accessibilityIssues, isAccessible } = computeAccessibility(a);
@@@ -282,8 -312,9 +326,12 @@@
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),
+ credentialAccessStatus: requiresApproval
+ ? (credentialStatusEntry?.accessStatus ?? PamAccessStatus.None)
+ : PamAccessStatus.None,
++ credentialPendingRequestId: credentialStatusEntry?.pendingRequestId ?? null,
permissions: permissionsByAccountId.get(a.id) ?? [],
createdAt: a.createdAt,
updatedAt: a.updatedAt
diff --cc docs/documentation/platform/pam/access-requests/overview.mdx
index b0893c3717,5cfda84fc6..cec6f92ca3
--- a/docs/documentation/platform/pam/access-requests/overview.mdx
+++ b/docs/documentation/platform/pam/access-requests/overview.mdx
@@@ -191,21 -131,11 +193,23 @@@ When an agent reaches for a gated accou
</Accordion>
<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.
+
+ Revoking a credential request is weaker: it stops further reveals, but a credential already copied is outside Infisical and stays valid until the account is rotated. It also leaves live sessions alone, since those are authorized by their own grant.
</Accordion>
+ <Accordion title="Can a machine identity or an AI agent break glass?">
+ No. Only a person can break glass, whether they're named directly or belong to a group that is, 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.
+ 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 doesn't 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>
</AccordionGroup>
diff --cc docs/documentation/platform/pam/templates/overview.mdx
index aee9eeb8d4,2d94458099..e6fb7cde94
--- a/docs/documentation/platform/pam/templates/overview.mdx
+++ b/docs/documentation/platform/pam/templates/overview.mdx
@@@ -34,17 -34,16 +34,21 @@@ If you need different rules — say, 4-
<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 |
+ | **Require Approval** | Users must request and receive approval before launching a session or [viewing credentials](/documentation/platform/pam/accounts/overview#viewing-credentials) |
+ | **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).
+ **Require Approval** gates sessions and credential reveals with one switch, but they are approved separately: a session request never reveals the credential, and a credential request never launches a session. A member who needs both files both.
+ </Note>
+
++ <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. Break-glass clears whichever request it is used on, so a session request grants a session and a credential request grants a reveal. 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 --cc frontend/src/hooks/api/pam/queries.tsx
index 5cfd8af87f,52cf39bf7b..535f3bc722
--- a/frontend/src/hooks/api/pam/queries.tsx
+++ b/frontend/src/hooks/api/pam/queries.tsx
@@@ -213,8 -215,7 +215,10 @@@ export type TPamAccountListItem =
requireReason: boolean;
accessStatus: PamAccessStatus;
grantExpiresAt: string | null;
+ pendingRequestId: string | null;
+ canBreakGlass: boolean;
+ credentialAccessStatus: PamAccessStatus;
++ credentialPendingRequestId: string | null;
permissions: ResourcePermissionResponse<PamFolderPermissionSet>["permissions"];
createdAt: string;
updatedAt: string;
diff --cc frontend/src/hooks/api/pam/types/index.ts
index b62625220e,c9654eb181..00ff180188
--- a/frontend/src/hooks/api/pam/types/index.ts
+++ b/frontend/src/hooks/api/pam/types/index.ts
@@@ -339,8 -351,7 +351,12 @@@ export type TAccessiblePamAccount =
requireReason?: boolean;
accessStatus?: PamAccessStatus;
grantExpiresAt?: string | null;
++ // Required, unlike the fields above: every endpoint returning this shape sets them, and a mapping
++ // site that quietly omitted them is what stopped the break-glass action from ever rendering.
+ pendingRequestId: string | null;
+ canBreakGlass: boolean;
+ credentialAccessStatus?: PamAccessStatus;
++ credentialPendingRequestId?: string | null;
disabledReason?: string | null;
createdAt: string;
updatedAt: string;
@@@ -700,10 -712,9 +717,11 @@@ export type TPamAccessRequest =
accountType?: PamAccountType;
folderName?: string;
host?: string;
+ accessType?: PamAccessType;
grantExpiresAt?: string | null;
grantStatus?: string | null;
+ isBreakGlass?: boolean;
+ bypassReason?: string | null;
};
export type TPamNotificationConfig = {
diff --cc frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx
index d21a800a4c,d9d91cca2d..3177c32725
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx
@@@ -60,8 -65,7 +65,10 @@@ export const FolderAccountRow = (
requireReason: account.requireReason,
accessStatus,
grantExpiresAt: account.grantExpiresAt,
+ pendingRequestId: account.pendingRequestId,
+ canBreakGlass: account.canBreakGlass,
+ credentialAccessStatus: account.credentialAccessStatus,
++ credentialPendingRequestId: account.credentialPendingRequestId,
createdAt: account.createdAt,
updatedAt: account.updatedAt
};
diff --cc frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
index ea0e6a63b3,c5fe761623..f350ee59e5
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
@@@ -634,24 -478,11 +636,27 @@@ export const FolderApprovalsTab = ({ fo
{request.accountName ?? "-"}
</div>
</TableCell>
+ <TableCell>
+ <AccessTypeBadge accessType={request.accessType} />
+ </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 --cc frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx
index 3419e8a0fc,691a4e8fec..10371ff041
--- a/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx
@@@ -1,6 -1,6 +1,6 @@@
import { useEffect, useState } from "react";
import { format } from "date-fns";
- import { Check, Clock, ShieldAlert, ShieldCheck, X } from "lucide-react";
-import { Check, Clock, KeyRound, ShieldCheck, X } from "lucide-react";
++import { Check, Clock, KeyRound, ShieldAlert, ShieldCheck, X } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { DeleteActionModal } from "@app/components/v2";
diff --cc frontend/src/pages/pam/components/RequestAccessSheet.tsx
index e12e93b5aa,dc42c1c568..a2bcd0bfbf
--- a/frontend/src/pages/pam/components/RequestAccessSheet.tsx
+++ b/frontend/src/pages/pam/components/RequestAccessSheet.tsx
@@@ -4,9 -4,10 +4,11 @@@ import { zodResolver } from "@hookform/
import {
Clock,
GitBranch,
+ KeyRound,
ListChecks,
+ Rocket,
Send,
+ ShieldAlert,
User as UserIcon,
Users as UsersIcon
} from "lucide-react";
@@@ -14,13 -15,11 +16,16 @@@ import { z } from "zod"
import { createNotification } from "@app/components/notifications";
import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
Badge,
Button,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
Field,
FieldContent,
FieldDescription,
@@@ -144,13 -153,18 +160,25 @@@ const ApprovalWorkflow = (
);
};
- export const RequestAccessSheet = ({ account, isOpen, onOpenChange }: Props) => {
+ export const RequestAccessSheet = ({
+ account,
+ isOpen,
+ onOpenChange,
+ accessType = PamAccessType.Session
+ }: 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 isCredentialRequest = accessType === PamAccessType.Credential;
+ const isPending =
+ (isCredentialRequest ? account?.credentialAccessStatus : account?.accessStatus) ===
+ PamAccessStatus.Pending;
++ // Session and credential requests are separate rows, so break glass on the one this sheet is for.
++ const pendingRequestId = isCredentialRequest
++ ? account?.credentialPendingRequestId
++ : account?.pendingRequestId;
++ const canBreakGlass = Boolean(account?.canBreakGlass && pendingRequestId);
const requireReason = Boolean(account?.requireReason);
const schema = useMemo(() => makeSchema(requireReason), [requireReason]);
@@@ -172,23 -183,6 +200,23 @@@
onOpenChange(open);
};
+ const onBreakGlass = () => {
- if (!account?.pendingRequestId) return;
++ if (!pendingRequestId) return;
+ breakGlass.mutate(
- { requestId: account.pendingRequestId, bypassReason: bypassReason.trim() },
++ { requestId: 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(
@@@ -224,49 -225,13 +259,53 @@@
<div className="flex flex-1 flex-col gap-6">
<div className="flex items-center gap-2.5 rounded-md border border-border bg-container px-4 py-3">
<Clock className="size-4 shrink-0 text-warning" />
- <p className="text-sm text-foreground">Your access request is awaiting approval.</p>
+ <p className="text-sm text-foreground">
+ {isCredentialRequest
+ ? "Your credential request is awaiting approval."
+ : "Your access request is awaiting approval."}
+ </p>
</div>
- <ApprovalWorkflow accountId={account?.id} isPending />
+ <ApprovalWorkflow accountId={account?.id} isPending accessType={accessType} />
+ {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">