Streams webhook security

Since a webhook route is needed for Streams, there is no way to really protect this webhook route/endpoint from accepting any malicious request, correct?

Wouldn’t it be better in the Streams UI to generate some sort of signing key to send with each request from Moralis and then in the webhook route check to see if this signing key exists before executing anything in the route?

Stripe offers this whenever you create a webhook in Stripe, you add your webhook endpoint, select the events to watch and it generates a key. You use this key to intercept the incoming requests on your endpoint to determine if they are legit.

Hi @jins

There is a way to verify if the stream is from moralis or not using Moralis.Streams.verifySignature.
You can find an example here

If you are using the API directly then you can also create your own function to verify it. Check below for more details.

1 Like