Skip to content

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

Merged
dielduarte merged 3 commits into
resend:mainfrom
shafiktanbir:fix/webhook-require-v1-prefix
Nov 26, 2026
Merged

dielduarte merged 3 commits into
resend:mainfrom
shafiktanbir:fix/webhook-require-v1-prefix

Conversation

@shafiktanbir

@shafiktanbir shafiktanbir commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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; headers like v0,<hmac> or v2,<hmac> were previously treated as valid. Also bumps the package version to 2.56.2.

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 09289f1. 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
@dielduarte
dielduarte merged commit e3ac058 into resend:main Nov 26, 2026
11 checks passed
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.

2 participants