Repository navigation
fix(webhooks): require v1 version prefix when verifying signatures - #324
Open
shafiktanbir wants to merge 1 commit into
Open
shafiktanbir wants to merge 1 commit into
shafiktanbir wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Webhooks.verifysplit each signature entry on,and verified the digest without checking that the version prefix isv1, so headers such asv0,<hmac>orv2,<hmac>were accepted.Changes:
parts[0] == "v1"alongsidelen(parts) == 2inresend/webhooks/_webhooks.py.tests/webhooks_test.pyverifying non-v1signatures are rejected while mixed headers containing a validv1signature succeed.Verification:
flake8 --max-line-length=130 ./resend/mypy --ignore-missing-imports resend/ examples/ tests/webhooks_test.py(160 files, 0 issues)pytest --doctest-modules tests(879 passed)Summary by cubic
Fixes webhook signature verification so only
v1-prefixed signatures are accepted. Previously, headers likev0,<hmac>orv2,<hmac>were treated as valid because the version prefix was never checked.Bug Fixes
v1when parsing signature entries.v0/v2signatures and acceptance of mixed headers containing a validv1signature.Written for commit 7e24bbb. Summary will update on new commits.