feat: Webhook Trigger Router with HMAC Signature & Anti-Replay Protec… - #978
Merged
Conversation
|
@OG-wura is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@OG-wura Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
3 tasks
Contributor
|
pr under review, i will get back to you if i find any wrong implementations |
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.
Close #905
Webhook Trigger Router with HMAC Signature & Anti-Replay Protection
Summary
Exposes a secure
POST /webhook/triggerendpoint that accepts HMAC SHA-256 signed requests to trigger task executions on-demand. Prevents replay attacks via timestamp sliding window and nonce deduplication, then dispatches directly to the execution queue — eliminating polling latency for real-world events.Changes
keeper/src/config.jsinboundWebhooks.pathchanged to/webhook/trigger(overridable viaINBOUND_WEBHOOK_PATH)keeper/src/webhookTrigger.js_resolvePath(req)— dynamically extracts the request path from the URL at runtime so the handler correctly verifies HMAC signatures for any registered path (canonical request includes the path)verify()now uses the resolved path — both/webhook/triggerand legacy/webhooks/task-executionswork transparentlyreject()includeskeyId/eventIdin structured error responseskeeper/src/metrics.jswebhookPathsSet — supports multiple registered webhook pathssetWebhookHandler()pre-register legacy/webhooks/task-executionsalongside the configured path (zero-config backward compat)registerWebhookPath()— extensibility for additional routesthis.webhookPaths.has(url.pathname)replacesurl.pathname === this.webhookPathkeeper/__tests__/webhookTrigger.test.js(+138 lines)/webhook/trigger, legacy/webhooks/task-executions, URL parse failure fallbackkeyIdSecurity Properties
crypto.createHmac('sha256')on canonical requestwebhookAuth.js:98Math.abs(now - timestamp)webhookAuth.js:177InMemoryReplayStorewith TTL evictionwebhookAuth.js:101crypto.timingSafeEqual()webhookAuth.js:16webhookTrigger.js:99webhookTrigger.js:5_resolvePath()from request URLwebhookTrigger.js:44Flow