Is there any security mechanism in Webflow to ensure the origin of a webhook and validate that it is coming from Webflow?

Published on
September 22, 2023

Webflow provides a security mechanism for webhooks to ensure the origin and validate their authenticity. This is achieved through the use of a shared secret and HMAC signatures. When setting up a webhook in Webflow, you have the option to enable "Authenticate webhook" and provide a shared secret.

To ensure the origin and validate the webhook, follow these steps:

  1. Generate a shared secret: To create a shared secret in Webflow, go to the Project Settings and select the "Integrations" tab. Under the "Webhooks" section, click on the "New Webhook" button. In the webhook settings, check the box for "Authenticate webhook" and enter the shared secret. Make sure to save the webhook.

  2. Validate the webhook's signature: When a webhook is triggered, Webflow includes an X-Wf-Signature header in the webhook request. This header contains an HMAC signature of the webhook payload using the shared secret. To validate the webhook, you need to calculate the HMAC signature of the payload using the shared secret and compare it with the value in the X-Wf-Signature header. If the signatures match, it means the webhook is authentic and originated from Webflow.

  3. Implement the validation logic: To ensure the origin and validate the webhook in your own server or application, you need to implement the following steps:

  • Retrieve the X-Wf-Signature header from the webhook request.
  • Retrieve the shared secret associated with the webhook from your system.
  • Calculate the HMAC signature of the payload using the shared secret.
  • Compare the calculated signature with the value in the X-Wf-Signature header.
  • If the signatures match, process the webhook payload. Otherwise, reject the request.

By following these steps, you can ensure the authenticity and origin of webhooks received from Webflow, providing an additional layer of security for your integration.

Additional Questions:

  1. How to enable authentication for webhooks in Webflow?
  2. What is an HMAC signature and how does it ensure webhook security?
  3. Can multiple shared secrets be used for different webhooks in Webflow?