Skip to content

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

improvement(pam): actionable no-approvers error and drop project name from approval email

bernie-g7d7c1f0416b1
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.ts
index 19d9a7e217..23443f39c1 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
@@ -42,7 +42,6 @@ import {
import { TMembershipDALFactory } from "@app/services/membership/membership-dal";
import { TMembershipRoleDALFactory } from "@app/services/membership/membership-role-dal";
import { TNotificationServiceFactory } from "@app/services/notification/notification-service";
-import { TProjectDALFactory } from "@app/services/project/project-dal";
import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";
import { TUserDALFactory } from "@app/services/user/user-dal";
@@ -111,7 +110,6 @@ type TPamAccessRequestServiceFactoryDep = {
gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPAMConnectionDetails">;
membershipDAL: Pick<TMembershipDALFactory, "find">;
membershipRoleDAL: Pick<TMembershipRoleDALFactory, "find">;
- projectDAL: Pick<TProjectDALFactory, "findById">;
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getResourcePermission">;
notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;
smtpService: Pick<TSmtpService, "sendMail">;
@@ -137,7 +135,6 @@ export const pamAccessRequestServiceFactory = ({
gatewayV2Service,
membershipDAL,
membershipRoleDAL,
- projectDAL,
permissionService,
notificationService,
smtpService,
@@ -498,7 +495,10 @@ export const pamAccessRequestServiceFactory = ({
// A step with no approvers can never be reviewed, wedging the request forever. The dashboard hides
// the request action in this case, but that guard must also hold for the CLI and direct API callers.
if (policySteps.length === 0 || policySteps.some((s) => s.approvers.length === 0)) {
- throw new BadRequestError({ message: "This folder's approval policy has no approvers configured" });
+ 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."
+ });
}
const stepsForRequest = policySteps.map((s) => ({
@@ -566,7 +566,6 @@ export const pamAccessRequestServiceFactory = ({
const recipients = approverUsers.filter((u) => u.email).map((u) => u.email as string);
if (recipients.length > 0) {
- const project = await projectDAL.findById(projectId);
const cfg = getConfig();
const approvalUrl = `${cfg.SITE_URL}/organizations/${ctx.actorOrgId}/pam/approval-requests?requestId=${request.id}`;
@@ -575,7 +574,6 @@ export const pamAccessRequestServiceFactory = ({
subjectLine: "PAM Access Request",
template: SmtpTemplates.AccessPamRequest,
substitutions: {
- projectName: project?.name ?? "PAM",
requesterFullName: requesterName || "Unknown",
requesterEmail: user.email ?? "",
accountName: account.name,
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index 62c53a2a36..0e77b3d46f 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -1826,7 +1826,6 @@ export const registerRoutes = async (
gatewayV2Service,
membershipDAL,
membershipRoleDAL,
- projectDAL,
permissionService,
notificationService,
smtpService,
diff --git a/backend/src/services/smtp/emails/AccessPamRequestTemplate.tsx b/backend/src/services/smtp/emails/AccessPamRequestTemplate.tsx
index 0f504cffd8..28e06f3468 100644
--- a/backend/src/services/smtp/emails/AccessPamRequestTemplate.tsx
+++ b/backend/src/services/smtp/emails/AccessPamRequestTemplate.tsx
@@ -6,7 +6,6 @@ import { BaseEmailWrapper, BaseEmailWrapperProps } from "./BaseEmailWrapper";
import { BaseLink } from "./BaseLink";
interface AccessPamRequestTemplateProps extends Omit<BaseEmailWrapperProps, "title" | "preview" | "children"> {
- projectName: string;
requesterFullName: string;
requesterEmail: string;
accountName?: string;
@@ -17,7 +16,6 @@ interface AccessPamRequestTemplateProps extends Omit<BaseEmailWrapperProps, "tit
}
export const AccessPamRequestTemplate = ({
- projectName,
siteUrl,
requesterFullName,
requesterEmail,
@@ -36,7 +34,7 @@ export const AccessPamRequestTemplate = ({
siteUrl={siteUrl}
>
<Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">
- A PAM access request in the project <strong>{projectName}</strong> is awaiting your approval
+ A PAM access request is awaiting your approval
</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]">
@@ -65,6 +63,5 @@ AccessPamRequestTemplate.PreviewProps = {
folderName: "Production",
accessDuration: "1 hour",
siteUrl: "https://infisical.com",
- projectName: "Example Project",
reason: "Need to run a migration on the production database."
} as AccessPamRequestTemplateProps;