Skip to content

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

feat(notifications): access policy bypass notification

x032205f85612d9fd22
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 008b61919f..da87978fd3 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
@@ -777,6 +777,20 @@ export const accessApprovalRequestServiceFactory = ({
.map((appUser) => appUser.email)
.filter((email): email is string => !!email);
+ const approvalPath = `/projects/secret-management/${project.id}/approval`;
+ const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
+
+ await notificationService.createUserNotifications(
+ approverUsersForEmail.map((approver) => ({
+ userId: approver.id,
+ orgId: actorOrgId,
+ type: NotificationType.ACCESS_POLICY_BYPASSED,
+ title: "Secret Access Policy Bypassed",
+ body: `**${actingUser.firstName} ${actingUser.lastName}** (${actingUser.email}) has accessed a secret in **${policy.secretPath || "/"}** in the **${environment?.name || permissionEnvironment}** environment for project **${project.name}** without obtaining the required approval.`,
+ link: approvalPath
+ }))
+ );
+
if (recipientEmails.length > 0) {
await smtpService.sendMail({
recipients: recipientEmails,
@@ -788,7 +802,7 @@ export const accessApprovalRequestServiceFactory = ({
bypassReason: bypassReason || "No reason provided",
secretPath: policy.secretPath || "/",
environment: environment?.name || permissionEnvironment,
- approvalUrl: `${cfg.SITE_URL}/projects/secret-management/${project.id}/approval`,
+ approvalUrl,
requestType: "access"
},
template: SmtpTemplates.AccessSecretRequestBypassed
diff --git a/backend/src/services/notification/notification-types.ts b/backend/src/services/notification/notification-types.ts
index 30bc872442..76ffc2ea18 100644
--- a/backend/src/services/notification/notification-types.ts
+++ b/backend/src/services/notification/notification-types.ts
@@ -1,6 +1,7 @@
export enum NotificationType {
ACCESS_APPROVAL_REQUEST = "access-approval-request",
- ACCESS_APPROVAL_REQUEST_UPDATED = "access-approval-request-updated"
+ ACCESS_APPROVAL_REQUEST_UPDATED = "access-approval-request-updated",
+ ACCESS_POLICY_BYPASSED = "access-policy-bypassed"
}
export interface TCreateUserNotificationDTO {