Skip to content

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

chore: update error message

adilson9f088a3e0f15
diff --git a/backend/src/ee/services/access-approval-request/access-approval-request-service.ts b/backend/src/ee/services/access-approval-request/access-approval-request-service.ts
index af215057c6..70aa242f10 100644
--- a/backend/src/ee/services/access-approval-request/access-approval-request-service.ts
+++ b/backend/src/ee/services/access-approval-request/access-approval-request-service.ts
@@ -606,6 +606,11 @@ export const accessApprovalRequestServiceFactory = ({
actionProjectType: ActionProjectType.SecretManager
});
+ // If the user has no access to the project, they are not authorized to review the request, even with a break-glass approval.
+ if (hasRole(ProjectMembershipRole.NoAccess)) {
+ throw new ForbiddenRequestError({ message: "You are not authorized to review this request" });
+ }
+
const isSelfApproval = actorId === accessApprovalRequest.requestedByUserId;
const isSoftEnforcement = policy.enforcementLevel === EnforcementLevel.Soft;
const canBypass = !policy.bypassers.length || policy.bypassers.some((bypasser) => bypasser.userId === actorId);
@@ -649,11 +654,6 @@ export const accessApprovalRequestServiceFactory = ({
throw new ForbiddenRequestError({ message: "You are not authorized to approve this request" });
}
- // If the user has no access to the project, they are not authorized to approve the request, even with a break-glass approval.
- if (hasRole(ProjectMembershipRole.NoAccess)) {
- throw new ForbiddenRequestError({ message: "You are not authorized to approve this request" });
- }
-
const project = await requestMemoize(requestMemoKeys.projectFindById(accessApprovalRequest.projectId), () =>
projectDAL.findById(accessApprovalRequest.projectId)
);