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
allow auto-approval without human approvers
Andrey38c940006871
diff --git a/CLAUDE.md b/CLAUDE.mdindex ec263d174f..2e895e7212 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -151,8 +151,10 @@ stop agreeing.Auto-approval rules (`approval-policy/auto-approval/`) live on the policy and are evaluated once in`createRequest`, outside any transaction, failing closed. Another service becomes checkable by adding aprovider to `AUTO_APPROVAL_PROVIDER_REGISTRY`, keyed by its App Connection, not by per-product code. A-resource gates them per request with `allowsAutoApproval`. The stored evidence holds data fetched from-that service, so responses return only its outcome (`autoApproval`), never `autoApprovalEvidence`.+resource gates them per request with `allowsAutoApproval`. A policy may have rules and no approvers (no+steps): then a request no rule approves is refused at submission, and only break-glass gets past it. The+stored evidence holds data fetched from that service, so responses return only its outcome (`autoApproval`),+never `autoApprovalEvidence`.### API Layer (Frontend)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 9a931a6d47..1c31a0ce25 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@@ -278,7 +278,7 @@ export const registerPamAccessRequestRouter = async (server: FastifyZodProvider)}),response: {200: z.object({- autoApprovalInputs: AutoApprovalInputDetailsSchema.array(),+ autoApprovalOnly: z.boolean(),steps: z.array(z.object({requiredApprovals: z.number(),diff --git a/backend/src/ee/services/pam-access-request/pam-access-approval-resource.ts b/backend/src/ee/services/pam-access-request/pam-access-approval-resource.tsindex 20aaada79e..1d7e2c0c39 100644--- a/backend/src/ee/services/pam-access-request/pam-access-approval-resource.ts+++ b/backend/src/ee/services/pam-access-request/pam-access-approval-resource.ts@@ -396,7 +396,9 @@ export const pamAccessApprovalResourceFactory = ({projectId,policy,requestData,- actor+ actor,+ hasAutoApprovalRules,+ skipsAutoApproval}) => {const inputs = requestData as TPamAccessRequestData;const ctx = toActorContext(actor);@@ -458,12 +460,20 @@ export const pamAccessApprovalResourceFactory = ({}const policySteps = await approvalPolicyDAL.findStepsByPolicyId(policy.id);- if (policySteps.length === 0 || policySteps.some((step) => step.approvers.length === 0)) {+ // A folder with rules and no approvers grants access only through its rules+ const isRulesOnly = policySteps.length === 0 && hasAutoApprovalRules;+ if (!isRulesOnly && (policySteps.length === 0 || policySteps.some((step) => step.approvers.length === 0))) {throw new BadRequestError({message:"This folder's approval policy has no approvers configured. Ask a folder admin to add approvers under the folder's Approvals tab, then submit your request again."});}+ if (isRulesOnly && !skipsAutoApproval && !accessControls.allowAutoApproval) {+ throw new BadRequestError({+ message:+ "Access to this account can't be requested. Its folder has no approvers. Its template also doesn't allow auto-approval. Ask an admin to add approvers to the folder or turn on Allow Auto-Approval in the template."+ });+ }// Dedupe per (account, access type), so a session request isn't blocked by a pending credential one.const pending = await approvalRequestDAL.find({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 a5a961cdc2..efda9a33ac 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@@ -78,7 +78,7 @@ type TPamAccessRequestServiceFactoryDep = {| "revokeGrant"| "getActiveGrant"| "getAccessStatuses"- | "getScopeIdsWithApprovers"+ | "getRequestableScopeIds"| "getBypassableScopeIds"| "reapScope"| "reapSubject"@@ -574,11 +574,11 @@ export const pamAccessRequestServiceFactory = ({return new Map(accountIds.map((accountId, i) => [accountId, statuses[i]]));};- // A folder counts as "configured" only when its policy has at least one approver, so an empty policy- // surfaces the unavailable flag.+ // A folder counts as "configured" only when its policy has an approver or an auto-approval rule, so an+ // empty policy surfaces the unavailable flag.const getFolderPolicyConfigured = async (folderIds: string[]): Promise<Set<string>> =>new Set(- await approvalPolicyService.getScopeIdsWithApprovers(+ await approvalPolicyService.getRequestableScopeIds(ApprovalPolicyType.PamAccess,ApprovalPolicyScope.PamFolder,folderIds@@ -625,7 +625,7 @@ export const pamAccessRequestServiceFactory = ({ctx);- if (!account.folderId) return { steps: [], autoApprovalInputs: [] };+ if (!account.folderId) return { steps: [], autoApprovalInputs: [], autoApprovalOnly: false };return approvalPolicyService.getApproverRoster(ApprovalPolicyType.PamAccess,diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.mdindex 0b51ced92b..9fbde76688 100644--- a/backend/src/ee/services/pam/CLAUDE.md+++ b/backend/src/ee/services/pam/CLAUDE.md@@ -209,7 +209,8 @@ from folder and account auditors (see the audit-log gotcha under Permissions).`requires-approval`, like break-glass) and rules on the folder's approval policy, which PAM saves through thefolder's approval configuration. The rules belong to the shared approval module; PAM only implements`allowsAutoApproval`, the notification, and `PAM_ACCESS_REQUEST_AUTO_APPROVED`. A break-glass request skips-them, since it approves itself.+them, since it approves itself. A folder can have rules and no approvers; its requests are then granted by a+rule or refused at submission.## Discoverydiff --git a/backend/src/services/approval-policy/approval-policy-dal.ts b/backend/src/services/approval-policy/approval-policy-dal.tsindex 9c31630ea5..ed2facc27c 100644--- a/backend/src/services/approval-policy/approval-policy-dal.ts+++ b/backend/src/services/approval-policy/approval-policy-dal.ts@@ -373,9 +373,9 @@ export const approvalPolicyDALFactory = (db: TDbClient) => {}};- // Of the given scopes, return those whose policy actually has at least one approver configured.- // A policy row with no approvers does not count as "configured".- const findScopeIdsWithApprovers = async (args: {+ // Of the given scopes, those whose policy can grant a request: it has an approver or an auto-approval rule.+ // A policy row with neither does not count as "configured".+ const findRequestableScopeIds = async (args: {type: string;scopeType: string;scopeIds: string[];@@ -388,16 +388,36 @@ export const approvalPolicyDALFactory = (db: TDbClient) => {.where(`${TableName.ApprovalPolicies}.type`, args.type).where(`${TableName.ApprovalPolicies}.scopeType`, args.scopeType).whereIn(`${TableName.ApprovalPolicies}.scopeId`, args.scopeIds)- .innerJoin(- TableName.ApprovalPolicySteps,- `${TableName.ApprovalPolicySteps}.policyId`,- `${TableName.ApprovalPolicies}.id`- )- .innerJoin(- TableName.ApprovalPolicyStepApprovers,- `${TableName.ApprovalPolicyStepApprovers}.policyStepId`,- `${TableName.ApprovalPolicySteps}.id`- )+ .where((qb) => {+ void qb+ .whereExists((sub) => {+ void sub+ .select(dbInstance.raw("1"))+ .from(TableName.ApprovalPolicySteps)+ .innerJoin(+ TableName.ApprovalPolicyStepApprovers,+ `${TableName.ApprovalPolicyStepApprovers}.policyStepId`,+ `${TableName.ApprovalPolicySteps}.id`+ )+ .whereRaw("??.?? = ??.??", [+ TableName.ApprovalPolicySteps,+ "policyId",+ TableName.ApprovalPolicies,+ "id"+ ]);+ })+ .orWhereExists((sub) => {+ void sub+ .select(dbInstance.raw("1"))+ .from(TableName.ApprovalPolicyAutoApprovalRules)+ .whereRaw("??.?? = ??.??", [+ TableName.ApprovalPolicyAutoApprovalRules,+ "policyId",+ TableName.ApprovalPolicies,+ "id"+ ]);+ });+ }).distinct(`${TableName.ApprovalPolicies}.scopeId`).select<{ scopeId: string | null }[]>(`${TableName.ApprovalPolicies}.scopeId`)) as {scopeId: string | null;@@ -405,7 +425,7 @@ export const approvalPolicyDALFactory = (db: TDbClient) => {return rows.map((r) => r.scopeId).filter((id): id is string => Boolean(id));} catch (error) {- throw new DatabaseError({ error, name: "Find scope ids with approvers" });+ throw new DatabaseError({ error, name: "Find requestable scope ids" });}};@@ -561,7 +581,7 @@ export const approvalPolicyDALFactory = (db: TDbClient) => {findSecretAccessPolicyByEnvIdAndSecretPath,findPoliciesWhereSubjectIsApprover,isProjectApprover,- findScopeIdsWithApprovers,+ findRequestableScopeIds,deleteStepApproversBySubject,deleteBypassersBySubject,deleteUserStepApproversInProjectsdiff --git a/backend/src/services/approval-policy/approval-policy-service.ts b/backend/src/services/approval-policy/approval-policy-service.tsindex 1656d1fdaf..b5d386ec49 100644--- a/backend/src/services/approval-policy/approval-policy-service.ts+++ b/backend/src/services/approval-policy/approval-policy-service.ts@@ -85,7 +85,7 @@ import {TApprovalRequestStepsDALFactory} from "./approval-request-dal";import { createApprovalRequestWithSteps } from "./approval-request-fns";-import { toAutoApprovalOutcome } from "./auto-approval/auto-approval-fns";+import { getClosestFailedRule, toAutoApprovalOutcome } from "./auto-approval/auto-approval-fns";import { TAutoApprovalServiceFactory } from "./auto-approval/auto-approval-service";import { TAutoApprovalConfig, TAutoApprovalEvidence } from "./auto-approval/auto-approval-types";@@ -1247,12 +1247,16 @@ export const approvalPolicyServiceFactory = ({throw new BadRequestError({ message: errorMessage });}+ const storedAutoApproval = (await autoApprovalService.findByPolicyIds([policy.id])).get(policy.id);+if (assertDomainCanCreateRequest) {await assertDomainCanCreateRequest({projectId,policy,requestData: requestData as TApprovalRequestData,- actor+ actor,+ hasAutoApprovalRules: Boolean(storedAutoApproval?.rules.length),+ skipsAutoApproval: Boolean(skipAutoApproval)});}@@ -1273,7 +1277,6 @@ export const approvalPolicyServiceFactory = ({}}- const storedAutoApproval = (await autoApprovalService.findByPolicyIds([policy.id])).get(policy.id);const parsedInputs = await autoApprovalService.parseInputValues({stored: storedAutoApproval,values: autoApprovalInputs ?? [],@@ -1320,6 +1323,19 @@ export const approvalPolicyServiceFactory = ({return { request: await $decorateRequest(approved, actor) };}+ // With rules and no approvers, only a rule can grant the request, so one no rule approves is refused now+ if (storedAutoApproval?.rules.length && !skipAutoApproval) {+ const policySteps = await approvalPolicyDAL.findStepsByPolicyId(policy.id);+ if (!policySteps.some((step) => step.approvers.length > 0)) {+ const closest = autoApprovalEvidence ? getClosestFailedRule(autoApprovalEvidence) : null;+ throw new BadRequestError({+ message: closest+ ? `Request rejected because it didn't pass an auto-approval rule. There are no approvers to review it. Closest rule "${closest.ruleName}": ${closest.reason}`+ : "Request rejected. There are no approvers to review it. Auto-approval doesn't apply to this request either."+ });+ }+ }+const created = await createRequestFromPolicy({projectId,organizationId: actor.orgId,@@ -2121,17 +2137,20 @@ export const approvalPolicyServiceFactory = ({};// The request information a requester can link for a policy, or none when the resource keeps its rules off- const $getAutoApprovalInputs = async (+ // Whether the policy's auto-approval rules apply to this request, and the inputs its form asks for+ const $getAutoApprovalRequestState = async (policyType: ApprovalPolicyType,projectId: string,policyId: string,data: TApprovalPolicyInputs | TApprovalRequestData) => {const stored = (await autoApprovalService.findByPolicyIds([policyId])).get(policyId);- if (!stored?.rules.length || !stored.inputs.length) return [];+ if (!stored?.rules.length) return { applies: false, inputs: [] };const allowed = (await resources[policyType]?.allowsAutoApproval?.({ projectId, requestData: data })) ?? true;- return allowed ? autoApprovalService.getInputDetails(stored) : [];+ if (!allowed) return { applies: false, inputs: [] };++ return { applies: true, inputs: stored.inputs.length ? await autoApprovalService.getInputDetails(stored) : [] };};const checkPolicyMatch = async (@@ -2168,7 +2187,7 @@ export const approvalPolicyServiceFactory = ({requiresApproval: !activeGrant,hasActiveGrant: !!activeGrant,constraints,- autoApprovalInputs: await $getAutoApprovalInputs(policyType, projectId, policy.id, inputs)+ autoApprovalInputs: (await $getAutoApprovalRequestState(policyType, projectId, policy.id, inputs)).inputs};};@@ -2309,14 +2328,14 @@ export const approvalPolicyServiceFactory = ({});};- const getScopeIdsWithApprovers = (+ const getRequestableScopeIds = (policyType: ApprovalPolicyType,scopeType: ApprovalPolicyScope,scopeIds: string[]) =>scopeIds.length === 0? Promise.resolve([] as string[])- : approvalPolicyDAL.findScopeIdsWithApprovers({ type: policyType, scopeType, scopeIds });+ : approvalPolicyDAL.findRequestableScopeIds({ type: policyType, scopeType, scopeIds });const getBypassableScopeIds = async (policyType: ApprovalPolicyType,@@ -2566,9 +2585,13 @@ export const approvalPolicyServiceFactory = ({}));}- if (steps.length === 0) return { steps: [], autoApprovalInputs: [] };+ const autoApproval = policy+ ? await $getAutoApprovalRequestState(policyType, projectId, policy.id, inputs)+ : { applies: false, inputs: [] };+ // With no approvers, a request is only granted if a rule approves it when it's submitted+ const autoApprovalOnly = autoApproval.applies && !steps.some((step) => step.approvers.length > 0);- const autoApprovalInputs = policy ? await $getAutoApprovalInputs(policyType, projectId, policy.id, inputs) : [];+ if (steps.length === 0) return { steps: [], autoApprovalInputs: autoApproval.inputs, autoApprovalOnly };const approvers = steps.flatMap((step) => step.approvers);const userIds = approvers.filter((a) => a.type === ApproverType.User).map((a) => a.id);@@ -2590,7 +2613,8 @@ export const approvalPolicyServiceFactory = ({});return {- autoApprovalInputs,+ autoApprovalInputs: autoApproval.inputs,+ autoApprovalOnly,steps: steps.map((step) => ({requiredApprovals: step.requiredApprovals,approvers: step.approvers.map((a) =>@@ -2655,16 +2679,18 @@ export const approvalPolicyServiceFactory = ({});const hasApprovers = steps.some((step) => step.approvers.length > 0);- if (!hasApprovers) {- // A request no rule approves still needs someone who can approve it- if (autoApproval?.rules.length) {- throw new BadRequestError({ message: "Add at least one approver before adding auto-approval rules" });- }+ // An omitted config leaves the stored rules in place, so they still count+ const hasRules = autoApproval+ ? autoApproval.rules.length > 0+ : Boolean(existing && (await autoApprovalService.findByPolicyIds([existing.id])).get(existing.id)?.rules.length);++ if (!hasApprovers && !hasRules) {if (existing) await deleteById(existing.id, actor, policyType);return { policyId: existing?.id ?? null };}- const policySteps = steps.map((step) => ({ ...step, notifyApprovers: true }));+ // Without approvers the policy keeps no steps, and only its rules can approve a request+ const policySteps = hasApprovers ? steps.map((step) => ({ ...step, notifyApprovers: true })) : [];const bypassFields = bypassers ? { bypassers } : {};const autoApprovalUpdate = autoApproval ? { autoApproval } : {};@@ -2709,7 +2735,7 @@ export const approvalPolicyServiceFactory = ({$resource(policyType).matchPolicy(projectId, inputs),getActiveGrant,getAccessStatuses,- getScopeIdsWithApprovers,+ getRequestableScopeIds,getBypassableScopeIds,reapScope,reapSubject,diff --git a/backend/src/services/approval-policy/approval-policy-types.ts b/backend/src/services/approval-policy/approval-policy-types.tsindex b422861e23..f1c53b953c 100644--- a/backend/src/services/approval-policy/approval-policy-types.ts+++ b/backend/src/services/approval-policy/approval-policy-types.ts@@ -303,6 +303,8 @@ export type TApprovalResource<policy: TApprovalPolicy;requestData: TApprovalRequestData;actor: TApprovalActor;+ hasAutoApprovalRules: boolean;+ skipsAutoApproval: boolean;}) => Promise<void>;assertCanReview?: (args: {request: TApprovalRequests;diff --git a/backend/src/services/approval-policy/auto-approval/auto-approval-fns.test.ts b/backend/src/services/approval-policy/auto-approval/auto-approval-fns.test.tsindex 72c32175bc..69d05550cc 100644--- a/backend/src/services/approval-policy/auto-approval/auto-approval-fns.test.ts+++ b/backend/src/services/approval-policy/auto-approval/auto-approval-fns.test.ts@@ -1,6 +1,7 @@import {evaluateAutoApprovalRules,getAutoApprovalSummary,+ getClosestFailedRule,toAutoApprovalOutcome,TResolvedAutoApprovalSubject} from "./auto-approval-fns";@@ -198,3 +199,37 @@ describe("toAutoApprovalOutcome", () => {});});});++describe("getClosestFailedRule", () => {+ const result = (passed: boolean, reason: string | null = null) => ({+ id: "c",+ connectionId: "conn",+ subject: "submitted-ticket",+ constraint: "status",+ values: [],+ description: "Jira ticket has status Approved",+ passed,+ reason+ });++ test("picks the failed rule with the fewest failed conditions, then the most passed", () => {+ expect(+ getClosestFailedRule({+ rules: [+ { id: "a", name: "Two misses", passed: false, conditions: [result(false, "a1"), result(false, "a2")] },+ { id: "b", name: "One miss", passed: false, conditions: [result(false, "b1")] },+ {+ id: "c",+ name: "One miss, more passes",+ passed: false,+ conditions: [result(true), result(false, "c1")]+ }+ ]+ })+ ).toEqual({ ruleName: "One miss, more passes", reason: "c1" });+ });++ test("is null when no rule failed", () => {+ expect(getClosestFailedRule({ rules: [] })).toBeNull();+ });+});diff --git a/backend/src/services/approval-policy/auto-approval/auto-approval-fns.ts b/backend/src/services/approval-policy/auto-approval/auto-approval-fns.tsindex 7ca179ac6a..ae1ef008a7 100644--- a/backend/src/services/approval-policy/auto-approval/auto-approval-fns.ts+++ b/backend/src/services/approval-policy/auto-approval/auto-approval-fns.ts@@ -108,3 +108,22 @@ export const getAutoApprovalSummary = (evidence: unknown) => {conditions: (rule?.conditions ?? []).map((condition) => condition.description)};};++// The rule that came closest to passing best explains a refusal: fewest failed conditions, then most passed+export const getClosestFailedRule = (evidence: Pick<TAutoApprovalEvidence, "rules">) => {+ const [closest] = evidence.rules+ .filter((rule) => !rule.passed)+ .map((rule) => ({+ rule,+ failed: rule.conditions.filter((condition) => !condition.passed).length,+ passed: rule.conditions.filter((condition) => condition.passed).length+ }))+ .sort((a, b) => a.failed - b.failed || b.passed - a.passed);+ if (!closest) return null;++ const failedCondition = closest.rule.conditions.find((condition) => !condition.passed);+ return {+ ruleName: closest.rule.name,+ reason: failedCondition?.reason ?? failedCondition?.description ?? "a condition didn't pass"+ };+};diff --git a/docs/documentation/platform/pam/access-requests/auto-approval.mdx b/docs/documentation/platform/pam/access-requests/auto-approval.mdxindex 4dea82b1f8..bd7043f8ae 100644--- a/docs/documentation/platform/pam/access-requests/auto-approval.mdx+++ b/docs/documentation/platform/pam/access-requests/auto-approval.mdx@@ -4,7 +4,7 @@ sidebarTitle: "Auto-approval"description: "Approve PAM access requests as soon as they're submitted when the records that requesters link from other services pass the folder's rules."----Auto-approval approves an [access request](/documentation/platform/pam/access-requests/overview) as soon as it's submitted, if the request passes one of the folder's rules. A rule checks a record that the requester links from another service, such as a Jira ticket. For example, a rule can require that the linked Jira ticket is assigned to the requester and approved in Jira. If no rule passes, the request waits for the folder's approvers, as it would without auto-approval.+Auto-approval approves an [access request](/documentation/platform/pam/access-requests/overview) as soon as it's submitted, if the request passes one of the folder's rules. A rule checks a record that the requester links from another service, such as a Jira ticket. For example, a rule can require that the linked Jira ticket is assigned to the requester and approved in Jira. If no rule passes, the request waits for the folder's approvers, as it would without auto-approval. If the folder has no approvers, the request is rejected as soon as it's submitted. The requester sees why.Auto-approval has two settings, each managed by a different role:@@ -21,7 +21,7 @@ Infisical reads linked records through an [app connection](/integrations/app-con## Prerequisites-- Accounts that [require approval](/documentation/platform/pam/access-requests/overview#setting-up-an-access-gate), in a folder with at least one approver (a request that no rule approves still needs someone to approve it)+- Accounts that [require approval](/documentation/platform/pam/access-requests/overview#setting-up-an-access-gate)- An app connection to a [supported service](#supported-services), whose user can read the records that requesters will link## Turn on auto-approval in a template@@ -40,7 +40,7 @@ To let a template's accounts be auto-approved:</Step></Steps>-If an account's template doesn't allow auto-approval, the folder's rules don't apply to the account: its request form doesn't ask for any records, and its requests wait for an approver.+If an account's template doesn't allow auto-approval, the folder's rules don't apply to the account: its request form doesn't ask for any records, and its requests wait for an approver. If the folder also has no approvers, the account's requests are refused.## Add rules to a folder@@ -100,6 +100,7 @@ After you submit the request, the confirmation message shows whether a rule appr- If a rule approved it, the access you asked for starts right away- If no rule approved it, the request waits for an approver, and the message shows why the rule that came closest didn't pass+- If no rule approved it and the folder has no approvers, the request is rejected (the message shows why the rule that came closest didn't pass)If you turn on **Break glass** in the form, the record fields disappear, because [break-glass](/documentation/platform/pam/access-requests/overview#break-glass-access) requests skip the rules.diff --git a/frontend/src/hooks/api/pam/queries.tsx b/frontend/src/hooks/api/pam/queries.tsxindex 150fb77a8f..4d36a31fae 100644--- a/frontend/src/hooks/api/pam/queries.tsx+++ b/frontend/src/hooks/api/pam/queries.tsx@@ -656,6 +656,7 @@ export const useGetPamAccountApprovers = (const { data } = await apiRequest.get<{steps: TPamApprovalWorkflowStep[];autoApprovalInputs: TAutoApprovalInputDetails[];+ autoApprovalOnly: boolean;}>(`/api/v1/pam/access-requests/accounts/${accountId}/approvers`, { params: { accessType } });return data;}diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsxindex 6029479c12..5174b1607c 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx@@ -357,18 +357,14 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {};const handleSave = () => {- if (breakGlassUsers.length > 0 && approvers.length === 0) {+ if (+ breakGlassUsers.length > 0 &&+ approvers.length === 0 &&+ autoApprovalDraft.rules.length === 0+ ) {createNotification({type: "error",- text: "Break-glass users need at least one approver to skip"- });- return;- }-- if (autoApprovalDraft.rules.length > 0 && approvers.length === 0) {- createNotification({- type: "error",- text: "Auto-approval rules need at least one approver for the requests they don't approve"+ text: "Break-glass users need approvers or auto-approval rules to skip"});return;}diff --git a/frontend/src/pages/pam/components/RequestAccessSheet.tsx b/frontend/src/pages/pam/components/RequestAccessSheet.tsxindex d616e1383b..ec8784e845 100644--- a/frontend/src/pages/pam/components/RequestAccessSheet.tsx+++ b/frontend/src/pages/pam/components/RequestAccessSheet.tsx@@ -471,6 +471,16 @@ export const RequestAccessSheet = ({</Field>)}/>+ {!breakGlassOnSubmit && approverData?.autoApprovalOnly && (+ <Alert variant="warning">+ <ShieldAlert />+ <AlertTitle>No one will review this request</AlertTitle>+ <AlertDescription>+ This folder has no approvers. Your request is approved only if it passes an+ auto-approval rule when you submit it. Otherwise it's rejected immediately.+ </AlertDescription>+ </Alert>+ )}{!breakGlassOnSubmit && autoApprovalInputDetails.length > 0 && (<AutoApprovalRequestInputsinputs={autoApprovalInputDetails}diff --git a/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx b/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsxindex 2990170bd0..5cfe270c99 100644--- a/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx+++ b/frontend/src/pages/pam/components/auto-approval/AutoApprovalCard.tsx@@ -1,5 +1,5 @@import { useQuery } from "@tanstack/react-query";-import { Info, Link2, Plus, X } from "lucide-react";+import { Info, Link2, Plus, TriangleAlert, X } from "lucide-react";import {Badge,@@ -113,8 +113,9 @@ export const AutoApprovalCard = ({<Info className="size-3.5 text-muted" aria-label="When auto-approval applies" /></TooltipTrigger><TooltipContent className="max-w-72">- Only applies to accounts whose template has Allow Auto-Approval on. Requests no rule- approves wait for the approvers below.+ Only applies to accounts whose template has Allow Auto-Approval on. Requests that no+ rule approves wait for the approvers below. Without approvers, those requests are+ rejected immediately.</TooltipContent></Tooltip></CardTitle>@@ -216,27 +217,26 @@ export const AutoApprovalCard = ({<section className="flex flex-col gap-3"><div className="flex items-center justify-between gap-4"><SectionLabel>Rules</SectionLabel>- <DisabledReason- reason={- hasApprovers- ? undefined- : "Add an approver first. Requests no rule approves still need someone to approve them."- }+ <Button+ type="button"+ variant="outline"+ size="sm"+ className="border-dashed"+ onClick={addRule}>- <Button- type="button"- variant="outline"- size="sm"- className="border-dashed"- isDisabled={!hasApprovers}- onClick={addRule}- >- <Plus />- Add Rule- </Button>- </DisabledReason>+ <Plus />+ Add Rule+ </Button></div>+ {!hasApprovers && draft.rules.length > 0 && (+ <div className="flex items-center gap-2 rounded-md border border-warning/20 bg-warning/5 px-2.5 py-1.5 text-xs text-foreground/80">+ <TriangleAlert className="size-3.5 shrink-0 text-warning" />+ This folder has no approvers. Access requests that don't pass an+ auto-approval rule are rejected immediately.+ </div>+ )}+{draft.rules.map((rule, index) => (<AutoApprovalRuleCardkey={rule.key}