Skip to content

Security: Implement Webhook Event Tamper-Proofing with Payload Signatures #516

Description

@Smartdevs17

Context

Webhook payloads travel over the internet and could be intercepted or modified in transit, leading to merchants acting on falsified data.

Current Limitation/Problem

Webhook payloads have basic signature verification but lack comprehensive tamper-proofing including payload body hashing, signed headers, and timestamp validation.

Expected Outcome

Tamper-proof webhook delivery with HMAC-SHA256 payload signatures, timestamp binding, and optional payload encryption. Merchants can verify authenticity without contacting the server.

Acceptance Criteria

  • Sign webhook payload with HMAC-SHA256 using merchant-specific secret
  • Include signature in header: X-AgenticPay-Signature
  • Include timestamp header for replay protection (<5min tolerance)
  • Support multiple signature versions for key rotation
  • Include signature in webhook body as webhook.signature field
  • Optional payload encryption with merchant public key
  • Merchant verification guide and code examples in docs
  • SDK method: verifyWebhookSignature(payload, signature, secret)
  • Automatic secret rotation (90-day expiration)

Technical Scope

  • backend/src/services/webhooks/signer.ts - payload signing
  • packages/sdk/src/webhooks/verifier.ts - signature verification
  • backend/src/services/webhooks/encryption.ts - optional payload encryption
  • Prisma: WebhookSecret model with rotation tracking
  • Frontend: webhook secret management UI
  • Edge cases: payload too large (streaming hash), key rotation period, clock skew

Metadata

Metadata

Assignees

Labels

200-points200 point issueStellar WaveIssues in the Stellar wave programdrips-waveIssues in the Drips Wave programhighHigh complexity issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions