-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple signing_secret #98
Comments
Hi @gustafr. Thanks for chiming in about this. It's something I contemplated as a potential issue as I started the removal process of other authentication schemes (see #95, #96, #97); however, I wasn't sure about what the potential use-case for multiple The plan was to move entirely to a single I can think of a few options and/or workarounds.
Overall, I think I like Option 3 the best, because it is the simplest solution. Most applications should only need one I'm interested in other people's thoughts on this matter. |
Hi @rmm5t,
This could be achived if we built a signing_secret_retriever Proc as you suggested. What do you think, any pitfalls? I haven't been giving this a whole lot of thought so I might just miss something important here. If i can be of any assistance in solving this, just let me know. |
This is not true, because I run a Stripe Connect application that only listens to the Connect webhook. If your Platform Account is registered as a Connected account for your Connect application, you can just subscribe to your single Connect webhook and get all the events through this same subscription (See Option 1 above). All you have to do is sniff for However, there might be admin-level events on the Account webhooks that are not delivered to the Connect endpoints (I'm not sure).
Option 2 (using a
I certainly do not want to distinguish config parameters like The more I noodle on this problem, the more I lean towards Option 3 and allowing for an optional array of signing secrets. # For most Stripe applications:
StripeEvent.signing_secret = ENV["STRIPE_SIGNING_SECRET"]
# For some Stripe Connect applications:
StripeEvent.signing_secrets = [
ENV["STRIPE_ACCOUNT_SIGNING_SECRET"],
ENV["STRIPE_CONNECT_SIGNING_SECRET"],
] Super easy for developer adoption, and relatively easy to implement in this library. There is almost zero downside, aside from the potential of an extra verification check per webhook event when multiple signing secrets are configured (but let the robots do our work for us, and the alternative of a lookup proc is likely just as much processing). There's another option I can think of (let's call this Option 5), but it's the most complex, and it might only yield diminishing returns. That option would be to extend the config settings to the namespacing of the library itself and allow for multiple namespaces at once. In other words, you'd have entirely different subscribers for each of your different webhooks. This would likely require a different callback URL for each webhook as well, but you could configure a different |
Just a status update here. This issue is going to block a v2.0.0 release. I.e. We're going to address a solution before v2.0.0 goes out. Likely solved via Option 3. |
@gustafr et al, Please review #99. Most relevant to the discussion here is the section added to the README for how support for multiple signing secrets is enabled:
|
Thank you @rmm5t for addressing this issue so swiftly, I really appreciate it! In my particular usecase this solution will mean quite a few extra verification checks but as you mention, maybe the Proc-solution wouldn't be more effective. I have reviewed #99 and I think the readme update is crystal-clear. Great work! |
You are very welcome. I think this was a great addition to the library.
Thanks! 🍻 |
@gustafr I just merged everything into the Could you please test your use-cases for multiple signing secrets against the master branch? This will help me release v2.0.0 sooner. gem "stripe_event", github: "integrallis/stripe_event" Otherwise, I'll plan to release an official v2.0.0 within the next few days. |
Great news @rmm5t! I will test my use-cases against the master branch tomorrow and get back to you as soon as I'm done. |
@rmm5t the multiple signing secrets are working as expected. So from my point of view all should be fine. |
Thanks @gustafr. v2.0.0 is out in the wild 🎉 |
Hi,
When using Stripe Connect, webhooks for the platform account and the connected accounts are handled separately, like this:
and
What i noticed is that the signing_secret is then different for the two endpoints but in the stripe_event gem i can't figure out if it's possible to handle multiple signing_secrets like that?
The text was updated successfully, but these errors were encountered: