Repository navigation
feat: verify webhooks with the endpoint's webhook secret - #3
Merged
Merged
Conversation
Deliveries are signed with each endpoint's own webhook secret (whsec_..., shown
in the console), not the app's API secret. client.verifyWebhook passed the API
secret, so it could never verify a real delivery. It now takes the webhook
secret as its first argument; the standalone verify function is unchanged.
Also:
- With a max age set, timestamps more than 300s in the future are rejected in
every SDK (previously node/go rejected any future timestamp, python/php
accepted all).
- Shared conformance fixture gains verify_cases (array headers, skew, expiry,
wrong secret), run by every SDK.
- Docs and examples use the webhook secret, a 5 minute max age, the event
payload shape ({id, event, app_id, channel, user_id, time_ms}) and dedupe on id.
- List/tuple header values use the first entry; a non-ASCII signature returns
False instead of raising.
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
Webhook deliveries are signed with each endpoint's own webhook secret (
whsec_…, shown in the console), not the app's API secret.client.verifyWebhookpassed the API secret, so it could never verify a real delivery. It now takes the webhook secret as its first argument. The standalone verify function keeps its signature.Also:
verify_cases(array headers, skew, expiry, wrong secret, missing header), run here.{id, event, app_id, channel, user_id, time_ms}, and dedupe onid.Release
Version and changelog are left to release-please. The commit is
feat:(minor bump). The client-method signature change is technically breaking, but the old method could not verify any real delivery, so there's nothing working to break. Don't publish until apinator-io/backend#49 is deployed, so the docs match a live feature.Testing
Full test suite passes on current main.