feat(events): add webhook event listener with HMAC signing and retry#5084
feat(events): add webhook event listener with HMAC signing and retry#5084vigneshio wants to merge 5 commits into
Conversation
Add a generic webhook event listener (polaris.event-listener.types=webhook) that delivers Polaris events as JSON HTTP POST requests to a configurable endpoint, e.g. a SIEM or audit collector. - Payloads are signed with HMAC-SHA256 when polaris.event-listener.webhook.secret is set and sent as the X-Polaris-Signature-256 header, so receivers can verify authenticity. - Failed deliveries (non-2xx or connection errors) are retried with exponential backoff (max-attempts / retry-backoff) before being dropped and logged. - The listener receives sanitized events only (no RawEventAccess), so denylisted attributes such as credentials are never delivered.
61741aa to
3cc42d2
Compare
|
Thanks for the contribution, @vigneshio! I like the direction here. My main concern is not the webhook idea itself. A few areas I think we should address or explicitly agree on:
For deployments that require durable delivery, I suspect a Kafka-consuming webhook processor is the cleaner architecture: |
Address review feedback for the webhook event listener: versioned JSON envelope with event id and original timestamp; bounded pending and concurrency; transient-only retries with jitter and Retry-After; HTTPS by default and reserved header protection; Micrometer metrics; honest best-effort documentation.
…fter, deterministic field order
Thanks @snazy , this was super helpful - PTAL..
|
Related to #5082.
Polaris has push-style event listeners for OpenTelemetry (needs an OTLP collector) and AWS CloudWatch (AWS-only), but nothing for generic HTTP endpoints. Many SIEM/audit systems (Splunk HEC, Elastic, Opensearch, Datadog, custom collectors) accept plain HTTP+JSON webhooks.
This adds a
webhookevent listener (polaris.event-listener.types=webhook) that:polaris.event-listener.webhook.endpoint.polaris.event-listener.webhook.secret), sent asX-Polaris-Signature-256: sha256=<hex>so receivers can verify authenticity (GitHub-webhook style). AnX-Polaris-Eventheader carries the event type.polaris.event-listener.webhook.headers), e.g.Authorizationfor receivers that require it (Splunk HEC, etc.).max-attempts,retry-backoff), then drops the event and logs an error.RawEventAccess), so denylisted attributes such as credentials are never delivered.Delivery is best-effort (in-memory retries, lost on restart) - same semantics as the CloudWatch listener; this is documented in the configuration reference, which also documents the payload schema and signature verification.
Implementation notes: packaged as an extension module under extensions/events/webhook, following the layout of the Kafka event listener (#4923). Listener code is modeled on AwsCloudWatchEventListener; uses the JDK java.net.http.HttpClient and javax.crypto only, so no new dependencies.
Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)