django-rest-hooks icon indicating copy to clipboard operation
django-rest-hooks copied to clipboard

Add auth field

Open imsickofmaps opened this issue 8 years ago • 7 comments

This is a proposal to add an optional Authorization header to the webhook. Doing so would allow a higher level of security to the outbound payload. Thoughts?

imsickofmaps avatar Apr 22 '16 08:04 imsickofmaps

What level of security are you looking for here? So that the receiver can verify the authenticity of the webhooks?

bryanhelmig avatar Apr 22 '16 17:04 bryanhelmig

@bryanhelmig yes, so the receiver can say "when you talk to me, use this auth token so I can trust you". The flip side to increasing trust requirements is being able to easily discard anything that doesn't auth, reducing processing.

imsickofmaps avatar Apr 26 '16 18:04 imsickofmaps

Pretty interesting. I'm not sure I'd advocate adding a column for that though.

Consider an alternative - a shared secret combined with hmac hashing could accomplish the same thing without needing to store extra state per subscription.

The secret could be your API key or even a static value you share with trusted partners. Not sure your requirements. Take a look at Mailgun - they do something like this.

bryanhelmig avatar Apr 26 '16 19:04 bryanhelmig

Thanks for the counter suggestion, it's an interesting one. I'll have a look at the implementation and document and share the setup if it works for us.

imsickofmaps avatar Apr 27 '16 10:04 imsickofmaps

Awesome! I'd be down to see some utilities added here or at least documentation if you get something working.

bryanhelmig avatar Apr 27 '16 17:04 bryanhelmig

@imsickofmaps did you get anything working for authentication? please let us know.

Thanks in advance

pk026 avatar Apr 20 '17 12:04 pk026

@pk026 we used a solution like this in the end which re-used the auth token: https://gist.github.com/imsickofmaps/09dcb8c4aa37ed5057ce6c190d19b0ae

I recommend signing though as a better, more scaleable, solution. Check https://documentation.mailgun.com/user_manual.html?highlight=hmac#webhooks for ideas.

imsickofmaps avatar Apr 20 '17 15:04 imsickofmaps