Skip to content

fix(api): reject non-hex webhook signatures (#1253) - #1279

Open
Adithya9605 wants to merge 1 commit into
Vatix-Protocol:mainfrom
Adithya9605:fix/webhook-signature-strict-hex
Open

Adithya9605 wants to merge 1 commit into
Vatix-Protocol:mainfrom
Adithya9605:fix/webhook-signature-strict-hex

Conversation

@Adithya9605

Copy link
Copy Markdown

Summary

verifyWebhookSignature decoded the signature with Buffer.from(sig, 'hex'), which stops at the first invalid character. A valid digest followed by junk (e.g. <digest>zz) decoded to the same 32 bytes and passed. The signature is now checked against /^[0-9a-fA-F]{64}$/ before decoding. Adds webhook.types.spec.ts covering the cases in the issue.

Related issue

Type of change

  • Bug fix

Contract drift check

  • I checked this change against CONTRACTS.md and there is no contract drift

How was this tested?

Ran the new spec in an isolated ts-jest sandbox: 6 passed. <digest>zz is accepted by the old code and rejected now. A correct digest and a wrong well-formed digest behave as before.

Checklist

  • CI passes (lint + tests + build)
  • Self-reviewed the diff
  • Added or updated tests where relevant
  • Docs updated if needed
  • No secrets or credentials committed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apps/api: webhook signature verification accepts a non-hex signature string

1 participant