Add delivery ID and attempt headers to outbound webhooks - #222
Merged
Conversation
Webhook deliveries carried no per-delivery identifier, so a receiving endpoint had no way to recognize that two HTTP calls (a manual retry, a network-level retry, or a scheduled retry) corresponded to the same logical delivery, leaving them unable to dedupe and risking duplicate side effects like double-charging or double-provisioning. Add an X-Webhook-Delivery-Id header (the delivery's stable ID) and an X-Webhook-Attempt header (the current attempt number) to every outbound webhook request in SendWebhook, and document both in WEBHOOK_README.md's Webhook Security section alongside the existing X-Webhook-Secret/X-Webhook-Event headers. Fixes #43 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VhUzR11zCCYyxBu4ixbpjF
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.
What was broken
SendWebhooknever sent any per-delivery or per-attempt identifier to the destination endpoint (app/Jobs/SendWebhook.php). The outbound request only carried:Without a stable delivery identifier, a receiving endpoint has no way to recognize that two HTTP calls correspond to the same logical delivery — whether caused by a manual "retry" via
POST /api/v1/deliveries/{id}/retry, an ordinary network-level retry, or the scheduledwebhooks:process-retriesretry path. This is standard practice for webhook platforms (GitHub, Stripe, etc. all send a delivery/event ID) specifically so consumers can implement idempotent processing. Without it, any duplicate delivery silently causes the receiver to process the same event twice (e.g. double-charging, double-provisioning), with no way for the receiving side to defend against it.What changed
X-Webhook-Delivery-Idheader (the delivery's stable ID — the same value across every attempt for a given delivery) to every outbound webhook request.X-Webhook-Attemptheader (the current attempt number, incrementing on each retry) alongside it.WEBHOOK_README.md's "Webhook Security" section, next to the existingX-Webhook-Secret/X-Webhook-Eventheaders.tests/Feature/SendWebhookDeliveryIdHeaderTest.php, covering:Testing
vendor/bin/pint --dirty— cleancomposer test(full suite) — 248 passed, 1 pre-existing skip, 0 failuresFixes #43
🤖 Generated with Claude Code
https://claude.ai/code/session_01VhUzR11zCCYyxBu4ixbpjF
Generated by Claude Code