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
Address PR comments
Carlos Monastyrskif2896f7864ec
diff --git a/backend/src/services/pki-alert-v2/pki-alert-v2-channel-webhook-fns.ts b/backend/src/services/pki-alert-v2/pki-alert-v2-channel-webhook-fns.tsindex 85caa0c589..e39d15fdff 100644--- a/backend/src/services/pki-alert-v2/pki-alert-v2-channel-webhook-fns.ts+++ b/backend/src/services/pki-alert-v2/pki-alert-v2-channel-webhook-fns.ts@@ -10,6 +10,7 @@ import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator/validate-urlimport { PKI_ALERT_RETRY_CONFIG, RETRYABLE_NETWORK_ERRORS } from "./pki-alert-v2-constants";import {+ getRevocationReasonLabel,PkiWebhookEventType,TAlertInfo,TCertificateData,@@ -75,7 +76,9 @@ const transformCertificates = (certificates: TCertificatePreview[]): TCertificatstatus: cert.status,daysUntilExpiry,...(cert.revokedAt ? { revokedAt: new Date(cert.revokedAt).toISOString() } : {}),- ...(cert.revocationReason != null ? { revocationReason: cert.revocationReason } : {})+ ...(cert.revocationReason != null+ ? { revocationReason: getRevocationReasonLabel(cert.revocationReason) ?? String(cert.revocationReason) }+ : {})};});};diff --git a/backend/src/services/pki-alert-v2/pki-alert-v2-types.ts b/backend/src/services/pki-alert-v2/pki-alert-v2-types.tsindex 497b5b3b5b..8a04c95343 100644--- a/backend/src/services/pki-alert-v2/pki-alert-v2-types.ts+++ b/backend/src/services/pki-alert-v2/pki-alert-v2-types.ts@@ -98,7 +98,7 @@ export type TCertificateData = {status: string;daysUntilExpiry: number;revokedAt?: string;- revocationReason?: number;+ revocationReason?: string;};export type TPkiWebhookPayload = {diff --git a/backend/src/services/smtp/emails/PkiExpirationAlertTemplate.tsx b/backend/src/services/smtp/emails/PkiExpirationAlertTemplate.tsxindex 65da992da1..927411f14c 100644--- a/backend/src/services/smtp/emails/PkiExpirationAlertTemplate.tsx+++ b/backend/src/services/smtp/emails/PkiExpirationAlertTemplate.tsx@@ -59,7 +59,21 @@ export const PkiExpirationAlertTemplate = ({message = `Alert ${alertName}: ${items.length === 1 ? "A" : `${items.length}`} ${certificateText} ${items.length === 1 ? "has" : "have"} ${verb}.`;}- const listHeading = isExpiration ? "Expiring certificates:" : "Affected certificates:";+ const getListHeading = () => {+ if (isExpiration) return "Expiring certificates:";+ switch (eventLabel) {+ case "Issuance":+ return "Issued certificates:";+ case "Renewal":+ return "Renewed certificates:";+ case "Revocation":+ return "Revoked certificates:";+ default:+ return "Certificates:";+ }+ };++ const listHeading = getListHeading();return (<BaseEmailWrapper title={title} preview={message} siteUrl={siteUrl}>diff --git a/docs/documentation/platform/pki/alerting/overview.mdx b/docs/documentation/platform/pki/alerting/overview.mdxindex d2fd8c9ab1..0a88e63859 100644--- a/docs/documentation/platform/pki/alerting/overview.mdx+++ b/docs/documentation/platform/pki/alerting/overview.mdx@@ -12,7 +12,7 @@ Infisical allows you to configure alerts for key certificate lifecycle events, k| Alert Type | Trigger | Description ||---|---|---|-| **Certificate Expiration** | Scheduled (daily check) | Notifies when certificates are approaching their expiration date, based on a configurable time window (e.g., 30 days before expiry). |+| **Certificate Expiration** | Scheduled | Notifies when certificates are approaching their expiration date, based on a configurable time window (e.g., 30 days before expiry). || **Certificate Issuance** | Real time | Notifies when a new certificate is issued through a certificate profile (via API, CSR signing, or EST/ACME enrollment). || **Certificate Renewal** | Real time | Notifies when an existing certificate is renewed, either manually or through auto renewal. || **Certificate Revocation** | Real time | Notifies when a certificate is revoked. |@@ -33,7 +33,7 @@ Here's some guidance for each field in the alert configuration sequence:- **Alert Name**: A slug friendly name for the alert such as `tls-expiry-alert` or `prod-issuance-notify`.- **Description**: An optional description for the alert.- **Alert Before** *(Expiration alerts only)*: The time before certificate expiration to trigger the alert, such as 30 days denoted by `30d`. Supported units: `d` (days), `w` (weeks), `m` (months), `y` (years).-- **Daily Alerts** *(Expiration alerts only)*: When not enabled, a single notification is sent when the threshold is first reached. Enabling this option sends notifications every day until the certificate expires or is renewed.+- **Daily Alerts** *(Expiration alerts only)*: Off by default. When enabled, notifications are sent every day until the certificate expires or is renewed. When disabled, a single notification is sent when the threshold is first reached.<Warning>For certificates that cannot be renewed through Infisical, daily alerts will continue to be sent each day until the original expiration date.diff --git a/docs/documentation/platform/pki/alerting/webhook-alerts.mdx b/docs/documentation/platform/pki/alerting/webhook-alerts.mdxindex 07dba94565..e06d873548 100644--- a/docs/documentation/platform/pki/alerting/webhook-alerts.mdx+++ b/docs/documentation/platform/pki/alerting/webhook-alerts.mdx@@ -82,9 +82,9 @@ Webhook notifications are sent as HTTP POST requests with a [CloudEvents](https:### Issuance, Renewal, and Revocation Alert Payload-Event driven alerts (issuance, renewal, revocation) share the same payload structure. The `type` and `subject` fields reflect the specific event, and `alertBefore` is omitted since these are real time notifications.+These alerts are sent in real time the moment a certificate event occurs. Each notification contains a single certificate. The `type` and `subject` fields reflect the specific event, and `alertBefore` is omitted.-For revocation alerts, each certificate in the array will also include `revokedAt` and `revocationReason` fields when available.+For revocation alerts, the certificate object also includes `revokedAt` and `revocationReason` fields.```json{diff --git a/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsx b/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsxindex 36ec071da0..7e0abb30d4 100644--- a/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsx+++ b/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsx@@ -21,7 +21,7 @@ import {Tr} from "@app/components/v2";import { Badge } from "@app/components/v3";-import { TPkiAlertV2, useUpdatePkiAlertV2 } from "@app/hooks/api/pkiAlertsV2";+import { PkiAlertEventTypeV2, TPkiAlertV2, useUpdatePkiAlertV2 } from "@app/hooks/api/pkiAlertsV2";import { formatAlertBefore, formatEventType } from "../utils/pki-alert-formatters";@@ -73,7 +73,13 @@ export const PkiAlertV2Row = ({ alert, onView, onEdit, onDelete }: Props) => {{alert.enabled ? "Enabled" : "Disabled"}</Badge></Td>- <Td className="text-gray-300">{formatAlertBefore(alert.alertBefore)}</Td>+ <Td className="text-gray-300">+ {alert.eventType === PkiAlertEventTypeV2.EXPIRATION ? (+ formatAlertBefore(alert.alertBefore)+ ) : (+ <span className="text-mineshaft-500">—</span>+ )}+ </Td><Td>{alert.lastRun ? (<Tooltipdiff --git a/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsx b/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsxindex c0cd3d7732..72f0b5187d 100644--- a/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsx+++ b/frontend/src/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal.tsx@@ -129,7 +129,9 @@ export const ViewPkiAlertV2Modal = ({ isOpen, onOpenChange, alertId }: Props) =><Tabs value={activeTab} onValueChange={setActiveTab}><TabList><Tab value="overview">Overview</Tab>- <Tab value="certificates">Matching Certificates</Tab>+ {alert.eventType !== PkiAlertEventTypeV2.ISSUANCE && (+ <Tab value="certificates">Matching Certificates</Tab>+ )}</TabList><TabPanel value="overview">@@ -142,26 +144,28 @@ export const ViewPkiAlertV2Modal = ({ isOpen, onOpenChange, alertId }: Props) =><span className="text-gray-300">{formatEventType(alert.eventType)}</span></div>- <div>- <div className="mb-1 block text-sm font-medium text-gray-400">- Alert Before- </div>- <span className="text-gray-300">- {formatAlertBefore(alert.alertBefore, "Not set")}- </span>- </div>-{alert.eventType === PkiAlertEventTypeV2.EXPIRATION && (- <div>- <div className="mb-1 block text-sm font-medium text-gray-400">- Daily Alerts+ <>+ <div>+ <div className="mb-1 block text-sm font-medium text-gray-400">+ Alert Before+ </div>+ <span className="text-gray-300">+ {formatAlertBefore(alert.alertBefore, "Not set")}+ </span>+ </div>++ <div>+ <div className="mb-1 block text-sm font-medium text-gray-400">+ Daily Alerts+ </div>+ <span className="text-gray-300">+ {alert.notificationConfig?.enableDailyNotification+ ? "Enabled"+ : "Disabled"}+ </span></div>- <span className="text-gray-300">- {alert.notificationConfig?.enableDailyNotification- ? "Enabled"- : "Disabled"}- </span>- </div>+ </>)}<div>