Repository navigation
feat(alerts): outbound HTTPS webhooks + delivery log (#225) - #509
Merged
Merged
Conversation
Add project webhook CRUD, signed alert.fired dispatch with retry/dead-letter, and an operator-facing delivery history on Alerts → Delivery so MVP #225 is closable after merge. Co-authored-by: Cursor <[email protected]>
8 of 10 tasks
…as FAILED DNS-rebinding helper hostnames passed create-time string checks; re-check resolved IPs on each delivery. Single-shot test deliveries never retry, so record FAILED instead of DEAD. Co-authored-by: Cursor <[email protected]>
Use the resolved, validated address for direct alert deliveries and record retry outcomes without relying on unsupported queue states. Co-authored-by: Cursor <[email protected]>
Enqueue PENDING AlertWebhookDelivery rows before fireProjectAlert returns, process them via a claim/lease worker (brief-worker pattern), and pin HTTPS connects to validated resolved IPs to close DNS-rebinding TOCTOU. Co-authored-by: Cursor <[email protected]>
Collaborator
Author
Merge blockers addressed1. DNS-based SSRF (pin-to-IP)
2. Durable delivery + retries
Schema fields on Commit: |
Keep AlertEvent insert and PENDING enqueue in one transaction so a failed createMany cannot orphan a dedupe key, and reuse the test delivery UUID in the log row. Co-authored-by: Cursor <[email protected]>
Normalize IPv6 hextets so IPv4-mapped and IPv4-compatible forms (compressed, expanded, or hex-mapped) cannot bypass the delivery blocklist. Co-authored-by: Cursor <[email protected]>
Check completeAlertWebhookDelivery after successful POST so a lost lease is not reported as success, renew the lease before POST, and create webhooks under a serializable count+insert to honor MAX_PROJECT_WEBHOOKS. Co-authored-by: Cursor <[email protected]>
When HTTP delivery succeeds but the lease-scoped complete misses, still mark the row SUCCESS so it cannot stay PROCESSING and be POSTed again. Co-authored-by: Cursor <[email protected]>
Prevent short lease overrides from expiring mid-HTTPS POST, and persist test delivery rows before sending so Recent deliveries cannot miss a hit. Co-authored-by: Cursor <[email protected]>
Exclude webhook:test: rows from worker claim and fail null alert_event_id deliveries instead of inventing a generic payload that could double-POST. Co-authored-by: Cursor <[email protected]>
Retry the final SUCCESS/FAILED update and fall back to FAILED so claim-excluded webhook:test rows cannot stay PROCESSING forever. Co-authored-by: Cursor <[email protected]>
Clear PROCESSING immediately without burning the attempt toward DEAD, so a still-owned row is not stuck until lease expiry. Co-authored-by: Cursor <[email protected]>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c5ec495. Configure here.
Reclaiming an expired lease no longer increments attempt, so a crash before POST still gets the full WEBHOOK_MAX_ATTEMPTS of real deliveries. Co-authored-by: Cursor <[email protected]>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
alert.firedJSON fromfireProjectAlert, retry +AlertWebhookDeliverypersistence, SSRF-safe URL checks (no redirect follow).GET /api/project/webhook-deliveries(optionalwebhookIdfilter) and a Recent webhook deliveries list in Alerts → Delivery (status, timestamps, HTTP/error summary, which webhook).Test plan
20260717120000_project_alert_webhooksand confirmProjectWebhook/AlertWebhookDeliveryexisthttp://,localhost, private IPs, and IPv4 shorthand like127.1on createpnpm lint && pnpm test && pnpm build(already green locally)Made with Cursor