Skip to content

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

fix email template

Thiago Araujo da Silva27a89f40a6f9
diff --git a/backend/src/services/alert/alert-channel-types.ts b/backend/src/services/alert/alert-channel-types.ts
index 910ba134d8..7b1f35f595 100644
--- a/backend/src/services/alert/alert-channel-types.ts
+++ b/backend/src/services/alert/alert-channel-types.ts
@@ -33,6 +33,7 @@ export type TAlertPayload = {
eventLabel: string; // human label, e.g. "Expiration"
webhookType: string; // CloudEvents `type` string, e.g. "com.infisical.pki.certificate.expiration"
resourceKind: string; // display noun, e.g. "Certificate", "Client Secret"
+ resourceOwnerKind: string; // display noun of the entity the alert is configured on, e.g. "Machine Identity"
severity: TAlertSeverity;
summary: string; // one-line human summary
items: TAlertItem[];
diff --git a/backend/src/services/alert/alert-engine.test.ts b/backend/src/services/alert/alert-engine.test.ts
index b35d18f1b6..4d660f3673 100644
--- a/backend/src/services/alert/alert-engine.test.ts
+++ b/backend/src/services/alert/alert-engine.test.ts
@@ -77,6 +77,7 @@ const makeProvider = (targets: TTarget[], onFindDueTargets?: () => void): IResou
eventLabel: "Expiration",
webhookType: "com.infisical.test.resource.expiration",
resourceKind: "Test Resource",
+ resourceOwnerKind: "Test Owner",
severity: "warning",
summary: `${matched.length} expiring`,
items: matched.map((target) => ({ id: target.id, title: target.id }))
diff --git a/backend/src/services/alert/channels/alert-channel-email-fns.ts b/backend/src/services/alert/channels/alert-channel-email-fns.ts
index 95b7bfd993..9eeba34482 100644
--- a/backend/src/services/alert/channels/alert-channel-email-fns.ts
+++ b/backend/src/services/alert/channels/alert-channel-email-fns.ts
@@ -12,6 +12,7 @@ const buildSubstitutions = (payload: TAlertPayload) => ({
alertName: payload.alert.name,
eventLabel: payload.eventLabel,
resourceKind: payload.resourceKind,
+ resourceOwnerKind: payload.resourceOwnerKind,
summary: payload.summary,
severity: payload.severity,
viewUrl: payload.alert.viewUrl,
diff --git a/backend/src/services/alert/channels/alert-channels.test.ts b/backend/src/services/alert/channels/alert-channels.test.ts
index 6791b32fb9..afb708b549 100644
--- a/backend/src/services/alert/channels/alert-channels.test.ts
+++ b/backend/src/services/alert/channels/alert-channels.test.ts
@@ -26,6 +26,7 @@ const samplePayload = (): TAlertPayload => ({
eventLabel: "Expiration",
webhookType: "com.infisical.pki.certificate.expiration",
resourceKind: "Certificate",
+ resourceOwnerKind: "Certificate Authority",
severity: "warning",
summary: "2 certificates expiring within 30d",
items: [
diff --git a/backend/src/services/alert/providers/identity-credential-alert-provider.ts b/backend/src/services/alert/providers/identity-credential-alert-provider.ts
index c1c952c306..39a8f21e51 100644
--- a/backend/src/services/alert/providers/identity-credential-alert-provider.ts
+++ b/backend/src/services/alert/providers/identity-credential-alert-provider.ts
@@ -159,6 +159,7 @@ export const identityCredentialAlertProviderFactory = ({
eventLabel: "Expiration",
webhookType: "com.infisical.identity.authentication.expiration",
resourceKind: "Machine Identity Authentication",
+ resourceOwnerKind: "Machine Identity",
severity: severityFor(targets),
summary: alertBefore
? `${targets.length} machine identity authentication(s) expiring within ${humanizeAlertBefore(alertBefore)}`
diff --git a/backend/src/services/smtp/emails/AlertNotificationTemplate.tsx b/backend/src/services/smtp/emails/AlertNotificationTemplate.tsx
index 87667d0270..ab16bc20e7 100644
--- a/backend/src/services/smtp/emails/AlertNotificationTemplate.tsx
+++ b/backend/src/services/smtp/emails/AlertNotificationTemplate.tsx
@@ -7,6 +7,7 @@ interface AlertNotificationTemplateProps extends Omit<BaseEmailWrapperProps, "ti
alertName: string;
eventLabel: string;
resourceKind: string;
+ resourceOwnerKind: string;
summary: string;
severity?: string;
viewUrl: string;
@@ -24,6 +25,7 @@ export const AlertNotificationTemplate = ({
alertName,
eventLabel,
resourceKind,
+ resourceOwnerKind,
summary,
severity = "info",
viewUrl,
@@ -58,7 +60,7 @@ export const AlertNotificationTemplate = ({
<Heading className="text-black text-[20px] leading-[28px] text-center font-semibold p-0 mx-0">{title}</Heading>
- <Text className="text-gray-600 text-[14px] leading-[22px] text-center mt-[8px] mb-[0px]">
+ <Text className="text-gray-600 text-[14px] leading-[22px] mt-[16px] mb-[0px]">
{summary}. Review the {resourceLabel} below and take action before {eventLabel.toLowerCase()} to avoid
disruption.
</Text>
@@ -99,8 +101,8 @@ export const AlertNotificationTemplate = ({
<Hr className="mt-[24px] mb-[0px] h-[1px]" />
<Text className="text-[11px] text-gray-400 text-center leading-[16px] mt-[16px] mb-[0px]">
- You are receiving this because you are a recipient of this alert. Manage recipients and channels in your
- Infisical alert settings.
+ You are receiving this because you are a recipient of this alert. Manage recipients and channels in the{" "}
+ {resourceOwnerKind.toLowerCase()}&apos;s alert settings in Infisical.
</Text>
</BaseEmailWrapper>
);
@@ -112,6 +114,7 @@ AlertNotificationTemplate.PreviewProps = {
alertName: "prod-identity-authentication-expiry",
eventLabel: "Expiration",
resourceKind: "Machine Identity Authentication",
+ resourceOwnerKind: "Machine Identity",
summary: "2 machine identity authentication(s) expiring within 30 days",
severity: "critical",
viewUrl: "https://infisical.com/organizations/org-1/access-management?selectedTab=identities",