Skip to content

fix(webhooks): require v1 version prefix when verifying signatures - #324

Open
shafiktanbir wants to merge 1 commit into
resend:mainfrom
shafiktanbir:fix/webhook-require-v1-prefix
Open

shafiktanbir wants to merge 1 commit into
resend:mainfrom
shafiktanbir:fix/webhook-require-v1-prefix

Conversation

@shafiktanbir

@shafiktanbir shafiktanbir commented Nov 23, 2026 •

Copy link
Copy Markdown

Webhooks.verify split each signature entry on , and verified the digest without checking that the version prefix is v1, so headers such as v0,<hmac> or v2,<hmac> were accepted.

Changes:

  • Require parts[0] == "v1" alongside len(parts) == 2 in resend/webhooks/_webhooks.py.
  • Add unit tests in tests/webhooks_test.py verifying non-v1 signatures are rejected while mixed headers containing a valid v1 signature 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 like v0,<hmac> or v2,<hmac> were treated as valid because the version prefix was never checked.

Bug Fixes

  • Require the version prefix to be exactly v1 when parsing signature entries.
  • Add tests covering rejection of v0/v2 signatures and acceptance of mixed headers containing a valid v1 signature.

Written for commit 7e24bbb. Summary will update on new commits.

View guided diff

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant