Verifying webhook signatures

Both rule webhooks and webhook egress sign each request so you can trust it.

To verify:

  1. Compute HMAC_SHA256(secret, rawBody) as hex on your server.
  2. Compare it to the header value using a constant-time comparison.
  3. Reject the request if they don't match.

Use the exact raw bytes of the body (don't re-serialize parsed JSON) or the hash won't match. Keep the secret private; rotate it if exposed.