Verifying webhook signatures
Both rule webhooks and webhook egress sign each request so you can trust it.
- Header:
X-Synacl-Signature: sha256=<hex> - The value is an HMAC-SHA256 of the raw request body using the secret you configured.
To verify:
- Compute
HMAC_SHA256(secret, rawBody)as hex on your server. - Compare it to the header value using a constant-time comparison.
- 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.