Security
Listening to a webhook implies exposing an URL (the webhook endpoint) to the web. As the endpoint needs to be public and anyone can call it, it is insecure by default.
The solution implies MeetingLawyers to hash each request payload with a secret, creating a signature. This resulting signature will be included in the headers of the request, which you can then use to verify that the contents are not tainted or altered.
This page shows you how to configure secrets in webhooks so that they get signed, and how to verify those signatures in your app to maintain the data integrity of your application.
It can be done by verifying the signature of the payload which will be sent in the request header X-Signature
.
info
We do not currently have designated IPs for webhook requests. We use dynamic IP addresses, so we cannot guarantee a static IP address or even a range of IP addresses.
#
ProtocolWe strongly encourage using HTTPS for your webhook endpoint. HTTP is also supported but firmly discouraged.
When using HTTPS, your SSL/TLS certificate must be validated โ self-signed certificates will not work.
#
Set up your webhook secret- Generate a random string, something between 16 and 32 characters should be good.
- OpenSSL
- Hexdump
- Ruby
- Request our technical team to update your company webhook secret.
#
Validate requestTo validate the received webhook, you will have to generate a signature from the payload using your secret; then,you will need to compare it with the received one.
- Using the HMAC SHA-256 algorithm, create a hash of the entire body as binary, using your webhook secret as a key).
- Encode the binary hash in base64 format.
- Add prefix
sha256=
to the base64 hash. - Compare the created value with the signature you received in the
X-Signature
header.
Here are some examples:
- PHP/Symfony
- Ruby
caution
Take into consideration that line-breaks and other non-visible characters on the request could make the debugging of your signature code a hard task when trying to fake the request body by just copy-pasting it.