Hello,
I have two kind of related questions, one is specific two webhooks security in general and the other about how Zapier triggers webhooks.
1. I’ve read a lot about webhooks recently. Every piece of information I read points out that, for security reasons, it’s best to use shared secrets and sign the payload (usually with HMAC) when sending a webhook request. I don’t quite understand this hassle.
Imagine I have a server side app. I want my app to receive a webhook from a different app (in other words, I want to subsribe to an event in a different app). So I create an URL in my app to accept the webhook. My app also has its own HTTP API that anyone authorized can call. Now the question. Why the webhook URL should have a different security appoach than any other API my app has? If the general API endpoints has authentication mechanism (let’s say with simple API key), why can’t the webhook URL use the same approach?
Well, I understand it can actually. What I don’t understand is that why, when it comes to webhooks, almost everyone says about using signature and preventing reply attacks and almost no one says the same when it comes to regular API calls? What is the crucial difference here? Let’s say we talk about HTTPS in both cases (obviously).
Just to clarify what I’m talking about, here is the doc from Zapier with best practices how to implement webhooks security: https://resthooks.org/docs/security/
2. Zaper has Webhooks app that can trigger outgoing webhooks. In the light of the above said, why it doesn’t seem to support signing the webhook payload? It’s especially strange, if we consider the suggestions in the doc from Zapier menioned above.
Could someone explain to me what I’m missing here?
Thanks!
Outgoing webhooks security in Zapier
Best answer by ZaneBest answer by Zane
Great question. Let’s first clarify the context. Are you asking from the point of view of a user using the Webhooks by Zapier built-in app, or are you building a custom Zapier integration for your API/product?
TLDR for app developers - If your API signs its webhook payloads, you can implement signature verification in the perform method of your trigger, assuming a key is provided in the subscription response (or as, say, extra info in the oauth token response which you store in a “computed field”).
As for the general question about webhooks and why auth might be different on a hook receive endpoint. I think the answer is in this part of your question: “My app also has its own HTTP API that anyone authorized can call.” In many cases, such as Zapier, you won’t have this 2-way relationship between the producer and the consumer. This is part of what distinguishes what gets called a “web hook” from just a regular API invocation. I have an authenticated relationship to you, to tell you to send me messages. You know it’s me who asked for them and told you where to send the messages. Now you just send messages to that HTTP endpoint. But at no point did you set up a principal and store credentials in my system to use my endpoint. I could tell you to send that message to anyone’s endpoint and you wouldn’t care. This how lots of webhooks work, generally, and it’s that flexibility and ease to set up that made them popular.
The subscription URL should be unique to the trigger instance. It should include a long not-guessable value. It’s transmitted securely. The hook messages should be transmitted securely. Some teams require an extra level of security to ensure that the message actually did come from the sender and hadn’t been tampered with in the middle, and that’s where digest verification or other mechanisms come it.
Another distinguishing feature of “webhooks” vs regular API calls is that most often no user-specific information is transmitted back to the web hook producer from the hook consumer, eliminating the need, in many cases, for both parties to have authenticated relationships with each other.
Disclaimer: Please talk to a security expert when architecting your system to identify adequate measures for the use cases and data you are handling.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.