Problem
webhook.service.ts sends outbound webhooks to
merchants without any signature. A merchant receiving
a webhook from Migo has no way to verify it's
legitimate. This is a standard security requirement
for any payment protocol.
Expected behavior
Every outbound webhook from Migo should include an
X-Migo-Signature header containing an HMAC-SHA256
of the request body, signed with a secret.
Acceptance criteria
Resources
Problem
webhook.service.tssends outbound webhooks tomerchants without any signature. A merchant receiving
a webhook from Migo has no way to verify it's
legitimate. This is a standard security requirement
for any payment protocol.
Expected behavior
Every outbound webhook from Migo should include an
X-Migo-Signatureheader containing an HMAC-SHA256of the request body, signed with a secret.
Acceptance criteria
sendWebhook()addsX-Migo-Signature: sha256=<hex>to every requestWEBHOOK_SECRETenv variablecrypto.createHmac('sha256', secret) .update(body).digest('hex')crypto.timingSafeEqualfor verificationto prevent timing attacks
to verify the signature
Resources
api/src/services/webhook.service.ts