Package io.jenkins.plugins.auditlogger
Class WebhookDispatcher
java.lang.Object
io.jenkins.plugins.auditlogger.WebhookDispatcher
Asynchronous dispatcher for sending security alerts and audit logs to external
webhook endpoints (Slack, Microsoft Teams, generic receivers).
Provides worker daemon threads, retry logic with exponential backoff on HTTP 429/5xx,
and unified payload formatting.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildAnomalyPayload(AnomalyDetector.AnomalyAlert alert, String jenkinsUrl, String isoTimestamp) Builds a comprehensive JSON payload for an anomaly alert.buildAuditLogPayload(AuditLogEntry entry, String jenkinsUrl, String isoTimestamp) Builds a comprehensive JSON payload for a direct audit log event, formatted with Slack attachments, severity colors, and Microsoft Teams compatibility.voiddispatchAnomaly(AnomalyDetector.AnomalyAlert alert, AuditLoggerConfiguration config) Dispatches an anomaly alert to all active endpoints configured in AuditLoggerConfiguration.voiddispatchAuditLog(AuditLogEntry entry, AuditLoggerConfiguration config) Dispatches a direct critical or high-priority audit log entry to matching webhook destinations.static StringescapeJson(String s) static StringformatDetailsForSlack(String details) static WebhookDispatcherstatic StringgetSeverityColor(String severity) static StringgetSeverityEmoji(String severity) static StringmaskWebhookUrl(String url) Redacts secret tokens and query parameters from webhook URLs for safe logging.voidshutdown()
-
Constructor Details
-
WebhookDispatcher
public WebhookDispatcher()
-
-
Method Details
-
getInstance
-
dispatchAnomaly
Dispatches an anomaly alert to all active endpoints configured in AuditLoggerConfiguration. -
dispatchAuditLog
Dispatches a direct critical or high-priority audit log entry to matching webhook destinations. -
buildAuditLogPayload
Builds a comprehensive JSON payload for a direct audit log event, formatted with Slack attachments, severity colors, and Microsoft Teams compatibility. -
buildAnomalyPayload
public String buildAnomalyPayload(AnomalyDetector.AnomalyAlert alert, String jenkinsUrl, String isoTimestamp) Builds a comprehensive JSON payload for an anomaly alert. -
maskWebhookUrl
Redacts secret tokens and query parameters from webhook URLs for safe logging. Example: https://hooks.slack.com/services/T00/B00/SECRET -> https://hooks.slack.com/services/*** -
getSeverityColor
-
getSeverityEmoji
-
formatDetailsForSlack
-
escapeJson
-
shutdown
public void shutdown()
-