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
fix(pam): check approval gate before launch reason requirement
bernie-gf9f2bda8a30c
diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.tsindex cdd01bb0dc..9d42004ed3 100644--- a/backend/src/ee/services/pam-session/pam-session-service.ts+++ b/backend/src/ee/services/pam-session/pam-session-service.ts@@ -386,13 +386,6 @@ export const pamSessionServiceFactory = ({const trimmedReason = reason?.trim() || null;- if (policy.requireReason && !trimmedReason) {- throw new BadRequestError({- name: "PAM_REASON_REQUIRED",- message: "A reason is required to access this account"- });- }-if (policy.requireMfa) {await enforceMfa({ mfaSessionService, orgDAL, userDAL },@@ -413,6 +406,9 @@ export const pamSessionServiceFactory = ({sessionDurationMs = Math.min(parsed, maxDurationMs);}+ // The approval gate comes before the launch-reason check: a user without a grant should be+ // guided into requesting access (where the request reason is collected) rather than being+ // blocked on a launch reason for a session they cannot start yet.if (requiresApproval) {const grant = await pamAccessRequestService.checkGrant({userId: actor.actorId,@@ -449,6 +445,13 @@ export const pamSessionServiceFactory = ({}}+ if (policy.requireReason && !trimmedReason) {+ throw new BadRequestError({+ name: "PAM_REASON_REQUIRED",+ message: "A reason is required to access this account"+ });+ }+// AWS IAM: no gateway, no proxy -- generate STS credentials directlyif (account.accountType === PamAccountType.AwsIam) {const stsDurationSeconds = Math.floor(sessionDurationMs / 1000);